Skip to content

Commit

Permalink
troubleshooting
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Webber <[email protected]>
  • Loading branch information
sebastianwebber committed Oct 31, 2024
1 parent e832e69 commit 859f9a6
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
with:
submodules: true
token: ${{ secrets.API_TOKEN_GITHUB }}

- name: Docker | Build and Push
uses: timescale/cloud-actions/build-push@main
with:
Expand All @@ -67,6 +68,7 @@ jobs:
registry: ${{ inputs.registry }}
target: ${{ inputs.docker_target }}
file: ${{ inputs.dockerfile_path }}

mp-build:
name: Build multiplatform Image (${{ matrix.platform }})
if: ${{ inputs.multiplatform }}
Expand All @@ -83,55 +85,61 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Prepare
run: |
platform_slash_pair=linux/${{ matrix.platform }}
echo "PLATFORM_DASH_PAIR=${platform_slash_pair//\//-}" >> $GITHUB_ENV

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ inputs.registry }}
tags: |
type=raw,value=${{ inputs.tags }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ inputs.region }}

- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2

- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/${{ matrix.platform }}
target: ${{ inputs.docker_target }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ inputs.registry }},push-by-digest=true,name-canonical=true,push=true
build-args: |
GOOS=linux
GOARCH=${{ matrix.platform }}
BPF_TARGET=${{ matrix.platform }}
- name: Export digest
run: |
mkdir -p /tmp/digests
rm -rf /tmp/digests/*
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
export "IMAGE_DIGEST=${digest#sha256:}"
echo "IMAGE_DIGEST=${IMAGE_DIGEST}" >> $GITHUB_ENV
touch "/tmp/digests/${IMAGE_DIGEST}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_DASH_PAIR }}-${{ inputs.docker_target }}-${{ inputs.tags }}
name: digests-${{ inputs.docker_target }}-${{ env.IMAGE_DIGEST }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
overwrite: true
merge:
runs-on: ${{ inputs.runner }}
needs:
Expand All @@ -141,34 +149,41 @@ jobs:
run: |
mkdir -p /tmp/digests
rm -rf /tmp/digests/*
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
pattern: digests-${{ inputs.docker_target }}-*
merge-multiple: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ inputs.registry }}
tags: |
type=raw,value=${{ inputs.tags }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ inputs.region }}

- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2

- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ inputs.registry }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ inputs.registry }}:${{ inputs.tags }}

0 comments on commit 859f9a6

Please sign in to comment.