Skip to content

Commit

Permalink
WIP: experimenting with dynamic outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-sakhnov committed Oct 29, 2024
1 parent 6a066ed commit 3a22a6e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 33 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,18 @@ jobs:
# TODO: uncomment when the final PR version is ready
# needs: [ vm-kernel ]
outputs:
controller: ${{ steps.tags.outputs.controller }}
vxlan-controller: ${{ steps.tags.outputs.vxlan-controller }}
runner: ${{ steps.tags.outputs.runner }}
scheduler: ${{ steps.tags.outputs.scheduler }}
autoscaler-agent: ${{ steps.tags.outputs.autoscaler-agent }}
cluster-autoscaler: ${{ steps.tags.outputs.cluster-autoscaler }}
controller-amd64: ${{ steps.tags.outputs.controller-amd64 }}
vxlan-controller-amd64: ${{ steps.tags.outputs.vxlan-controller-amd64 }}
runner-amd64: ${{ steps.tags.outputs.runner-amd64 }}
scheduler-amd64: ${{ steps.tags.outputs.scheduler-amd64 }}
autoscaler-agent-amd64: ${{ steps.tags.outputs.autoscaler-agent-amd64 }}
cluster-autoscaler-amd64: ${{ steps.tags.outputs.cluster-autoscaler-amd64 }}
controller-arm64: ${{ steps.tags.outputs.controller-arm64 }}
vxlan-controller-arm64: ${{ steps.tags.outputs.vxlan-controller-arm64 }}
runner-arm64: ${{ steps.tags.outputs.runner-arm64 }}
scheduler-arm64: ${{ steps.tags.outputs.scheduler-arm64 }}
autoscaler-agent-arm64: ${{ steps.tags.outputs.autoscaler-agent-arm64 }}
cluster-autoscaler-arm64: ${{ steps.tags.outputs.cluster-autoscaler-arm64 }}
env:
# Why localhost? We use a local registry so that when docker/build-push-action tries to pull the
# image we built locally, it'll actually have a place to pull from.
Expand Down Expand Up @@ -291,7 +297,7 @@ jobs:
file: neonvm-controller/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: ${{ steps.tags.outputs.controller }}
tags: ${{ steps.tags.outputs[format('controller-{0}', matrix.arch)] }}
build-args: |
GO_BASE_IMG=${{ env.GO_BASE_IMG }}
VM_RUNNER_IMAGE=${{ steps.tags.outputs.runner }}
Expand All @@ -306,7 +312,7 @@ jobs:
file: neonvm-vxlan-controller/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: ${{ steps.tags.outputs.vxlan-controller }}
tags: ${{ steps.tags.outputs[format('vxlan-controller-{0}', matrix.arch)] }}
build-args: |
GO_BASE_IMG=${{ env.GO_BASE_IMG }}
TARGET_ARCH=${{ matrix.arch }}
Expand All @@ -320,7 +326,7 @@ jobs:
file: 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: ${{ steps.tags.outputs.scheduler }}
tags: ${{ steps.tags.outputs[format('scheduler-{0}', matrix.arch)]}}
build-args: |
GO_BASE_IMG=${{ env.GO_BASE_IMG }}
GIT_INFO=${{ steps.get-git-info.outputs.info }}:${{ inputs.tag }}
Expand All @@ -334,7 +340,7 @@ jobs:
file: 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: ${{ steps.tags.outputs.autoscaler-agent }}
tags: ${{ steps.tags.outputs[format('autoscaler-agent-{0}', matrix.arch)]}}
build-args: |
GO_BASE_IMG=${{ env.GO_BASE_IMG }}
GIT_INFO=${{ steps.get-git-info.outputs.info }}
Expand All @@ -347,7 +353,7 @@ jobs:
platforms: linux/${{ matrix.arch }}
push: true
target: ${{format('cluster_autoscaler_{0}', matrix.arch)}}
tags: ${{ steps.tags.outputs.cluster-autoscaler }}
tags: ${{ steps.tags.outputs[format('cluster-autoscaler-{0}', matrix.arch)]}}
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: |
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/build-test-vm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ on:
required: false
default: false
outputs:
vm-postgres-16-bullseye:
vm-postgres-16-bullseye-amd64:
description: 'image name for postgres:16-bullseye, VM-ified'
value: ${{ jobs.build.outputs.vm-postgres-16-bullseye }}

value: ${{ jobs.build.outputs.vm-postgres-16-bullseye-amd64 }}
vm-postgres-16-bullseye-arm64:
description: 'image name for postgres:16-bullseye, VM-ified'
value: ${{ jobs.build.outputs.vm-postgres-16-bullseye-arm64 }}

env:
IMG_POSTGRES_16_BULLSEYE: "neondatabase/vm-postgres-16-bullseye"
# using image built in the same workflow
Expand All @@ -42,7 +45,8 @@ jobs:
# nb: use format(..) to catch both inputs.skip = true AND inputs.skip = 'true'.
if: ${{ format('{0}', inputs.skip) != 'true' }}
outputs:
vm-postgres-16-bullseye: ${{ steps.tags.outputs.vm-postgres-16-bullseye }}
vm-postgres-16-bullseye-arm64: ${{ steps.tags.outputs.vm-postgres-16-bullseye-arm64 }}
vm-postgres-16-bullseye-amd64: ${{ steps.tags.outputs.vm-postgres-16-bullseye-amd64 }}
daemon: ${{ steps.tags.outputs.daemon }}
strategy:
matrix:
Expand All @@ -55,7 +59,7 @@ jobs:
# tags converted to be a step and moved here to be in the same strategy contextt
- id: tags
run: |
echo "vm-postgres-16-bullseye=${{ env.IMG_POSTGRES_16_BULLSEYE }}-${{matrix.arch}}:${{ inputs.tag }}" | tee -a $GITHUB_OUTPUT
echo "vm-postgres-16-bullseye-${{matrix.arch}}=${{ env.IMG_POSTGRES_16_BULLSEYE }}-${{matrix.arch}}:${{ inputs.tag }}" | tee -a $GITHUB_OUTPUT
echo "daemon=${{ env.IMG_DAEMON }}-${{matrix.arch}}:dev" | tee -a $GITHUB_OUTPUT
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down
33 changes: 16 additions & 17 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,17 @@ jobs:
- run: make render-release
env:
IMG_CONTROLLER: ${{ needs.build-images.outputs[format('controller-{0}', matrix.arch)] }}
# #IMG_CONTROLLER: ${{ needs.build-images.outputs.controller }}
# IMG_VXLAN_CONTROLLER: ${{ needs.build-images.outputs.vxlan-controller }}
# IMG_RUNNER: ${{ needs.build-images.outputs.runner }}
# IMG_SCHEDULER: ${{ needs.build-images.outputs.scheduler }}
# IMG_AUTOSCALER_AGENT: ${{ needs.build-images.outputs.autoscaler-agent }}
IMG_VXLAN_CONTROLLER: ${{ needs.build-images.outputs[format('vxlan-controller-{0}', matrix.arch)] }}
IMG_RUNNER: ${{ needs.build-images.outputs[format('runner-{0}', matrix.arch)] }}
IMG_SCHEDULER: ${{ needs.build-images.outputs[format('scheduler-{0}', matrix.arch)] }}
IMG_AUTOSCALER_AGENT: ${{ needs.build-images.outputs[format('autoscaler-agent-{0}', matrix.arch)] }}

- name: upload manifests
# nb: use format(..) to catch both inputs.push-yamls = true AND inputs.push-yamls = 'true'.
# if: ${{ format('{0}', inputs.push-yamls) == 'true' }}
# if: ${{ format('{0}', inputs.push-yamls) == 'true'}}
uses: actions/upload-artifact@v4
with:
name: rendered_manifests
name: ${{ format('rendered_manifests-{0}', matrix.arch) }}
# nb: prefix before wildcard is removed from the uploaded files, so the artifact should
# contain e.g.
# - autoscale-scheduler.yaml
Expand Down Expand Up @@ -188,16 +187,16 @@ jobs:
# kubectl apply -f $(rendered autoscaler-agent.yaml)
# kubectl -n kube-system rollout status daemonset autoscaler-agent

# - name: load e2e test vm image
# env:
# TEST_IMAGE: ${{ needs.build-test-vm.outputs.vm-postgres-16-bullseye }}
# timeout-minutes: 2
# run: |
# # Pull the docker image so we can re-tag it, because using a consistent tag inside the
# # cluster means we can avoid dynamically editing the image used in the kuttl files.
# docker pull "$TEST_IMAGE"
# docker image tag "$TEST_IMAGE" "$IMG_E2E_TEST"
# make load-example-vms
# - name: load e2e test vm image
# env:
# TEST_IMAGE: ${{ needs.build-test-vm.outputs[format('vm-postgres-16-bullseye-{0}', matrix.arch)] }}
# timeout-minutes: 2
# run: |
# # Pull the docker image so we can re-tag it, because using a consistent tag inside the
# # cluster means we can avoid dynamically editing the image used in the kuttl files.
# docker pull "$TEST_IMAGE"
# docker image tag "$TEST_IMAGE" "$IMG_E2E_TEST"
# make load-example-vms

# - run: make e2e
# timeout-minutes: 15
Expand Down

0 comments on commit 3a22a6e

Please sign in to comment.