feat: Create RKE2 node template foruse on Harvester
This commit is contained in:
@ -2,51 +2,47 @@ name: build-image
|
|||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# semrel_dryrun:
|
semrel_dryrun:
|
||||||
# name: Semantic Release (Dry-run)
|
name: Semantic Release (Dry-run)
|
||||||
# runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# outputs:
|
outputs:
|
||||||
# version: ${{ steps.sem_rel.outputs.version }}
|
version: ${{ steps.sem_rel.outputs.version }}
|
||||||
# steps:
|
steps:
|
||||||
# - name: Check out repository code
|
- name: Check out repository code
|
||||||
# uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
# - name: Set up Node
|
- name: Install dependencies
|
||||||
# uses: actions/setup-node@v3
|
run: |
|
||||||
# with:
|
npm install \
|
||||||
# node-version: 20
|
semantic-release \
|
||||||
# - name: Install dependencies
|
@semantic-release/commit-analyzer \
|
||||||
# run: |
|
@semantic-release/exec
|
||||||
# npm install \
|
- name: Semantic Release (dry-run)
|
||||||
# semantic-release \
|
id: sem_rel
|
||||||
# @semantic-release/commit-analyzer \
|
run: |
|
||||||
# @semantic-release/exec
|
npx semantic-release \
|
||||||
# - name: Semantic Release (dry-run)
|
--package @semantic-release/exec \
|
||||||
# id: sem_rel
|
--package semantic-release \
|
||||||
# run: |
|
--branches ${{ gitea.refname }} \
|
||||||
# npx semantic-release \
|
--tag-format 'v${version}' \
|
||||||
# --package @semantic-release/exec \
|
--dry-run \
|
||||||
# --package semantic-release \
|
--plugins @semantic-release/commit-analyzer,@semantic-release/exec \
|
||||||
# --branches ${{ gitea.refname }} \
|
--analyzeCommits @semantic-release/commit-analyzer \
|
||||||
# --tag-format 'v${version}' \
|
--verifyRelease @semantic-release/exec \
|
||||||
# --dry-run \
|
--verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT'
|
||||||
# --plugins @semantic-release/commit-analyzer,@semantic-release/exec \
|
env:
|
||||||
# --analyzeCommits @semantic-release/commit-analyzer \
|
GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }}
|
||||||
# --verifyRelease @semantic-release/exec \
|
- name: Assert semantic release output
|
||||||
# --verifyReleaseCmd 'echo "version=${nextRelease.version}" >> $GITHUB_OUTPUT'
|
run: |
|
||||||
# env:
|
[[ -z "${{ steps.sem_rel.outputs.version }}" ]] && {
|
||||||
# GIT_CREDENTIALS: ${{ secrets.GIT_USERNAME }}:${{ secrets.GIT_APIKEY }}
|
echo 'No release tag - exiting'; exit 1
|
||||||
# - name: Assert semantic release output
|
} || {
|
||||||
# run: |
|
echo 'Release tag set correctly: ${{ steps.sem_rel.outputs.version }}'; exit 0
|
||||||
# [[ -z "${{ steps.sem_rel.outputs.version }}" ]] && {
|
}
|
||||||
# echo 'No release tag - exiting'; exit 1
|
|
||||||
# } || {
|
|
||||||
# echo 'Release tag set correctly: ${{ steps.sem_rel.outputs.version }}'; exit 0
|
|
||||||
# }
|
|
||||||
|
|
||||||
build_image:
|
build_image:
|
||||||
name: Build image
|
name: Build image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# needs: semrel_dryrun
|
needs: semrel_dryrun
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -71,7 +67,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
curl -L \
|
curl -L \
|
||||||
https://sn.itch.fyi/Repository/iso/Canonical/Ubuntu%20Server%2024.04/ubuntu-24.04-server-cloudimg-amd64.img \
|
https://sn.itch.fyi/Repository/iso/Canonical/Ubuntu%20Server%2024.04/ubuntu-24.04-server-cloudimg-amd64.img \
|
||||||
-o ubuntu-vm/ubuntu.img \
|
-o ubuntu-vm/ubuntu_rke2_${{ steps.sem_rel.outputs.version }}.img \
|
||||||
-u ${{ secrets.REPO_USERNAME }}:${{ secrets.REPO_PASSWORD }}
|
-u ${{ secrets.REPO_USERNAME }}:${{ secrets.REPO_PASSWORD }}
|
||||||
|
|
||||||
qemu-img resize ubuntu-vm/ubuntu.img +5G
|
qemu-img resize ubuntu-vm/ubuntu.img +5G
|
||||||
@ -97,7 +93,7 @@ jobs:
|
|||||||
-m 3072 \
|
-m 3072 \
|
||||||
-smp 2 \
|
-smp 2 \
|
||||||
-cpu host \
|
-cpu host \
|
||||||
-drive file=ubuntu-vm/ubuntu.img,if=virtio,format=qcow2 \
|
-drive file=ubuntu-vm/ubuntu_rke2_${{ steps.sem_rel.outputs.version }},if=virtio,format=qcow2 \
|
||||||
-drive file=ubuntu-vm/seed.iso,format=raw,media=cdrom \
|
-drive file=ubuntu-vm/seed.iso,format=raw,media=cdrom \
|
||||||
-nographic \
|
-nographic \
|
||||||
-net nic \
|
-net nic \
|
||||||
@ -106,7 +102,7 @@ jobs:
|
|||||||
-chardev socket,path=qga.sock,server=on,wait=off,id=qga0 \
|
-chardev socket,path=qga.sock,server=on,wait=off,id=qga0 \
|
||||||
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0
|
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0
|
||||||
|
|
||||||
if ! guestfish --ro -a ubuntu-vm/ubuntu.img -i stat /var/log/template-generation-success; then
|
if ! guestfish --ro -a ubuntu-vm/ubuntu_rke2_${{ steps.sem_rel.outputs.version }} -i stat /var/log/template-generation-success; then
|
||||||
echo "VM provisioning encountered errors - exiting"
|
echo "VM provisioning encountered errors - exiting"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user