From 9e2095e75c10d67dc49b0dbb302e11f9ebd94941 Mon Sep 17 00:00:00 2001 From: "Douglas Cerna (Soy Douglas)" Date: Wed, 22 Jan 2025 17:46:01 -0600 Subject: [PATCH] Test Ubuntu 20.04 and 22.04 --- .../workflows/vagrant-box-archivematica.yml | 30 ++++++++++++++----- .../template.json.pkr.hcl | 7 ++++- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/vagrant-box-archivematica.yml b/.github/workflows/vagrant-box-archivematica.yml index 63692058..4d7dbafe 100644 --- a/.github/workflows/vagrant-box-archivematica.yml +++ b/.github/workflows/vagrant-box-archivematica.yml @@ -5,11 +5,18 @@ on: - "dev/add-24.04-vagrant-base-image" jobs: build-base-image: - name: Build base image + name: "Build base image Ubuntu ${{ matrix.ubuntu-version }}" runs-on: ubuntu-24.04 env: PACKER_CACHE_DIR: ${{ github.workspace }}/.packer_cache PACKER_LOG: TRACE + strategy: + fail-fast: false + matrix: + ubuntu-version: [ + "20.04", + "22.04", + ] steps: - name: Check out code uses: actions/checkout@v4 @@ -26,29 +33,36 @@ jobs: echo "LOGNAME=$USER" >> $GITHUB_ENV - name: Build run: | - cd ${{ github.workspace }}/packer/templates/vagrant-base-ubuntu-22.04-amd64 + cd "${{ github.workspace }}/packer/templates/vagrant-base-ubuntu-${{ matrix.ubuntu-version }}-amd64" packer init template.json.pkr.hcl packer build -on-error=abort template.json.pkr.hcl - name: Upload base image uses: actions/upload-artifact@v4 with: - name: base-image - path: "${{ github.workspace }}/packer/builds/virtualbox/vagrant-base-ubuntu-22.04-amd64" + name: "base-image-${{ matrix.ubuntu-version }}" + path: "${{ github.workspace }}/packer/builds/virtualbox/vagrant-base-ubuntu-${{ matrix.ubuntu-version }}-amd64" vagrant-box-archivematica: - name: Build and upload box image + name: "Build and upload box image Ubuntu ${{ matrix.ubuntu-version }}" runs-on: ubuntu-24.04 needs: ["build-base-image"] env: PACKER_CACHE_DIR: ${{ github.workspace }}/.packer_cache PACKER_LOG: TRACE + strategy: + fail-fast: false + matrix: + ubuntu-version: [ + "20.04", + "22.04", + ] steps: - name: Check out code uses: actions/checkout@v4 - name: Restore base image uses: actions/download-artifact@v4 with: - name: base-image - path: "${{ github.workspace }}/packer/builds/virtualbox/vagrant-base-ubuntu-22.04-amd64" + name: "base-image-${{ matrix.ubuntu-version }}" + path: "${{ github.workspace }}/packer/builds/virtualbox/vagrant-base-ubuntu-${{ matrix.ubuntu-version }}-amd64" - name: "Install packer, vagrant and VirtualBox" run: | wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg @@ -68,7 +82,7 @@ jobs: run: | cd ${{ github.workspace }}/packer/templates/vagrant-box-archivematica packer init template.json.pkr.hcl - packer build -on-error=abort template.json.pkr.hcl + packer build -on-error=abort -var "release=${{ matrix.ubuntu-version }}" template.json.pkr.hcl mv ${{ github.workspace }}/packer/builds/virtualbox/vagrant-am.box \ ${{ github.workspace }}/archivematica-vagrant-v1.17.0.box - name: Provision a test VM with the new image diff --git a/packer/templates/vagrant-box-archivematica/template.json.pkr.hcl b/packer/templates/vagrant-box-archivematica/template.json.pkr.hcl index 916bb3d9..3791726a 100644 --- a/packer/templates/vagrant-box-archivematica/template.json.pkr.hcl +++ b/packer/templates/vagrant-box-archivematica/template.json.pkr.hcl @@ -15,10 +15,15 @@ packer { } } +variable "release" { + type = string + default = "22.04" +} + source "virtualbox-ovf" "ubuntu" { headless = "true" shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now" - source_path = "../../builds/virtualbox/vagrant-base-ubuntu-22.04-amd64/vagrant-base-ubuntu-22.04-amd64.ovf" + source_path = "../../builds/virtualbox/vagrant-base-ubuntu-${var.release}-amd64/vagrant-base-ubuntu-${var.release}-amd64.ovf" ssh_password = "vagrant" ssh_username = "vagrant" ssh_wait_timeout = "30s"