2020-11-19 04:40:39 -05:00
|
|
|
name: e2e
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2022-08-12 10:45:35 -04:00
|
|
|
inputs:
|
|
|
|
buildx-version:
|
|
|
|
description: 'Buildx version or Git context'
|
|
|
|
default: 'latest'
|
|
|
|
required: false
|
|
|
|
buildkit-image:
|
|
|
|
description: 'BuildKit image'
|
|
|
|
default: 'moby/buildkit:buildx-stable-1'
|
|
|
|
required: false
|
2023-02-09 06:53:34 -05:00
|
|
|
tag:
|
|
|
|
description: 'Additional tag to push'
|
|
|
|
required: false
|
2020-11-19 04:40:39 -05:00
|
|
|
schedule:
|
2021-11-16 01:19:27 -05:00
|
|
|
- cron: '0 10 * * *'
|
2020-11-19 04:40:39 -05:00
|
|
|
push:
|
|
|
|
branches:
|
2022-01-18 08:57:27 -05:00
|
|
|
- 'master'
|
2020-11-19 04:40:39 -05:00
|
|
|
tags:
|
2023-02-09 06:53:34 -05:00
|
|
|
- 'v*'
|
2020-11-19 04:40:39 -05:00
|
|
|
|
2022-08-16 20:17:37 -04:00
|
|
|
env:
|
|
|
|
BUILDX_VERSION: latest
|
|
|
|
BUILDKIT_IMAGE: moby/buildkit:buildx-stable-1
|
2023-02-09 22:45:25 -05:00
|
|
|
HARBOR_VERSION: v2.7.0
|
2023-02-10 00:15:35 -05:00
|
|
|
NEXUS_VERSION: 3.47.1
|
2023-02-22 07:31:13 -05:00
|
|
|
DISTRIBUTION_VERSION: 2.8.1
|
2022-08-16 20:17:37 -04:00
|
|
|
|
2020-11-19 04:40:39 -05:00
|
|
|
jobs:
|
2023-02-09 22:45:25 -05:00
|
|
|
build:
|
2020-11-19 04:40:39 -05:00
|
|
|
runs-on: ubuntu-latest
|
2020-11-19 17:56:09 -05:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
2023-02-22 06:54:31 -05:00
|
|
|
-
|
|
|
|
name: Distribution
|
|
|
|
id: distribution
|
|
|
|
type: local
|
2020-11-19 17:56:09 -05:00
|
|
|
-
|
2023-02-09 22:45:25 -05:00
|
|
|
name: Docker Hub
|
2020-11-19 17:56:09 -05:00
|
|
|
registry: ''
|
|
|
|
slug: ghactionstest/ghactionstest
|
|
|
|
username_secret: DOCKERHUB_USERNAME
|
|
|
|
password_secret: DOCKERHUB_TOKEN
|
2023-02-09 22:45:25 -05:00
|
|
|
type: remote
|
2020-11-19 17:56:09 -05:00
|
|
|
-
|
2023-02-09 22:45:25 -05:00
|
|
|
name: GitHub
|
2020-11-19 17:56:09 -05:00
|
|
|
registry: ghcr.io
|
|
|
|
slug: ghcr.io/docker-ghactiontest/test
|
|
|
|
username_secret: GHCR_USERNAME
|
|
|
|
password_secret: GHCR_PAT
|
2023-02-09 22:45:25 -05:00
|
|
|
type: remote
|
2020-11-19 17:56:09 -05:00
|
|
|
-
|
2023-02-09 22:45:25 -05:00
|
|
|
name: GitLab
|
2020-11-19 17:56:09 -05:00
|
|
|
registry: registry.gitlab.com
|
|
|
|
slug: registry.gitlab.com/test1716/test
|
|
|
|
username_secret: GITLAB_USERNAME
|
|
|
|
password_secret: GITLAB_TOKEN
|
2023-02-09 22:45:25 -05:00
|
|
|
type: remote
|
2020-12-17 06:06:34 -05:00
|
|
|
-
|
2023-02-09 22:45:25 -05:00
|
|
|
name: AWS ECR
|
2020-12-17 06:06:34 -05:00
|
|
|
registry: 175142243308.dkr.ecr.us-east-2.amazonaws.com
|
|
|
|
slug: 175142243308.dkr.ecr.us-east-2.amazonaws.com/sandbox/test-docker-action
|
|
|
|
username_secret: AWS_ACCESS_KEY_ID
|
|
|
|
password_secret: AWS_SECRET_ACCESS_KEY
|
2023-02-09 22:45:25 -05:00
|
|
|
type: remote
|
2020-12-17 06:06:34 -05:00
|
|
|
-
|
2023-02-09 22:45:25 -05:00
|
|
|
name: AWS ECR Public
|
2020-12-17 06:06:34 -05:00
|
|
|
registry: public.ecr.aws
|
2020-12-17 08:56:10 -05:00
|
|
|
slug: public.ecr.aws/q3b5f1u4/test-docker-action
|
2020-12-17 06:06:34 -05:00
|
|
|
username_secret: AWS_ACCESS_KEY_ID
|
|
|
|
password_secret: AWS_SECRET_ACCESS_KEY
|
2023-02-09 22:45:25 -05:00
|
|
|
type: remote
|
2020-12-22 11:42:19 -05:00
|
|
|
-
|
2023-02-09 22:45:25 -05:00
|
|
|
name: Google Artifact Registry
|
2020-12-22 11:42:19 -05:00
|
|
|
registry: us-east4-docker.pkg.dev
|
|
|
|
slug: us-east4-docker.pkg.dev/sandbox-298914/docker-official-github-actions/test-docker-action
|
|
|
|
username_secret: GAR_USERNAME
|
|
|
|
password_secret: GAR_JSON_KEY
|
2023-02-09 22:45:25 -05:00
|
|
|
type: remote
|
2020-12-22 05:21:32 -05:00
|
|
|
-
|
2023-02-09 22:45:25 -05:00
|
|
|
name: Google Container Registry
|
2020-12-22 05:21:32 -05:00
|
|
|
registry: gcr.io
|
|
|
|
slug: gcr.io/sandbox-298914/test-docker-action
|
|
|
|
username_secret: GCR_USERNAME
|
|
|
|
password_secret: GCR_JSON_KEY
|
2023-02-09 22:45:25 -05:00
|
|
|
type: remote
|
2022-01-27 05:38:06 -05:00
|
|
|
-
|
2023-02-09 22:45:25 -05:00
|
|
|
name: Azure Container Registry
|
2022-01-27 05:38:06 -05:00
|
|
|
registry: officialgithubactions.azurecr.io
|
|
|
|
slug: officialgithubactions.azurecr.io/test-docker-action
|
|
|
|
username_secret: AZURE_CLIENT_ID
|
|
|
|
password_secret: AZURE_CLIENT_SECRET
|
2023-02-09 22:45:25 -05:00
|
|
|
type: remote
|
2023-02-09 06:06:55 -05:00
|
|
|
-
|
2023-02-09 22:45:25 -05:00
|
|
|
name: Quay
|
2023-02-09 06:06:55 -05:00
|
|
|
registry: quay.io
|
2023-02-15 13:23:19 -05:00
|
|
|
slug: quay.io/docker_build_team/ghactiontest
|
2023-02-09 06:06:55 -05:00
|
|
|
username_secret: QUAY_USERNAME
|
|
|
|
password_secret: QUAY_TOKEN
|
2023-02-09 22:45:25 -05:00
|
|
|
type: remote
|
2023-02-15 05:48:43 -05:00
|
|
|
-
|
|
|
|
name: Artifactory
|
|
|
|
registry: buildkitghactiontests.jfrog.io
|
|
|
|
slug: buildkitghactiontests.jfrog.io/ghactiontest/test-docker-action
|
|
|
|
username_secret: ARTIFACTORY_USERNAME
|
|
|
|
password_secret: ARTIFACTORY_TOKEN
|
|
|
|
type: remote
|
2023-02-09 22:45:25 -05:00
|
|
|
-
|
|
|
|
name: Harbor
|
|
|
|
id: harbor
|
|
|
|
type: local
|
2023-02-10 00:15:35 -05:00
|
|
|
-
|
|
|
|
name: Nexus
|
|
|
|
id: nexus
|
|
|
|
type: local
|
2020-11-19 04:40:39 -05:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 06:03:44 -05:00
|
|
|
uses: actions/checkout@v3
|
2023-02-09 22:45:25 -05:00
|
|
|
-
|
|
|
|
name: Set up env
|
|
|
|
if: matrix.type == 'local'
|
|
|
|
run: |
|
|
|
|
cat ./.github/e2e/${{ matrix.id }}/env >> $GITHUB_ENV
|
|
|
|
-
|
|
|
|
name: Set up BuildKit config
|
|
|
|
run: |
|
|
|
|
touch /tmp/buildkitd.toml
|
|
|
|
if [ "${{ matrix.type }}" = "local" ]; then
|
|
|
|
echo -e "[registry.\"${{ env.REGISTRY_FQDN }}\"]\nhttp = true\ninsecure = true" > /tmp/buildkitd.toml
|
|
|
|
fi
|
|
|
|
-
|
|
|
|
name: Set up Docker daemon
|
|
|
|
if: matrix.type == 'local'
|
|
|
|
run: |
|
|
|
|
if [ ! -e /etc/docker/daemon.json ]; then
|
|
|
|
echo '{}' | tee /etc/docker/daemon.json >/dev/null
|
|
|
|
fi
|
|
|
|
DOCKERD_CONFIG=$(jq '.+{"insecure-registries":["http://${{ env.REGISTRY_FQDN }}"]}' /etc/docker/daemon.json)
|
|
|
|
sudo tee /etc/docker/daemon.json <<<"$DOCKERD_CONFIG" >/dev/null
|
|
|
|
sudo service docker restart
|
|
|
|
-
|
|
|
|
name: Install ${{ matrix.name }}
|
|
|
|
if: matrix.type == 'local'
|
|
|
|
run: |
|
|
|
|
sudo -E bash ./.github/e2e/${{ matrix.id }}/install.sh
|
2020-11-19 04:40:39 -05:00
|
|
|
-
|
|
|
|
name: Docker meta
|
2021-03-29 08:33:52 -04:00
|
|
|
id: meta
|
2022-05-05 07:02:33 -04:00
|
|
|
uses: docker/metadata-action@v4
|
2020-11-19 04:40:39 -05:00
|
|
|
with:
|
2023-02-09 22:45:25 -05:00
|
|
|
images: ${{ env.REGISTRY_SLUG || matrix.slug }}
|
2023-02-09 06:53:34 -05:00
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=tag
|
|
|
|
type=raw,value=${{ inputs.tag }},enable=${{ inputs.tag != '' }}
|
2020-11-19 04:40:39 -05:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2022-05-05 13:24:32 -04:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2020-11-19 04:40:39 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 13:24:32 -04:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-08-12 10:45:35 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2023-02-09 22:45:25 -05:00
|
|
|
config: /tmp/buildkitd.toml
|
|
|
|
buildkitd-flags: --debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
|
2022-08-12 10:45:35 -04:00
|
|
|
driver-opts: |
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2023-02-09 22:45:25 -05:00
|
|
|
network=host
|
2020-11-19 04:40:39 -05:00
|
|
|
-
|
|
|
|
name: Login to Registry
|
2023-02-22 07:31:13 -05:00
|
|
|
if: github.event_name != 'pull_request' && (env.REGISTRY_USER || matrix.username_secret) != ''
|
2022-05-05 13:24:32 -04:00
|
|
|
uses: docker/login-action@v2
|
2020-11-19 04:40:39 -05:00
|
|
|
with:
|
2023-02-09 22:45:25 -05:00
|
|
|
registry: ${{ env.REGISTRY_FQDN || matrix.registry }}
|
|
|
|
username: ${{ env.REGISTRY_USER || secrets[matrix.username_secret] }}
|
|
|
|
password: ${{ env.REGISTRY_PASSWORD || secrets[matrix.password_secret] }}
|
2020-11-19 04:40:39 -05:00
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
2021-03-28 10:43:51 -04:00
|
|
|
file: ./test/multi.Dockerfile
|
2020-11-19 04:40:39 -05:00
|
|
|
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2021-03-29 08:33:52 -04:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2023-02-09 22:45:25 -05:00
|
|
|
cache-from: type=registry,ref=${{ env.REGISTRY_SLUG || matrix.slug }}:master
|
2020-12-17 08:56:10 -05:00
|
|
|
cache-to: type=inline
|
2020-11-19 04:40:39 -05:00
|
|
|
-
|
|
|
|
name: Inspect image
|
|
|
|
run: |
|
2023-02-09 22:45:25 -05:00
|
|
|
docker pull ${{ env.REGISTRY_SLUG || matrix.slug }}:${{ steps.meta.outputs.version }}
|
|
|
|
docker image inspect ${{ env.REGISTRY_SLUG || matrix.slug }}:${{ steps.meta.outputs.version }}
|
2020-11-19 04:40:39 -05:00
|
|
|
-
|
|
|
|
name: Check manifest
|
|
|
|
run: |
|
2023-02-09 22:45:25 -05:00
|
|
|
docker buildx imagetools inspect ${{ env.REGISTRY_SLUG || matrix.slug }}:${{ steps.meta.outputs.version }} --format '{{json .}}'
|