Skip to content

tmp: try fixing pull issues (pt 7) #3

tmp: try fixing pull issues (pt 7)

tmp: try fixing pull issues (pt 7) #3

Workflow file for this run

name: build-images
on:
workflow_call:
inputs:
# 'skip' is kind of silly. it exists because we can't actually *skip* this job from e2e-test,
# otherwise the follow-up job that needs it wouldn't be able to run. So instead we pretend the
# job completed successfully, but actually do nothing...
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
kernel-image:
description: 'Kernel image for the VMs embedded in neonvm-runner. If not specified, a kernel will be built from source'
type: string
required: false
build-cluster-autoscaler:
description: 'Build the custom cluster-autoscaler image'
type: boolean
required: false
controller-preserve-runner-pods:
description: 'ONLY USE FOR E2E TESTS: Set neonvm-controller to never delete VM runner pods'
type: boolean
required: false
upload-to-ecr:
description: 'Should images be uploaded to neon ECR'
type: boolean
required: false
outputs:
controller:
description: 'neonvm-controller image'
value: ${{ jobs.tags.outputs.controller }}
vxlan-controller:
description: 'neonvm-vxlan-controller image'
value: ${{ jobs.tags.outputs.vxlan-controller }}
runner:
description: 'neonvm-runner image'
value: ${{ jobs.tags.outputs.runner }}
scheduler:
description: 'autoscale-scheduler image'
value: ${{ jobs.tags.outputs.scheduler }}
autoscaler-agent:
description: 'autoscaler-agent image'
value: ${{ jobs.tags.outputs.autoscaler-agent }}
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_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"
defaults:
run:
shell: bash -euo pipefail {0}
jobs:
tags:
outputs:
controller: ${{ steps.show-tags.outputs.controller }}
vxlan-controller: ${{ steps.show-tags.outputs.vxlan-controller }}
runner: ${{ steps.show-tags.outputs.runner }}
scheduler: ${{ steps.show-tags.outputs.scheduler }}
autoscaler-agent: ${{ steps.show-tags.outputs.autoscaler-agent }}
cluster-autoscaler: ${{ steps.show-tags.outputs.cluster-autoscaler }}
runs-on: ubuntu-latest
steps:
- id: show-tags
run: |
echo "controller=${{ env.IMG_CONTROLLER }}:${{ inputs.tag }}" | tee -a $GITHUB_OUTPUT
echo "vxlan-controller=${{ env.IMG_VXLAN_CONTROLLER }}:${{ inputs.tag }}" | tee -a $GITHUB_OUTPUT
echo "runner=${{ env.IMG_RUNNER }}:${{ inputs.tag }}" | tee -a $GITHUB_OUTPUT
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
vm-kernel:
# nb: use format(..) to catch both inputs.skip = true AND inputs.skip = 'true'.
if: ${{ format('{0}', inputs.skip) != 'true' }}
uses: ./.github/workflows/vm-kernel.yaml
with:
tag: ${{ inputs.kernel-image || inputs.tag }}
return-image-for-tag: ${{ inputs.kernel-image }}
secrets: inherit
build:
# nb: use format(..) to catch both inputs.skip = true AND inputs.skip = 'true'.
if: ${{ format('{0}', inputs.skip) != 'true' }}
needs: [ tags, vm-kernel ]
runs-on: [ self-hosted, gen3, large ]
services:
image: registry:2
ports:
- 5000:5000
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all, so that we also include tags
- 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
# Use 'git describe' for embedding git information (duplicated from the Makefile)
- name: get git info
id: get-git-info
run: |
# note: --tags enables matching on lightweight (i.e. not annotated) tags, which normally
# wouldn't be necessary, except that actions/checkout@v4 does weird things to setup the
# repository that means that we actually end up checked out with *just* a lightweight tag
# to the tagged commit.
echo "info=$(git describe --tags --long --dirty)" >> $GITHUB_OUTPUT
- name: get CA base git tag
id: get-ca-tag
if: ${{ format('{0}', inputs.build-cluster-autoscaler) == 'true' }}
run: |
echo "tag=$(cat cluster-autoscaler/ca.tag)" >> $GITHUB_OUTPUT
- name: set custom docker config directory
uses: ./.github/actions/set-docker-config-dir
- uses: docker/setup-buildx-action@v3
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }}
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }}
- name: Login to Docker cache registry
uses: docker/login-action@v3
with:
registry: cache.neon.build
username: ${{ secrets.NEON_CI_DOCKERCACHE_USERNAME }}
password: ${{ secrets.NEON_CI_DOCKERCACHE_PASSWORD }}
- name: Login to dev ECR
if: ${{ format('{0}', inputs.upload-to-ecr) == 'true' }}
uses: docker/login-action@v3
with:
registry: ${{ env.ECR_DEV }}
username: ${{ secrets.DEV_GHA_RUNNER_LIMITED_AWS_ACCESS_KEY_ID }}
password: ${{ secrets.DEV_GHA_RUNNER_LIMITED_AWS_SECRET_ACCESS_KEY }}
- name: Login to prod ECR
if: ${{ format('{0}', inputs.upload-to-ecr) == 'true' }}
uses: docker/login-action@v3
with:
registry: ${{ env.ECR_PROD }}
username: ${{ secrets.PROD_GHA_RUNNER_LIMITED_AWS_ACCESS_KEY_ID }}
password: ${{ secrets.PROD_GHA_RUNNER_LIMITED_AWS_SECRET_ACCESS_KEY }}
- name: Check dependencies
run: |
docker version
docker buildx version
- name: Load VM kernel
env:
IMAGE: ${{ needs.vm-kernel.outputs.image }}
run: |
docker pull --quiet $IMAGE
ID=$(docker create $IMAGE true)
docker cp ${ID}:/vmlinuz neonvm/hack/kernel/vmlinuz
docker rm -f ${ID}
- name: Build go dependencies image
uses: docker/build-push-action@v6
id: build-go-dependencies-image
with:
context: .
platforms: linux/amd64
push: true
load: true
file: Dockerfile.go-base
cache-from: type=registry,ref=cache.neon.build/autoscaling-go-base:cache
cache-to: ${{ github.ref_name == 'main' && 'type=registry,ref=cache.neon.build/autoscaling-go-base:cache,mode=max' || '' }}
tags: localhost:5000/autoscaling-go-base:dev
- name: Debug stuff
run: docker images -a
- name: Build and push neonvm-runner image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
pull: false
file: neonvm/runner/Dockerfile
# cache-from: type=registry,ref=cache.neon.build/neonvm-runner:cache
# cache-to: ${{ github.ref_name == 'main' && 'type=registry,ref=cache.neon.build/neonvm-runner:cache,mode=max' || '' }}
tags: ${{ needs.tags.outputs.runner }}
build-args: |
<<<<<<< Updated upstream

Check failure on line 210 in .github/workflows/build-images.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/build-images.yaml

Invalid workflow file

You have an error in your yaml syntax on line 210
GO_BASE_IMG=neondatabase/autoscaling-go-base:dev@${{ steps.build-go-dependencies-image.outputs.digest }}
=======
GO_BASE_IMG=localhost:5000/autoscaling-go-base:dev
>>>>>>> Stashed changes
- name: Generate neonvm-controller build tags
id: controller-build-tags
env:
PRESERVE_RUNNER_PODS: ${{ inputs.controller-preserve-runner-pods }}
run: |
if [ "$PRESERVE_RUNNER_PODS" = 'true' ]; then
echo "buildtags=nodelete" | tee -a $GITHUB_OUTPUT
else
echo "buildtags=" | tee -a $GITHUB_OUTPUT
fi
- name: Build and push neonvm-controller image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
pull: false
file: neonvm/Dockerfile
# cache-from: type=registry,ref=cache.neon.build/neonvm-controller:cache
# cache-to: ${{ github.ref_name == 'main' && 'type=registry,ref=cache.neon.build/neonvm-controller:cache,mode=max' || '' }}
tags: ${{ needs.tags.outputs.controller }}
build-args: |
GO_BASE_IMG=localhost:5000/autoscaling-go-base:dev
VM_RUNNER_IMAGE=${{ needs.tags.outputs.runner }}
BUILDTAGS=${{ steps.controller-build-tags.outputs.buildtags }}
- name: Build and push neonvm-vxlan-controller image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
pull: false
file: neonvm/tools/vxlan/Dockerfile
# cache-from: type=registry,ref=cache.neon.build/neonvm-vxlan-controller:cache
# cache-to: ${{ github.ref_name == 'main' && 'type=registry,ref=cache.neon.build/neonvm-vxlan-controller:cache,mode=max' || '' }}
tags: ${{ needs.tags.outputs.vxlan-controller }}
build-args: |
GO_BASE_IMG=localhost:5000/autoscaling-go-base:dev
- name: Build and push autoscale-scheduler image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
pull: false
file: build/autoscale-scheduler/Dockerfile
# cache-from: type=registry,ref=cache.neon.build/autoscale-scheduler:cache
# cache-to: ${{ github.ref_name == 'main' && 'type=registry,ref=cache.neon.build/autoscale-scheduler:cache,mode=max' || '' }}
tags: ${{ needs.tags.outputs.scheduler }}
build-args: |
GO_BASE_IMG=localhost:5000/autoscaling-go-base:dev
GIT_INFO=${{ steps.get-git-info.outputs.info }}:${{ inputs.tag }}
- name: Build and push autoscaler-agent image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
pull: false
file: build/autoscaler-agent/Dockerfile
# cache-from: type=registry,ref=cache.neon.build/autoscaler-agent:cache
# cache-to: ${{ github.ref_name == 'main' && 'type=registry,ref=cache.neon.build/autoscaler-agent:cache,mode=max' || '' }}
tags: ${{ needs.tags.outputs.autoscaler-agent }}
build-args: |
GO_BASE_IMG=localhost:5000/autoscaling-go-base:dev
GIT_INFO=${{ steps.get-git-info.outputs.info }}
- name: Build and push cluster-autoscaler image
uses: docker/build-push-action@v6
if: ${{ format('{0}', inputs.build-cluster-autoscaler) == 'true' }}
with:
context: cluster-autoscaler
platforms: linux/amd64
push: true
pull: false
tags: ${{ needs.tags.outputs.cluster-autoscaler }}
cache-from: type=registry,ref=cache.neon.build/cluster-autoscaler-neonvm:cache
cache-to: ${{ github.ref_name == 'main' && 'type=registry,ref=cache.neon.build/cluster-autoscaler-neonvm:cache,mode=max' || '' }}
build-args: |
GO_BASE_IMG=localhost:5000/autoscaling-go-base:dev
CA_GIT_TAG=${{ steps.get-ca-tag.outputs.tag }}
- name: Copy all images to ECR
if: ${{ format('{0}', inputs.upload-to-ecr) == 'true' }}
run: |
for image in \
neonvm-controller \
neonvm-vxlan-controller \
neonvm-runner \
vm-kernel \
autoscale-scheduler \
autoscaler-agent \
cluster-autoscaler-neonvm \
; do
echo Copy ${image}:${{ inputs.tag }} to dev ECR
docker buildx imagetools create -t ${{ env.ECR_DEV }}/${image}:${{ inputs.tag }} \
neondatabase/${image}:${{ inputs.tag }}
echo Copy ${image}:${{ inputs.tag }} to prod ECR
docker buildx imagetools create -t ${{ env.ECR_PROD }}/${image}:${{ inputs.tag }} \
neondatabase/${image}:${{ inputs.tag }}
done