Skip to content

Commit

Permalink
try full build flow
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-sakhnov committed Oct 30, 2024
1 parent 16b9373 commit 180e977
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 80 deletions.
135 changes: 58 additions & 77 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,39 +80,23 @@ defaults:
shell: bash -euo pipefail {0}

jobs:
# tags:
# strategy:
# matrix:
# arch: [ 'amd64', 'arm64' ]
# 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:

# TODO: uncomment when the final PR version is ready
# 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 }}
# arch: ${{ matrix.arch }}
# strategy:
# matrix:
# arch: [ 'amd64', 'arm64' ]
# secrets: inherit
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 }}
arch: ${{ matrix.arch }}
strategy:
matrix:
arch: [ 'amd64', 'arm64' ]
secrets: inherit

build:
# nb: use format(..) to catch both inputs.skip = true AND inputs.skip = 'true'.
if: ${{ format('{0}', inputs.skip) != 'true' }}
# TODO: uncomment when the final PR version is ready
# needs: [ vm-kernel ]
needs: [ vm-kernel ]
outputs:
controller-amd64: ${{ steps.tags.outputs.controller-amd64 }}
vxlan-controller-amd64: ${{ steps.tags.outputs.vxlan-controller-amd64 }}
Expand Down Expand Up @@ -207,34 +191,33 @@ jobs:
registry: cache.neon.build
username: ${{ secrets.NEON_CI_DOCKERCACHE_USERNAME }}
password: ${{ secrets.NEON_CI_DOCKERCACHE_PASSWORD }}
# TODO: uncomment when the final PR version is ready
# - 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: 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: 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: 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: 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: |
Expand All @@ -243,9 +226,8 @@ jobs:
- name: Load VM kernel
env:
# IMAGE: ${{format(needs.vm-kernel.outputs.image_placeholder, matrix.arch)}}
# TODO: temporary always use image from one of the previous runs to speedup the build during debug
IMAGE: ${{format('neondatabase/vm-kernel-{0}:3372e65.11573472293', matrix.arch)}}
IMAGE: ${{format(needs.vm-kernel.outputs.image_placeholder, matrix.arch)}}
# IMAGE: ${{format('neondatabase/vm-kernel-{0}:3372e65.11573472293', matrix.arch)}}
run: |
docker pull --quiet $IMAGE
ID=$(docker create $IMAGE true)
Expand Down Expand Up @@ -359,23 +341,22 @@ jobs:
build-args: |
CA_GIT_TAG=${{ steps.get-ca-tag.outputs.tag }}
# TODO: Uncomment when the final PR version is ready
# - 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
- 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
2 changes: 1 addition & 1 deletion .github/workflows/build-test-vm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
daemon: ${{ steps.tags.outputs.daemon }}
strategy:
matrix:
arch: [ 'arm64' ]
arch: [ amd64, arm64 ]
# TODO: do we need gen3 runners? to clarify with dev exp team
runs-on: ${{ fromJson(format('["self-hosted", "{0}"]', matrix.arch == 'arm64' && 'large-arm64' || 'large')) }}
steps:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ jobs:
fail-fast: false
matrix:
cluster: [ k3d ]
arch: [ arm64 ]
# run tests on amd64 only, since scope of the PR is to build images, there is separate issue for e2e tests
arch: [ amd64 ]

runs-on: ${{ fromJson(format('["self-hosted", "{0}"]', matrix.arch == 'arm64' && 'large-arm64' || 'large')) }}

Expand Down Expand Up @@ -119,7 +120,7 @@ jobs:

- 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: ${{ format('rendered_manifests-{0}', matrix.arch) }}
Expand Down

0 comments on commit 180e977

Please sign in to comment.