Skip to content

Commit

Permalink
chore: get correct tag for image scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
deowk committed Apr 25, 2024
1 parent bb47acf commit 7532b2b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ jobs:
uses: ./.github/workflows/node-build.yml
with:
REGISTRY: ${{ vars.REGISTRY }}
REPOSITORY: ${{ vars.REPOSITORY }}
NODE_TYPE: ${{ matrix.node }}

merge:
needs: [matrix, build]
outputs:
json: ${{ steps.matrix.outputs.json }}
json: ${{ steps.meta.outputs.json }}
strategy:
matrix:
node: ${{ fromJson(needs.matrix.outputs.node_types) }}
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/node-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
REGISTRY:
required: true
type: string
REPOSITORY:
required: true
type: string
NODE_TYPE:
required: false
type: string
Expand All @@ -17,7 +14,7 @@ env:

jobs:
build:
name: Build local context and push image
name: Build local context
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/node-manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on:
workflow_call:
inputs:
REGISTRY:
required: true
type: string
NODE_TYPE:
required: false
type: string
default: "mempool"

env:
REGISTRY_IMAGE: ${{ inputs.REGISTRY }}/aiblockofficial/node-${{ inputs.NODE_TYPE }}

jobs:
create-and-push-manifest:
outputs:
json: ${{ steps.matrix.outputs.json }}
runs-on: ubuntu-latest
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-${{inputs.NODE_TYPE}}-*
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: ${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=latest
type=sha
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ vars.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- 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 '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

0 comments on commit 7532b2b

Please sign in to comment.