mirror of
https://gh-proxy.com/https://github.com/docker/build-push-action
synced 2026-06-23 08:57:46 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d26e5cbfa7 | |||
| 9e8d01178c | |||
| f0ca506b75 |
@@ -22,10 +22,6 @@ on:
|
|||||||
slug:
|
slug:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
aws-role-to-assume:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
description: "IAM role ARN to assume via OIDC for ECR authentication. When set, configure-aws-credentials runs before registry login."
|
|
||||||
secrets:
|
secrets:
|
||||||
registry_username:
|
registry_username:
|
||||||
required: false
|
required: false
|
||||||
@@ -40,9 +36,6 @@ env:
|
|||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
id-token: write
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -118,18 +111,10 @@ jobs:
|
|||||||
driver-opts: |
|
driver-opts: |
|
||||||
image=${{ matrix.buildkit_image }}
|
image=${{ matrix.buildkit_image }}
|
||||||
network=host
|
network=host
|
||||||
-
|
|
||||||
name: Configure AWS credentials
|
|
||||||
if: inputs.aws-role-to-assume != '' && (contains(inputs.registry, '.ecr.') || inputs.registry == 'public.ecr.aws')
|
|
||||||
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
|
|
||||||
with:
|
|
||||||
role-to-assume: ${{ inputs.aws-role-to-assume }}
|
|
||||||
aws-region: us-east-1
|
|
||||||
role-session-name: gha-build-push-action-e2e-${{ github.run_id }}-${{ github.run_attempt }}
|
|
||||||
-
|
-
|
||||||
name: Login to Registry
|
name: Login to Registry
|
||||||
if: github.event_name != 'pull_request' && (inputs.type == 'remote' || env.REGISTRY_USER != '')
|
if: github.event_name != 'pull_request' && (inputs.type == 'remote' || env.REGISTRY_USER != '')
|
||||||
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY_FQDN || inputs.registry }}
|
registry: ${{ env.REGISTRY_FQDN || inputs.registry }}
|
||||||
username: ${{ env.REGISTRY_USER || secrets.registry_username }}
|
username: ${{ env.REGISTRY_USER || secrets.registry_username }}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ name: e2e
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
@@ -100,15 +99,14 @@ jobs:
|
|||||||
name: ${{ matrix.name }}
|
name: ${{ matrix.name }}
|
||||||
registry: ${{ matrix.registry }}
|
registry: ${{ matrix.registry }}
|
||||||
slug: ${{ matrix.slug }}
|
slug: ${{ matrix.slug }}
|
||||||
aws-role-to-assume: arn:aws:iam::175142243308:role/official_gha_cicd
|
|
||||||
secrets:
|
secrets:
|
||||||
# Pass only the two secrets needed by each matrix entry.
|
# Pass only the two secrets needed by each matrix entry.
|
||||||
# AWS ECR entries use OIDC via aws-role-to-assume instead of static keys.
|
|
||||||
registry_username: >-
|
registry_username: >-
|
||||||
${{
|
${{
|
||||||
matrix.auth == 'dockerhub' && secrets.DOCKERHUB_USERNAME ||
|
matrix.auth == 'dockerhub' && secrets.DOCKERHUB_USERNAME ||
|
||||||
matrix.auth == 'ghcr' && secrets.GHCR_USERNAME ||
|
matrix.auth == 'ghcr' && secrets.GHCR_USERNAME ||
|
||||||
matrix.auth == 'gitlab' && secrets.GITLAB_USERNAME ||
|
matrix.auth == 'gitlab' && secrets.GITLAB_USERNAME ||
|
||||||
|
matrix.auth == 'aws' && secrets.AWS_ACCESS_KEY_ID ||
|
||||||
matrix.auth == 'gar' && secrets.GAR_USERNAME ||
|
matrix.auth == 'gar' && secrets.GAR_USERNAME ||
|
||||||
matrix.auth == 'acr' && secrets.AZURE_CLIENT_ID ||
|
matrix.auth == 'acr' && secrets.AZURE_CLIENT_ID ||
|
||||||
matrix.auth == 'quay' && secrets.QUAY_USERNAME ||
|
matrix.auth == 'quay' && secrets.QUAY_USERNAME ||
|
||||||
@@ -120,6 +118,7 @@ jobs:
|
|||||||
matrix.auth == 'dockerhub' && secrets.DOCKERHUB_TOKEN ||
|
matrix.auth == 'dockerhub' && secrets.DOCKERHUB_TOKEN ||
|
||||||
matrix.auth == 'ghcr' && secrets.GHCR_PAT ||
|
matrix.auth == 'ghcr' && secrets.GHCR_PAT ||
|
||||||
matrix.auth == 'gitlab' && secrets.GITLAB_TOKEN ||
|
matrix.auth == 'gitlab' && secrets.GITLAB_TOKEN ||
|
||||||
|
matrix.auth == 'aws' && secrets.AWS_SECRET_ACCESS_KEY ||
|
||||||
matrix.auth == 'gar' && secrets.GAR_JSON_KEY ||
|
matrix.auth == 'gar' && secrets.GAR_JSON_KEY ||
|
||||||
matrix.auth == 'acr' && secrets.AZURE_CLIENT_SECRET ||
|
matrix.auth == 'acr' && secrets.AZURE_CLIENT_SECRET ||
|
||||||
matrix.auth == 'quay' && secrets.QUAY_TOKEN ||
|
matrix.auth == 'quay' && secrets.QUAY_TOKEN ||
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ jobs:
|
|||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@a66e1c87e2eca0503c343edf1d208c716d54b8a8 # v7.1.0
|
uses: docker/bake-action@6614cfa25eff9a0b2b2697efb0b6159e7680d584 # v7.2.0
|
||||||
with:
|
with:
|
||||||
source: .
|
source: .
|
||||||
targets: test
|
targets: test
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
token: ${{ steps.docker-read-app.outputs.token }}
|
token: ${{ steps.docker-read-app.outputs.token }}
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: docker/bake-action@a66e1c87e2eca0503c343edf1d208c716d54b8a8 # v7.1.0
|
uses: docker/bake-action@6614cfa25eff9a0b2b2697efb0b6159e7680d584 # v7.2.0
|
||||||
with:
|
with:
|
||||||
source: .
|
source: .
|
||||||
targets: build
|
targets: build
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Generate matrix
|
name: Generate matrix
|
||||||
id: generate
|
id: generate
|
||||||
uses: docker/bake-action/subaction/matrix@a66e1c87e2eca0503c343edf1d208c716d54b8a8 # v7.1.0
|
uses: docker/bake-action/subaction/matrix@6614cfa25eff9a0b2b2697efb0b6159e7680d584 # v7.2.0
|
||||||
with:
|
with:
|
||||||
target: validate
|
target: validate
|
||||||
|
|
||||||
@@ -41,6 +41,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
uses: docker/bake-action@a66e1c87e2eca0503c343edf1d208c716d54b8a8 # v7.1.0
|
uses: docker/bake-action@6614cfa25eff9a0b2b2697efb0b6159e7680d584 # v7.2.0
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
|
|||||||
Reference in New Issue
Block a user