Skip to content

Commit

Permalink
ci: build neonvm-daemon in build-images.yaml (#1168)
Browse files Browse the repository at this point in the history
Build and publish neonvm-daemon images since they are expected to be
used by neondatabase/neon repository during the "build vm image" step. [1]

For the simplicity, the neondatabase/autoscaling repo keeps building
local version of the daemon image during the vm-example workflow
(cronbased job) and during the build-test-vm workflow (is used as an
external workflow in the e2e tests).

Closes #1167

[1]: https://github.com/neondatabase/neon/blob/14c4fae64af5613c682ec7dd7d30e484c476e5af/.github/workflows/build_and_test.yml#L820

---------

Signed-off-by: Misha Sakhnov <[email protected]>
  • Loading branch information
mikhail-sakhnov authored Dec 6, 2024
1 parent 02fad62 commit 3be61c4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ on:
autoscaler-agent:
description: 'autoscaler-agent image'
value: ${{ jobs.tags.outputs.autoscaler-agent }}

daemon:
description: 'neonvm-daemon image'
value: ${{ jobs.tags.outputs.daemon }}

env:
IMG_CONTROLLER: "neondatabase/neonvm-controller"
IMG_VXLAN_CONTROLLER: "neondatabase/neonvm-vxlan-controller"
IMG_RUNNER: "neondatabase/neonvm-runner"
IMG_KERNEL: "neondatabase/vm-kernel"
IMG_SCHEDULER: "neondatabase/autoscale-scheduler"
IMG_AUTOSCALER_AGENT: "neondatabase/autoscaler-agent"
IMG_DAEMON: "neondatabase/neonvm-daemon"
IMG_CLUSTER_AUTOSCALER: "neondatabase/cluster-autoscaler-neonvm"
ECR_DEV: "369495373322.dkr.ecr.eu-central-1.amazonaws.com"
ECR_PROD: "093970136003.dkr.ecr.eu-central-1.amazonaws.com"
Expand All @@ -80,6 +84,7 @@ jobs:
scheduler: ${{ steps.show-tags.outputs.scheduler }}
autoscaler-agent: ${{ steps.show-tags.outputs.autoscaler-agent }}
cluster-autoscaler: ${{ steps.show-tags.outputs.cluster-autoscaler }}
daemon: ${{ steps.show-tags.outputs.daemon }}
runs-on: ubuntu-latest
steps:
- id: show-tags
Expand All @@ -90,6 +95,7 @@ jobs:
echo "scheduler=${{ env.IMG_SCHEDULER }}:${{ inputs.tag }}" | tee -a $GITHUB_OUTPUT
echo "autoscaler-agent=${{ env.IMG_AUTOSCALER_AGENT }}:${{ inputs.tag }}" | tee -a $GITHUB_OUTPUT
echo "cluster-autoscaler=${{ env.IMG_CLUSTER_AUTOSCALER }}:${{ inputs.tag }}" | tee -a $GITHUB_OUTPUT
echo "daemon=${{ env.IMG_DAEMON }}:${{ inputs.tag }}" | tee -a $GITHUB_OUTPUT
vm-kernel:
# nb: use format(..) to catch both inputs.skip = true AND inputs.skip = 'true'.
Expand Down Expand Up @@ -294,6 +300,19 @@ jobs:
GO_BASE_IMG=${{ env.GO_BASE_IMG }}
GIT_INFO=${{ steps.get-git-info.outputs.info }}
- name: Build and push neonvm-daemon image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
file: neonvm-daemon/Dockerfile
cache-from: type=registry,ref=cache.neon.build/neonvm-daemon:cache
cache-to: ${{ github.ref_name == 'main' && 'type=registry,ref=cache.neon.build/neonvm-daemon:cache,mode=max' || '' }}
tags: ${{ needs.tags.outputs.daemon }}
build-args: |
GO_BASE_IMG=${{ env.GO_BASE_IMG }}
- name: Build and push cluster-autoscaler image
uses: docker/build-push-action@v6
if: ${{ format('{0}', inputs.build-cluster-autoscaler) == 'true' }}
Expand All @@ -312,6 +331,7 @@ jobs:
neonvm-controller \
neonvm-vxlan-controller \
neonvm-runner \
neonvm-daemon \
vm-kernel \
autoscale-scheduler \
autoscaler-agent \
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/build-test-vm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ on:
env:
IMG_POSTGRES_16_BULLSEYE: "neondatabase/vm-postgres-16-bullseye"
# using image built in the same workflow
IMG_DAEMON: "daemon:dev"
IMG_DAEMON: "neondatabase/neonvm-daemon"

defaults:
run:
Expand All @@ -46,13 +46,15 @@ jobs:
- 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
echo "daemon=${{ env.IMG_DAEMON }}:${{ inputs.tag }}" | 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 ]
env:
IMG_DAEMON: ${{ needs.tags.outputs.daemon }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down

0 comments on commit 3be61c4

Please sign in to comment.