Skip to content

Commit d82dc70

Browse files
authored
Fix build_tag.yml workflow (#7016)
Remove undefined references to push_needed. Add the ability to trigger the workflow manually in case it is ever needed because of a release issue. Signed-off-by: Antonin Bas <[email protected]>
1 parent 2bb9353 commit d82dc70

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

.github/workflows/build_tag.yml

+20-7
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,30 @@ on:
44
push:
55
tags:
66
- v*
7+
workflow_dispatch:
8+
inputs:
9+
antrea-tag:
10+
description: The Antrea tag (e.g. v2.3.0) for which images should be built.
11+
type: string
12+
required: true
713

814
jobs:
915
get-version:
1016
runs-on: [ubuntu-latest]
1117
outputs:
1218
version: ${{ steps.get-version.outputs.version }}
19+
antrea_ref: ${{ steps.get-version.outputs.antrea_ref }}
1320
steps:
1421
- name: Extract version from Github ref
1522
id: get-version
16-
env:
17-
TAG: ${{ github.ref }}
1823
run: |
19-
version=${TAG:10}
24+
version=${{ inputs.antrea-tag }}
25+
if [ -z "$version" ]; then
26+
tag=${{ github.ref }}
27+
version=${tag:10}
28+
fi
2029
echo "version=$version" >> $GITHUB_OUTPUT
30+
echo "antrea_ref=refs/tags/$version" >> $GITHUB_OUTPUT
2131
2232
build:
2333
needs: get-version
@@ -39,6 +49,7 @@ jobs:
3949
steps:
4050
- uses: actions/checkout@v4
4151
with:
52+
ref: ${{ needs.get-version.outputs.antrea_ref }}
4253
show-progress: false
4354
- name: Set up Docker Buildx
4455
uses: docker/setup-buildx-action@v3
@@ -50,13 +61,11 @@ jobs:
5061
run: |
5162
./hack/build-antrea-linux-all.sh --platform ${{ matrix.platform }} --pull
5263
- name: Login to Docker Hub
53-
if: ${{ needs.check-env.outputs.push_needed == 'true' }}
5464
uses: docker/login-action@v3
5565
with:
5666
username: ${{ secrets.DOCKER_USERNAME }}
5767
password: ${{ secrets.DOCKER_PASSWORD }}
5868
- name: Login to Github Container Registry
59-
if: ${{ needs.check-env.outputs.push_needed == 'true' }}
6069
uses: docker/login-action@v3
6170
with:
6271
registry: ghcr.io
@@ -100,13 +109,13 @@ jobs:
100109
- name: Set up Docker Buildx
101110
uses: docker/setup-buildx-action@v3
102111
- name: Login to Docker Hub
103-
if: ${{ needs.check-env.outputs.push_needed == 'true' && matrix.registry == 'docker.io' }}
112+
if: ${{ matrix.registry == 'docker.io' }}
104113
uses: docker/login-action@v3
105114
with:
106115
username: ${{ secrets.DOCKER_USERNAME }}
107116
password: ${{ secrets.DOCKER_PASSWORD }}
108117
- name: Login to Github Container Registry
109-
if: ${{ needs.check-env.outputs.push_needed == 'true' && matrix.registry == 'ghcr.io' }}
118+
if: ${{ matrix.registry == 'ghcr.io' }}
110119
uses: docker/login-action@v3
111120
with:
112121
registry: ghcr.io
@@ -133,6 +142,7 @@ jobs:
133142
steps:
134143
- uses: actions/checkout@v4
135144
with:
145+
ref: ${{ needs.get-version.outputs.antrea_ref }}
136146
show-progress: false
137147
- name: Set up Docker Buildx
138148
uses: docker/setup-buildx-action@v3
@@ -153,6 +163,7 @@ jobs:
153163
steps:
154164
- uses: actions/checkout@v4
155165
with:
166+
ref: ${{ needs.get-version.outputs.antrea_ref }}
156167
show-progress: false
157168
- name: Build Antrea Windows Docker image and push to registry
158169
env:
@@ -170,6 +181,7 @@ jobs:
170181
steps:
171182
- uses: actions/checkout@v4
172183
with:
184+
ref: ${{ needs.get-version.outputs.antrea_ref }}
173185
show-progress: false
174186
- name: Build antrea-mc-controller Docker image and push to registry
175187
env:
@@ -187,6 +199,7 @@ jobs:
187199
steps:
188200
- uses: actions/checkout@v4
189201
with:
202+
ref: ${{ needs.get-version.outputs.antrea_ref }}
190203
show-progress: false
191204
- name: Build flow-aggregator Docker image and push to registry
192205
env:

0 commit comments

Comments
 (0)