11# reusable workflow
22name : .e2e-run
33
4+ permissions :
5+ contents : read
6+
47on :
58 workflow_call :
69 inputs :
1922 slug :
2023 required : false
2124 type : string
22- username_secret :
25+ secrets :
26+ registry_username :
2327 required : false
24- type : string
25- password_secret :
28+ registry_password :
2629 required : false
27- type : string
2830
2931env :
3032 HARBOR_VERSION : v2.13.2
@@ -50,17 +52,21 @@ jobs:
5052 steps :
5153 -
5254 name : Checkout
53- uses : actions/checkout@v6
55+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5456 -
5557 name : Set up env
5658 if : inputs.type == 'local'
59+ env :
60+ ID : ${{ inputs.id }}
5761 run : |
58- cat ./.github/e2e/${{ inputs.id } }/env >> $GITHUB_ENV
62+ cat ./.github/e2e/${ID }/env >> $GITHUB_ENV
5963 -
6064 name : Set up BuildKit config
65+ env :
66+ TYPE : ${{ inputs.type }}
6167 run : |
6268 touch /tmp/buildkitd.toml
63- if [ "${{ inputs.type } }" = "local" ]; then
69+ if [ "${TYPE }" = "local" ]; then
6470 echo -e "[registry.\"${{ env.REGISTRY_FQDN }}\"]\nhttp = true\ninsecure = true" > /tmp/buildkitd.toml
6571 fi
6672 -
@@ -77,13 +83,15 @@ jobs:
7783 -
7884 name : Install ${{ inputs.name }}
7985 if : inputs.type == 'local'
86+ env :
87+ ID : ${{ inputs.id }}
8088 run : |
81- sudo -E bash ./.github/e2e/${{ inputs.id } }/install.sh
89+ sudo -E bash ./.github/e2e/${ID }/install.sh
8290 sudo chown $(id -u):$(id -g) -R ~/.docker
8391 -
8492 name : Docker meta
8593 id : meta
86- uses : docker/metadata-action@v6
94+ uses : docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
8795 with :
8896 images : ${{ env.REGISTRY_SLUG || inputs.slug }}
8997 tags : |
@@ -92,10 +100,10 @@ jobs:
92100 type=raw,gh-runid-${{ github.run_id }}
93101 -
94102 name : Set up QEMU
95- uses : docker/setup-qemu-action@v4
103+ uses : docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
96104 -
97105 name : Set up Docker Buildx
98- uses : docker/setup-buildx-action@v4
106+ uses : docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
99107 with :
100108 version : ${{ matrix.buildx_version }}
101109 buildkitd-config : /tmp/buildkitd.toml
@@ -105,12 +113,12 @@ jobs:
105113 network=host
106114 -
107115 name : Login to Registry
108- if : github.event_name != 'pull_request' && (env.REGISTRY_USER || inputs.username_secret) != ''
109- uses : docker/login-action@v4
116+ if : github.event_name != 'pull_request' && (inputs.type == 'remote' || env.REGISTRY_USER != '')
117+ uses : docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
110118 with :
111119 registry : ${{ env.REGISTRY_FQDN || inputs.registry }}
112- username : ${{ env.REGISTRY_USER || secrets[inputs.username_secret] }}
113- password : ${{ env.REGISTRY_PASSWORD || secrets[inputs.password_secret] }}
120+ username : ${{ env.REGISTRY_USER || secrets.registry_username }}
121+ password : ${{ env.REGISTRY_PASSWORD || secrets.registry_password }}
114122 -
115123 name : Build and push
116124 uses : ./
@@ -125,10 +133,14 @@ jobs:
125133 cache-to : type=inline
126134 -
127135 name : Inspect image
136+ env :
137+ SLUG : ${{ env.REGISTRY_SLUG || inputs.slug }}
128138 run : |
129- docker pull ${{ env.REGISTRY_SLUG || inputs.slug } }:${{ steps.meta.outputs.version }}
130- docker image inspect ${{ env.REGISTRY_SLUG || inputs.slug } }:${{ steps.meta.outputs.version }}
139+ docker pull ${SLUG }:${{ steps.meta.outputs.version }}
140+ docker image inspect ${SLUG }:${{ steps.meta.outputs.version }}
131141 -
132142 name : Check manifest
143+ env :
144+ SLUG : ${{ env.REGISTRY_SLUG || inputs.slug }}
133145 run : |
134- docker buildx imagetools inspect ${{ env.REGISTRY_SLUG || inputs.slug } }:${{ steps.meta.outputs.version }} --format '{{json .}}'
146+ docker buildx imagetools inspect ${SLUG }:${{ steps.meta.outputs.version }} --format '{{json .}}'
0 commit comments