From e82d1a7898c6e47c1a531acff2ccebd6e00bed29 Mon Sep 17 00:00:00 2001 From: Kiefer Chang Date: Thu, 28 Dec 2023 16:50:06 +0800 Subject: [PATCH] ci: move to self-hosted action runner [CI SKIP] --- .github/workflows/scan.yml | 2 +- .github/workflows/vagrant-install.yaml | 56 ++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/vagrant-install.yaml diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index b924f7911..a74e301d5 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -4,7 +4,7 @@ on: branches: - master - 'v**' - pull_request: +# pull_request: jobs: build: diff --git a/.github/workflows/vagrant-install.yaml b/.github/workflows/vagrant-install.yaml new file mode 100644 index 000000000..8a101f6af --- /dev/null +++ b/.github/workflows/vagrant-install.yaml @@ -0,0 +1,56 @@ +name: Vagrant install + +on: + pull_request: + types: [opened, reopened, synchronize] + +env: + LIBVIRT_DEFAULT_URI: "qemu:///system" + +jobs: + main: + name: Build and deploy + runs-on: + - self-hosted + - Linux + - kvm + - vagrant + - equinix + steps: + - uses: actions/checkout@v3 + # - name: Build Harvester artifacts + # run: | + # export USE_LOCAL_IMAGES=true + # make + - name: Clone and checkout ipxe-examples + id: ipxe + run: | + cd $HOME + if [ ! -f ipxe-examples ]; then + git clone https://github.com/harvester/ipxe-examples.git + fi + + cd ipxe-examples + git reset && git checkout . + git clean -fd + git pull + + echo "VAGRANT_HOME=$HOME/ipxe-examples/vagrant-pxe-harvester" >> $GITHUB_OUTPUT + - name: Clean up previous vagrant deployment + run: | + cd ${{ steps.ipxe.outputs.VAGRANT_HOME }} + vagrant destroy -f --parallel + - name: Remove OVMF.fd line if needed + run: | + cd ${{ steps.ipxe.outputs.VAGRANT_HOME }} + if [ ! -f /usr/share/qemu/OVMF.fd ]; then + echo "Remove libvirt loader: can't find UEFI firmware" + sed 's/libvirt.loader.*/#libvirt.loader = /' Vagrantfile + fi + - name: Generate SSH keys + run: | + ssh-keygen -t rsa -q -N "" -f ./ci/terraform/tmp-ssh-key + - name: Set SSH key in ipxe-examples settings + run: | + export PUB_KEY=$(cat ./ci/terraform/tmp-ssh-key.pub) + yq e -i ".harvester_config.ssh_authorized_keys += [ strenv(PUB_KEY) ]" ${{ steps.ipxe.outputs.VAGRANT_HOME }}/settings.yml