mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 21:42:56 +00:00
## Problem
GitHub Actions complain that we use actions that depend on deprecated
Node 16:
```
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: docker/setup-buildx-action@v2
```
But also, the latest `docker/setup-buildx-action` fails with the following
error:
```
/nvme/actions-runner/_work/_actions/docker/setup-buildx-action/v3/webpack:/docker-setup-buildx/node_modules/@actions/cache/lib/cache.js:175
throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);
^
Error: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.
at Object.rejected (/nvme/actions-runner/_work/_actions/docker/setup-buildx-action/v3/webpack:/docker-setup-buildx/node_modules/@actions/cache/lib/cache.js:175:1)
at Generator.next (<anonymous>)
at fulfilled (/nvme/actions-runner/_work/_actions/docker/setup-buildx-action/v3/webpack:/docker-setup-buildx/node_modules/@actions/cache/lib/cache.js:29:1)
```
We can work this around by setting `cache-binary: false` for `uses:
docker/setup-buildx-action@v3`
## Summary of changes
- Update `docker/setup-buildx-action` from `v2` to `v3`, set
`cache-binary: false`
- Update `docker/login-action` from `v2` to `v3`
- Update `docker/build-push-action` from `v4`/`v5` to `v6`
109 lines
3.3 KiB
YAML
109 lines
3.3 KiB
YAML
name: Build build-tools image
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
image-tag:
|
|
description: "build-tools image tag"
|
|
required: true
|
|
type: string
|
|
outputs:
|
|
image-tag:
|
|
description: "build-tools tag"
|
|
value: ${{ inputs.image-tag }}
|
|
image:
|
|
description: "build-tools image"
|
|
value: neondatabase/build-tools:${{ inputs.image-tag }}
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash -euo pipefail {0}
|
|
|
|
concurrency:
|
|
group: build-build-tools-image-${{ inputs.image-tag }}
|
|
cancel-in-progress: false
|
|
|
|
# No permission for GITHUB_TOKEN by default; the **minimal required** set of permissions should be granted in each job.
|
|
permissions: {}
|
|
|
|
jobs:
|
|
check-image:
|
|
uses: ./.github/workflows/check-build-tools-image.yml
|
|
|
|
build-image:
|
|
needs: [ check-image ]
|
|
if: needs.check-image.outputs.found == 'false'
|
|
|
|
strategy:
|
|
matrix:
|
|
arch: [ x64, arm64 ]
|
|
|
|
runs-on: ${{ fromJson(format('["self-hosted", "gen3", "{0}"]', matrix.arch == 'arm64' && 'large-arm64' || 'large')) }}
|
|
|
|
env:
|
|
IMAGE_TAG: ${{ inputs.image-tag }}
|
|
|
|
steps:
|
|
- name: Check `input.tag` is correct
|
|
env:
|
|
INPUTS_IMAGE_TAG: ${{ inputs.image-tag }}
|
|
CHECK_IMAGE_TAG : ${{ needs.check-image.outputs.image-tag }}
|
|
run: |
|
|
if [ "${INPUTS_IMAGE_TAG}" != "${CHECK_IMAGE_TAG}" ]; then
|
|
echo "'inputs.image-tag' (${INPUTS_IMAGE_TAG}) does not match the tag of the latest build-tools image 'inputs.image-tag' (${CHECK_IMAGE_TAG})"
|
|
exit 1
|
|
fi
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
# Use custom DOCKER_CONFIG directory to avoid conflicts with default settings
|
|
# The default value is ~/.docker
|
|
- name: Set custom docker config directory
|
|
run: |
|
|
mkdir -p /tmp/.docker-custom
|
|
echo DOCKER_CONFIG=/tmp/.docker-custom >> $GITHUB_ENV
|
|
|
|
- uses: docker/setup-buildx-action@v3
|
|
with:
|
|
cache-binary: false
|
|
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }}
|
|
|
|
- uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
provenance: false
|
|
push: true
|
|
pull: true
|
|
file: Dockerfile.build-tools
|
|
cache-from: type=registry,ref=neondatabase/build-tools:cache-${{ matrix.arch }}
|
|
cache-to: ${{ github.ref_name == 'main' && format('type=registry,ref=neondatabase/build-tools:cache-{0},mode=max', matrix.arch) || '' }}
|
|
tags: neondatabase/build-tools:${{ inputs.image-tag }}-${{ matrix.arch }}
|
|
|
|
- name: Remove custom docker config directory
|
|
if: always()
|
|
run: |
|
|
rm -rf /tmp/.docker-custom
|
|
|
|
merge-images:
|
|
needs: [ build-image ]
|
|
runs-on: ubuntu-22.04
|
|
|
|
env:
|
|
IMAGE_TAG: ${{ inputs.image-tag }}
|
|
|
|
steps:
|
|
- uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.NEON_DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.NEON_DOCKERHUB_PASSWORD }}
|
|
|
|
- name: Create multi-arch image
|
|
run: |
|
|
docker buildx imagetools create -t neondatabase/build-tools:${IMAGE_TAG} \
|
|
neondatabase/build-tools:${IMAGE_TAG}-x64 \
|
|
neondatabase/build-tools:${IMAGE_TAG}-arm64
|