Merge pull request #132 from Gabisonfire/hotfix/matrix

remove matrix from base
This commit is contained in:
iPromKnight
2024-03-09 16:12:24 +00:00
committed by GitHub

View File

@@ -10,10 +10,10 @@ on:
required: true required: true
type: string type: string
# matrix cannot read from workflow_call inputs, so load them into the global env scope
env: env:
CONTEXT: ${{ github.event.inputs.CONTEXT }} CONTEXT: ${{ github.event.inputs.CONTEXT }}
IMAGE_NAME: ${{ github.event.inputs.IMAGE_NAME }} IMAGE_NAME: ${{ github.event.inputs.IMAGE_NAME }}
PLATFORMS: linux/amd64,linux/arm64
jobs: jobs:
build-and-push-images: build-and-push-images:
@@ -26,14 +26,8 @@ jobs:
image: registry:2 image: registry:2
ports: ports:
- 5000:5000 - 5000:5000
strategy:
matrix:
include:
- context: ${{ env.CONTEXT }}
image_name: ${{ env.IMAGE_NAME }}
platforms: linux/amd64,linux/arm64
name: Build - ${{ matrix.image_name }} name: Build - ${{ env.IMAGE_NAME }}
steps: steps:
- name: Checkout repository - name: Checkout repository
@@ -58,7 +52,7 @@ jobs:
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
images: | images: |
${{ vars.DOCKERHUB_USERNAME }}/${{ matrix.image_name }} ${{ vars.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}
flavor: | flavor: |
latest=auto latest=auto
tags: | tags: |
@@ -66,14 +60,14 @@ jobs:
type=sha,commit=${{ github.sha }} type=sha,commit=${{ github.sha }}
type=raw,value=latest,enable={{is_default_branch}} type=raw,value=latest,enable={{is_default_branch}}
- name: Build image for scanning ${{ matrix.image_name }} - name: Build image for scanning ${{ env.IMAGE_NAME }}
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: ${{ matrix.context }} context: ${{ env.CONTEXT }}
push: true push: true
provenance: false provenance: false
tags: localhost:5000/dockle-examine-image:test tags: localhost:5000/dockle-examine-image:test
platforms: ${{ matrix.platforms }} platforms: ${{ env.PLATFORMS }}
cache-from: type=gha,scope=${{ github.workflow }} cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }} cache-to: type=gha,mode=max,scope=${{ github.workflow }}
@@ -121,15 +115,15 @@ jobs:
with: with:
sarif_file: 'trivy-results-os.sarif' sarif_file: 'trivy-results-os.sarif'
- name: Push ${{ matrix.image_name }} to repo - name: Push ${{ env.IMAGE_NAME }} to repo
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: ${{ matrix.context }} context: ${{ env.CONTEXT }}
push: true push: true
provenance: false provenance: false
tags: ${{ steps.docker-metadata.outputs.tags }} tags: ${{ steps.docker-metadata.outputs.tags }}
labels: ${{ steps.docker-metadata.outputs.labels }} labels: ${{ steps.docker-metadata.outputs.labels }}
platforms: ${{ matrix.platforms }} platforms: ${{ env.PLATFORMS }}
cache-from: type=gha,scope=${{ github.workflow }} cache-from: type=gha,scope=${{ github.workflow }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }} cache-to: type=gha,mode=max,scope=${{ github.workflow }}