1
1
# ## This workflow setup instance then build and push images ###
2
- name : Multi-arch build
2
+ name : Multi-arch build
3
+
4
+ run-name : >-
5
+ Build Docs: [
6
+ ${{ inputs.docs-community && 'CE' || '-' }}
7
+ ${{ inputs.docs-enterprise && 'EE' || '-' }}
8
+ ${{ inputs.docs-developer && 'DE' || '-' }}
9
+ ]
10
+ ${{ inputs.docs-balancer && 'balancer: [✓]' || '' }}
11
+ ${{ inputs.docs-non-plugins && 'non-plugins: [✓]' || '' }}
12
+ ${{ inputs.docs-utils && 'utils: [✓]' || '' }}
13
+ VER: [${{ inputs.tag }}]
3
14
4
15
on :
5
- push :
6
- tags :
7
- - " v*"
16
+ workflow_dispatch :
17
+ inputs :
18
+ docs-community :
19
+ type : boolean
20
+ description : ' Build Docs-Community'
21
+ default : true
22
+ docs-enterprise :
23
+ type : boolean
24
+ description : ' Build Docs-Enterprise'
25
+ default : true
26
+ docs-developer :
27
+ type : boolean
28
+ description : ' Build Docs-Developer'
29
+ default : true
30
+ docs-non-plugins :
31
+ type : boolean
32
+ description : ' Build Docs-non-plugins'
33
+ default : true
34
+ docs-utils :
35
+ type : boolean
36
+ description : ' Build Docs-utils'
37
+ default : true
38
+ docs-balancer :
39
+ type : boolean
40
+ description : ' Build Docs-balancer'
41
+ default : true
42
+ tag :
43
+ description : ' Specify tag (ex. 7.0.0 or 7.0.0-rc25)'
44
+ type : string
45
+ required : true
46
+ test-repo :
47
+ type : boolean
48
+ description : ' Push to test repo'
49
+ default : true
50
+ test-version :
51
+ type : string
52
+ required : false
53
+ description : ' Specify version if test-repo enabled'
54
+ test-build :
55
+ type : string
56
+ required : false
57
+ description : ' Specify build if test-repo enabled'
8
58
9
59
jobs :
10
60
prepare-build :
@@ -13,69 +63,137 @@ jobs:
13
63
outputs :
14
64
sourceTag : ${{ steps.prepare.outputs.sourceTag }}
15
65
dsHash : ${{ steps.prepare.outputs.dsHash }}
66
+ matrix : ${{ steps.prepare.outputs.matrix }}
16
67
steps :
17
68
- name : prepare-build
18
69
id : prepare
70
+ shell : bash
19
71
run : |
20
- echo "sourceTag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
21
- echo "dsHash=$(echo -n "$(date +'%Y.%m.%d-%H%M')" | md5sum | awk '{print $1}')" >> "$GITHUB_OUTPUT"
72
+ ### Check that test-repo specifyed with rc postfix ###
73
+ if ${{ github.event.inputs.test-repo }}; then
74
+ if ! [[ ${{ github.event.inputs.tag }} == *rc* ]]; then
75
+ echo -e '\033[33m ⚠ ALERT ⚠ \033[0m'
76
+ echo -e 'Test-Repo: enabled[\033[32m✓\033[0m]'
77
+ echo -e 'Please specify tag with <rc>...'
78
+ echo -e '\033[33mFor example:\033[0m ${{ github.event.inputs.tag }}-rc25'
79
+ exit 1
80
+ fi
81
+ fi
82
+
83
+ ### Make build matrix ###
84
+ matrix='{"include": []}'
85
+ if ${{ github.event.inputs.docs-community }}; then
86
+ matrix=$(echo $matrix | jq '.include += [
87
+ {
88
+ "name": "Build Docs Community",
89
+ "dockerfile": "Dockerfile",
90
+ "edition": "",
91
+ "images": "proxy docservice converter"
92
+ }
93
+ ]')
94
+ fi
95
+ if ${{ github.event.inputs.docs-enterprise }}; then
96
+ matrix=$(echo $matrix | jq '.include += [
97
+ {
98
+ "name": "Build Docs Enterprise",
99
+ "dockerfile": "Dockerfile",
100
+ "edition": "-ee",
101
+ "images": "proxy docservice converter"
102
+ }
103
+ ]')
104
+ fi
105
+ if ${{ github.event.inputs.docs-developer }}; then
106
+ matrix=$(echo $matrix | jq '.include += [
107
+ {
108
+ "name": "Build Docs Developer",
109
+ "dockerfile": "Dockerfile",
110
+ "edition": "-de",
111
+ "images": "proxy docservice converter"
112
+ }
113
+ ]')
114
+ fi
115
+ if ${{ github.event.inputs.docs-non-plugins }}; then
116
+ matrix=$(echo $matrix | jq '.include += [
117
+ {
118
+ "name": "Build Docs non-plugins",
119
+ "dockerfile": "Dockerfile",
120
+ "edition": "-de",
121
+ "images": "proxy docservice converter",
122
+ "postfix": "-noplugins"
123
+ }
124
+ ]')
125
+ fi
126
+ if ${{ github.event.inputs.docs-utils }}; then
127
+ matrix=$(echo $matrix | jq '.include += [
128
+ {
129
+ "name": "Build Docs utils",
130
+ "dockerfile": "Dockerfile",
131
+ "edition": "",
132
+ "images": "example utils"
133
+ }
134
+ ]')
135
+ fi
136
+ if ${{ github.event.inputs.docs-balancer }}; then
137
+ matrix=$(echo $matrix | jq '.include += [
138
+ {
139
+ "name": "Build Docs balancer",
140
+ "dockerfile": "Dockerfile.balancer",
141
+ "edition": "",
142
+ "images": "balancer"
143
+ }
144
+ ]')
145
+ fi
146
+
147
+ ### Specify outputs ###
148
+ echo "sourceTag=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
149
+ echo "dsHash=$(echo -n "$(date +'%Y.%m.%d-%H%M')" | md5sum | awk '{print $1}')" >> "$GITHUB_OUTPUT"
150
+ echo "matrix=$(echo $matrix | jq -c)" >> "$GITHUB_OUTPUT"
22
151
23
152
build :
24
- name : " ${{ matrix.name }} ${{ matrix.edition }}"
153
+ name : " ${{ matrix.name }} ${{ github.event.inputs.tag }}"
25
154
runs-on : ubuntu-latest
26
155
needs : [prepare-build]
27
156
strategy :
28
157
fail-fast : false
29
- matrix :
30
- name : ["Build Docs"]
31
- dockerfile : ["Dockerfile"]
32
- edition : [ "", "-ee", "-de"]
33
- images : [ "proxy docservice converter" ]
34
- include :
35
- - edition : " -de"
36
- name : " Build Docs non-plugins"
37
- dockerfile : " Dockerfile.noplugins"
38
- images : " proxy docservice converter"
39
- postfix : " -noplugins"
40
-
41
- - edition : " "
42
- name : " Build utils"
43
- dockerfile : " Dockerfile"
44
- images : " example utils"
45
-
46
- - edition : " "
47
- name : " Build balancer"
48
- dockerfile : " Dockerfile.balancer"
49
- images : " balancer"
158
+ matrix : ${{fromJSON(needs.prepare-build.outputs.matrix)}}
50
159
steps :
51
160
- name : Checkout code
52
- uses : actions/checkout@v3
161
+ uses : actions/checkout@v4
53
162
54
163
- name : Set up QEMU
55
- uses : docker/setup-qemu-action@v2
164
+ uses : docker/setup-qemu-action@v3
56
165
57
166
- name : Set up Docker Buildx
58
- uses : docker/setup-buildx-action@v2
59
-
60
- - name : Login to Docker Hub
61
- uses : docker/login-action@v2
167
+ uses : docker/setup-buildx-action@v3
168
+
169
+ - name : Login to Container Registry
170
+ uses : docker/login-action@v3
62
171
with :
63
- username : ${{ secrets.DOCKER_HUB_USERNAME }}
64
- password : ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
172
+ registry : ${{ inputs.test-repo && secrets.DOCKER_TEST_REGISTRY || 'docker.io' }}
173
+ username : ${{ inputs.test-repo && secrets.DOCKER_TEST_USERNAME || secrets.DOCKER_HUB_USERNAME }}
174
+ password : ${{ inputs.test-repo && secrets.DOCKER_TEST_ACCESS_TOKEN || secrets.DOCKER_HUB_ACCESS_TOKEN }}
65
175
66
- - name : " Build Docs ${{ matrix.edition }}"
176
+ - name : " ${{ matrix.name }}"
67
177
env :
178
+ REGISTRY : ${{ inputs.test-repo && secrets.DOCKER_TEST_REGISTRY || 'docker.io' }}
68
179
DS_VERSION_HASH : ${{ needs.prepare-build.outputs.dsHash }}
69
180
SOURCE_TAG : ${{ needs.prepare-build.outputs.sourceTag }}
70
181
NOPLUG_POSTFIX : ${{ matrix.postfix }}
71
182
DOCKERFILE : ${{ matrix.dockerfile }}
183
+ TEST_VERSION : ${{ github.event.inputs.test-version }}
184
+ TEST_BUILD : ${{ github.event.inputs.test-build }}
72
185
run : |
73
186
: ${DS_VERSION_HASH:?Should be set!}
74
187
75
- DS_VERSION_HASH=${DS_VERSION_HASH} \
76
- DOCKER_TAG=$(echo ${SOURCE_TAG} | sed 's/^.//') \
188
+ if ${{ github.event.inputs.test-repo }}; then
189
+ : ${TEST_VERSION:?Should be set!}
190
+ : ${TEST_BUILD:?Should be set!}
191
+ export PRODUCT_BASEURL=${{ secrets.PRODUCT_BASEURL_RC }}
192
+ export RELEASE_VERSION="-${TEST_VERSION}-${TEST_BUILD}.el7"
193
+ fi
194
+
77
195
PRODUCT_EDITION=${{ matrix.edition }} \
78
- TAG=$DOCKER_TAG \
196
+ TAG=${SOURCE_TAG} \
79
197
docker buildx bake \
80
198
-f docker-bake.hcl ${{ matrix.images }} \
81
199
--push
0 commit comments