WIP: runner uses kernel prebuilt for correct arch #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-test-vm | |
on: {} | |
# workflow_dispatch: # adds ability to run this manually | |
# inputs: | |
# tag: | |
# description: 'Tag to use for the Docker images' | |
# type: string | |
# required: true | |
# workflow_call: | |
# inputs: | |
# skip: | |
# description: 'Changes this action to perform a no-op' | |
# type: boolean | |
# required: false | |
# tag: | |
# description: 'Tag to use for the Docker images' | |
# type: string | |
# required: true | |
# upload-vm-builder: | |
# description: 'If true, upload vm-builder in an artifact' | |
# type: boolean | |
# required: false | |
# default: false | |
# outputs: | |
# vm-postgres-16-bullseye: | |
# description: 'image name for postgres:16-bullseye, VM-ified' | |
# value: ${{ jobs.tags.outputs.vm-postgres-16-bullseye }} | |
env: | |
IMG_POSTGRES_16_BULLSEYE: "neondatabase/vm-postgres-16-bullseye" | |
# using image built in the same workflow | |
IMG_DAEMON: "daemon:dev" | |
TARGET_ARCH: "amd64" | |
defaults: | |
run: | |
shell: bash -euo pipefail {0} | |
jobs: | |
tags: | |
outputs: | |
vm-postgres-16-bullseye: ${{ steps.show-tags.outputs.vm-postgres-16-bullseye }} | |
daemon: ${{ steps.show-tags.outputs.daemon }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: show-tags | |
run: | | |
echo "vm-postgres-16-bullseye=${{ env.IMG_POSTGRES_16_BULLSEYE }}:${{ inputs.tag }}" | tee -a $GITHUB_OUTPUT | |
echo "daemon=${{ env.IMG_DAEMON }}" | tee -a $GITHUB_OUTPUT | |
build: | |
# nb: use format(..) to catch both inputs.skip = true AND inputs.skip = 'true'. | |
if: ${{ format('{0}', inputs.skip) != 'true' }} | |
needs: tags | |
runs-on: [ self-hosted, gen3, large ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
# Disable cache on self-hosted runners to avoid /usr/bin/tar errors, see https://github.com/actions/setup-go/issues/403 | |
cache: false | |
# Sometimes setup-go gets stuck. Without this, it'll keep going until the job gets killed | |
timeout-minutes: 10 | |
- run: make docker-build-daemon | |
- run: make bin/vm-builder | |
- name: upload vm-builder | |
if: ${{ format('{0}', inputs.upload-vm-builder) == 'true' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: vm-builder | |
path: bin/vm-builder | |
if-no-files-found: error | |
retention-days: 2 | |
- name: set custom docker config directory | |
uses: ./.github/actions/set-docker-config-dir | |
- name: login to docker hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }} | |
- name: build ${{ needs.tags.outputs.vm-postgres-16-bullseye }} | |
run: | | |
./bin/vm-builder -src postgres:16-bullseye -spec tests/e2e/image-spec.yaml -dst ${{ needs.tags.outputs.vm-postgres-16-bullseye }} -daemon-image ${{ needs.tags.outputs.daemon }} -target-arch linux/${TARGET_ARCH} | |
- name: docker push ${{ needs.tags.outputs.vm-postgres-16-bullseye }} | |
run: | | |
docker push ${{ needs.tags.outputs.vm-postgres-16-bullseye }} |