-
Notifications
You must be signed in to change notification settings - Fork 299
256 lines (222 loc) · 9.38 KB
/
docker-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This workflow will build docker images when commit merged or pushed to master.
# or tags pushed.
name: Publish Docker Image
on:
push:
branches:
- "master"
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
docker-amoro:
name: Push Amoro Docker Image to Docker Hub
runs-on: ubuntu-latest
if: ${{ startsWith(github.repository, 'apache/') }}
strategy:
matrix:
hadoop: [ "v2", "v3" ]
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up Docker tags
uses: docker/metadata-action@v5
id: meta
with:
flavor: |
latest=false
images: |
name=apache/amoro
tags: |
type=ref,event=branch,enable=${{ matrix.hadoop == 'v3' }},suffix=-snapshot
type=ref,event=branch,enable=${{ matrix.hadoop == 'v2' }},suffix=-snapshot-hadoop2
type=raw,enable=${{ matrix.hadoop == 'v3' && startsWith(github.ref, 'refs/tags/v') }},value=latest
type=semver,event=tag,enable=${{ matrix.hadoop == 'v3' }},pattern={{version}}
type=semver,event=tag,enable=${{ matrix.hadoop == 'v3' }},pattern={{version}}, suffix=-hadoop3
type=semver,event=tag,enable=${{ matrix.hadoop == 'v2' }},pattern={{version}}, suffix=-hadoop2
- name: Print tags
run: echo '${{ steps.meta.outputs.tags }}'
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set Maven Build Properties
if: ${{ matrix.hadoop == 'v2' }}
run: |
echo "MVN_HADOOP=-Phadoop2" >> $GITHUB_ENV
- name: Build dist module with Maven
run: mvn clean package -pl 'dist' -am -e ${MVN_HADOOP} -DskipTests -B -ntp
- name: Build and Push Amoro Docker Image
uses: docker/build-push-action@v4
with:
context: .
push: true
file: docker/amoro/Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
docker-optimizer-flink:
name: Push Amoro Optimizer-Flink Docker Image to Docker Hub
runs-on: ubuntu-latest
if: ${{ startsWith(github.repository, 'apache/') }}
strategy:
matrix:
flink: [ "1.14.6", "1.20.0" ]
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up Docker tags
uses: docker/metadata-action@v5
id: meta
with:
flavor: |
latest=false
images: |
name=apache/amoro-flink-optimizer
tags: |
type=ref,event=branch,enable=${{ matrix.flink == '1.14.6' }},suffix=-snapshot
type=ref,event=branch,enable=${{ matrix.flink == '1.14.6' }},suffix=-snapshot-flink1.14
type=ref,event=branch,enable=${{ matrix.flink == '1.20.0' }},suffix=-snapshot-flink1.20
type=raw,enable=${{ matrix.hadoop == '1.14.6' && startsWith(github.ref, 'refs/tags/v') }},value=latest
type=semver,enable=${{ matrix.flink == '1.14.6' }},pattern={{version}}
type=semver,enable=${{ matrix.flink == '1.14.6' }},pattern={{version}}, suffix=-flink1.14
type=semver,enable=${{ matrix.flink == '1.20.0' }},pattern={{version}}, suffix=-flink1.20
- name: Print tags
run: echo '${{ steps.meta.outputs.tags }}'
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set optimizer flink version
run: |
OPTIMIZER_FLINK=${{ matrix.flink }} && \
echo "OPTIMIZER_FLINK=-Dflink-optimizer.flink-version${OPTIMIZER_FLINK}" >> $GITHUB_ENV
if [[ "$OPTIMIZER_FLINK" < "1.15" ]]; then
echo "Adding -Pflink-optimizer-pre-1.15 for Flink version less than 1.15"
echo "OPTIMIZER_FLINK=-Pflink-optimizer-pre-1.15 -Dflink-optimizer.flink-version=${OPTIMIZER_FLINK}" >> $GITHUB_ENV
fi
- name: Set ENV Amoro version
id: version
run: |
AMORO_VERSION=`cat pom.xml | grep 'amoro-parent' -C 3 | grep -Eo '<version>.*</version>' | awk -F'[><]' '{print $3}'` \
&& echo "$AMORO_VERSION" \
&& echo "AMORO_VERSION=${AMORO_VERSION}" >> $GITHUB_ENV \
&& echo "AMORO_VERSION=${AMORO_VERSION}" >> $GITHUB_OUTPUT
- name: Build optimizer module with Maven
run: mvn clean package -pl 'amoro-optimizer/amoro-optimizer-flink' -am -e ${OPTIMIZER_FLINK} -DskipTests -B -ntp
- name: Build and Push Flink Optimizer Docker Image
uses: docker/build-push-action@v4
env:
AMORO_VERSION: ${{ steps.version.outputs.AMORO_VERSION }}
with:
context: .
push: true
file: docker/optimizer-flink/Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
build-args: |
FLINK_VERSION=${{ matrix.flink }}
OPTIMIZER_JOB=amoro-optimizer/amoro-optimizer-flink/target/amoro-optimizer-flink-${{ env.AMORO_VERSION }}-jar-with-dependencies.jar
docker-optimizer-spark:
name: Push Amoro Optimizer-Spark Docker Image to Docker Hub
runs-on: ubuntu-latest
if: ${{ startsWith(github.repository, 'apache/') }}
strategy:
matrix:
spark: [ "3.3.3" ]
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up Docker tags
uses: docker/metadata-action@v5
id: meta
with:
flavor: |
latest=false
images: |
name=apache/amoro-spark-optimizer
tags: |
type=ref,event=branch,enable=${{ matrix.spark == '3.3.3' }},suffix=-snapshot
type=ref,event=branch,enable=${{ matrix.spark == '3.3.3' }},suffix=-snapshot-spark3.3
type=raw,enable=${{ matrix.hadoop == '3.3.3' && startsWith(github.ref, 'refs/tags/v') }},value=latest
type=semver,enable=${{ matrix.spark == '3.3.3' }},pattern={{version}}
type=semver,enable=${{ matrix.spark == '3.3.3' }},pattern={{version}}, suffix=-spark3.3
- name: Print tags
run: echo '${{ steps.meta.outputs.tags }}'
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set optimizer spark version
run: |
OPTIMIZER_SPARK=${{ matrix.spark }} && \
echo "OPTIMIZER_SPARK=-Dspark-optimizer.spark-version${OPTIMIZER_SPARK}" >> $GITHUB_ENV
- name: Set ENV Amoro version
id: version
run: |
AMORO_VERSION=`cat pom.xml | grep 'amoro-parent' -C 3 | grep -Eo '<version>.*</version>' | awk -F'[><]' '{print $3}'` \
&& echo "$AMORO_VERSION" \
&& echo "AMORO_VERSION=${AMORO_VERSION}" >> $GITHUB_ENV \
&& echo "AMORO_VERSION=${AMORO_VERSION}" >> $GITHUB_OUTPUT
- name: Build optimizer module with Maven
run: mvn clean package -pl 'amoro-optimizer/amoro-optimizer-spark' -am -e ${OPTIMIZER_SPARK} -DskipTests -B -ntp
- name: Build and Push Spark Optimizer Docker Image
uses: docker/build-push-action@v4
env:
AMORO_VERSION: ${{ steps.version.outputs.AMORO_VERSION }}
with:
context: .
push: true
file: docker/optimizer-spark/Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
build-args: |
SPARK_VERSION=${{ matrix.spark }}
OPTIMIZER_JOB=amoro-optimizer/amoro-optimizer-spark/target/amoro-optimizer-spark-${{ env.AMORO_VERSION }}-jar-with-dependencies.jar