Skip to content

Commit

Permalink
wip,ci: drop matrix results in build-images
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-sakhnov committed Feb 6, 2025
1 parent 181c3eb commit c654f6c
Showing 1 changed file with 2 additions and 242 deletions.
244 changes: 2 additions & 242 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ on:
type: string
required: false
default: 'amd64'
matrix-step-name:
required: false
type: string
matrix-key:
required: false
type: string

outputs:

Expand Down Expand Up @@ -164,239 +158,5 @@ jobs:
# 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: set custom docker config directory
uses: neondatabase/dev-actions/set-docker-config-dir@6094485bf440001c94a94a3f9e221e81ff6b6193

- uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host


- 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: Configure dev AWS credentials
if: ${{ format('{0}', inputs.upload-to-ecr) == 'true' }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-central-1
mask-aws-account-id: true
role-to-assume: ${{ secrets.DEV_GHA_OIDC_ECR_ROLE }}

- name: Login to dev ECR
if: ${{ format('{0}', inputs.upload-to-ecr) == 'true' }}
uses: docker/login-action@v3
with:
registry: ${{ env.ECR_DEV }}

- name: Configure prod AWS credentials
if: ${{ format('{0}', inputs.upload-to-ecr) == 'true' }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-central-1
mask-aws-account-id: true
role-to-assume: ${{ secrets.PROD_GHA_OIDC_ECR_ROLE }}

- name: Login to prod ECR
if: ${{ format('{0}', inputs.upload-to-ecr) == 'true' }}
uses: docker/login-action@v3
with:
registry: ${{ env.ECR_PROD }}

- 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-kernel/vmlinuz
docker rm -f ${ID}
- name: Build go dependencies image
uses: docker/build-push-action@v6
id: build-go-dependencies-image
with:
context: .

push: 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: ${{ env.GO_BASE_IMG }}

- name: Build and push neonvm-runner image
uses: docker/build-push-action@v6
with:
context: .
push: true

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: ${{ steps.tags.outputs.runner }}
build-args: |
GO_BASE_IMG=${{ env.GO_BASE_IMG }}
- 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: .

push: true
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 }}
build-args: |
GO_BASE_IMG=${{ env.GO_BASE_IMG }}
VM_RUNNER_IMAGE=${{ steps.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: .

push: true
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 }}
build-args: |
GO_BASE_IMG=${{ env.GO_BASE_IMG }}
TARGET_ARCH=${{ inputs.arch }}
- name: Build and push autoscale-scheduler image
uses: docker/build-push-action@v6
with:
context: .

push: true
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 }}
build-args: |
GO_BASE_IMG=${{ env.GO_BASE_IMG }}
ARCH=${{ inputs.arch }}
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: .

push: true
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 }}
build-args: |
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: .

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: ${{ steps.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' }}
with:
context: cluster-autoscaler

push: true
target: ${{ format('cluster_autoscaler_{0}', inputs.arch) }}
tags: ${{ steps.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' || '' }}

- 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
save-matrix-results:
runs-on: ubuntu-latest
needs: [build]
steps:
## Write for matrix outputs workaround
- uses: cloudposse/github-action-matrix-outputs-write@v1
id: out
with:
matrix-step-name: ${{ inputs.matrix-step-name }}
matrix-key: ${{ inputs.matrix-key }}
outputs: |-
controller: ${{ needs.build.outputs.controller }}
vxlan-controller: ${{ needs.build.outputs.vxlan-controller }}
runner: ${{ needs.build.outputs.runner }}
scheduler: ${{ needs.build.outputs.scheduler }}
autoscaler-agent: ${{ needs.build.outputs.autoscaler-agent }}
cluster-autoscaler: ${{ needs.build.outputs.cluster-autoscaler }}
outputs:
controller: ${{ steps.out.outputs.controller }}
vxlan-controller: ${{ steps.out.outputs.vxlan-controller }}
runner: ${{ steps.out.outputs.runner }}
scheduler: ${{ steps.out.outputs.scheduler }}
autoscaler-agent: ${{ steps.out.outputs.autoscaler-agent }}
cluster-autoscaler: ${{ steps.out.outputs.cluster-autoscaler }}
- run: |
echo "inputs.tag: ${{ inputs.tag }}, arch: ${{ inputs.arch }}"

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

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/build-images.yaml#L162

could not parse as YAML: yaml: line 162: mapping values are not allowed in this context [syntax-check]
Raw output
.github/workflows/build-images.yaml:162:0: could not parse as YAML: yaml: line 162: mapping values are not allowed in this context [syntax-check]

0 comments on commit c654f6c

Please sign in to comment.