Repository navigation
275 lines (243 loc) · 10.6 KB
/
Copy pathdocker-images.yml
File metadata and controls
275 lines (243 loc) · 10.6 KB
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
#
# 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*"
workflow_dispatch:
inputs:
dry-run:
description: "Build the images without pushing to Docker Hub"
type: boolean
default: true
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/') }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
check-latest: false
- name: Set up QEMU
uses: ./.github/actions/setup-qemu-action # docker/setup-qemu-action v4.2.0 (96fe6ef7)
- name: Set up Docker Buildx
uses: ./.github/actions/setup-buildx-action # docker/setup-buildx-action v4.2.0 (bb05f3f5)
- name: Set up Docker tags
uses: ./.github/actions/metadata-action # docker/metadata-action v6.2.0 (dc802804)
id: meta
with:
flavor: |
latest=false
images: |
name=apache/amoro
tags: |
type=ref,event=branch,suffix=-snapshot
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/v') }},value=latest
type=semver,event=tag,pattern={{version}}
type=semver,event=tag,pattern={{version}}, suffix=-hadoop3
- name: Print tags
run: echo '${{ steps.meta.outputs.tags }}'
- name: Login to Docker Hub
uses: ./.github/actions/login-action # docker/login-action v4.5.2 (371161bb)
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build dist module with Maven
run: ./mvnw clean package -pl 'dist' -am -e -DskipTests -B -ntp -Psupport-all-formats -Pno-extended-disk-storage -Pno-plugin-bin
- name: Build and Push Amoro Docker Image
uses: ./.github/actions/build-push-action # docker/build-push-action v7.3.0 (53b7df96)
with:
context: .
push: ${{ github.event_name != 'workflow_dispatch' || inputs.dry-run == false }}
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.18.1", "1.20.0" ]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
check-latest: false
- name: Set up QEMU
uses: ./.github/actions/setup-qemu-action # docker/setup-qemu-action v4.2.0 (96fe6ef7)
- name: Set up Docker Buildx
uses: ./.github/actions/setup-buildx-action # docker/setup-buildx-action v4.2.0 (bb05f3f5)
- name: Set up Docker tags
uses: ./.github/actions/metadata-action # docker/metadata-action v6.2.0 (dc802804)
id: meta
with:
flavor: |
latest=false
images: |
name=apache/amoro-flink-optimizer
tags: |
type=ref,event=branch,enable=${{ matrix.flink == '1.18.1' }},suffix=-snapshot
type=ref,event=branch,enable=${{ matrix.flink == '1.18.1' }},suffix=-snapshot-flink1.18
type=ref,event=branch,enable=${{ matrix.flink == '1.20.0' }},suffix=-snapshot-flink1.20
type=raw,enable=${{ matrix.flink == '1.18.1' && startsWith(github.ref, 'refs/tags/v') }},value=latest
type=semver,enable=${{ matrix.flink == '1.18.1' }},pattern={{version}}
type=semver,enable=${{ matrix.flink == '1.18.1' }},pattern={{version}}, suffix=-flink1.18
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: ./.github/actions/login-action # docker/login-action v4.5.2 (371161bb)
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: ./mvnw clean package -pl 'amoro-optimizer/amoro-optimizer-flink' -am -e ${OPTIMIZER_FLINK} -DskipTests -B -ntp
- name: Build and Push Flink Optimizer Docker Image
uses: ./.github/actions/build-push-action # docker/build-push-action v7.3.0 (53b7df96)
env:
AMORO_VERSION: ${{ steps.version.outputs.AMORO_VERSION }}
with:
context: .
push: ${{ github.event_name != 'workflow_dispatch' || inputs.dry-run == false }}
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:
include:
- spark: "3.5.7"
scala: "2.12.15"
scala_binary: "2.12"
major: "3.5"
jdk: "11"
aws: "2.29.52"
- spark: "4.1.3"
scala: "2.13.17"
scala_binary: "2.13"
major: "4.1"
jdk: "17"
aws: "2.29.52"
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.jdk }}
distribution: 'temurin'
cache: maven
check-latest: false
- name: Set up QEMU
uses: ./.github/actions/setup-qemu-action # docker/setup-qemu-action v4.2.0 (96fe6ef7)
- name: Set up Docker Buildx
uses: ./.github/actions/setup-buildx-action # docker/setup-buildx-action v4.2.0 (bb05f3f5)
- name: Set up Docker tags
uses: ./.github/actions/metadata-action # docker/metadata-action v6.2.0 (dc802804)
id: meta
with:
flavor: |
latest=false
images: |
name=apache/amoro-spark-optimizer
tags: |
type=ref,event=branch,enable=${{ matrix.spark == '3.5.7' }},suffix=-snapshot
type=ref,event=branch,suffix=-snapshot-spark${{ matrix.major }}
type=raw,enable=${{ matrix.spark == '3.5.7' && startsWith(github.ref, 'refs/tags/v') }},value=latest
type=semver,enable=${{ matrix.spark == '3.5.7' }},pattern={{version}}
type=semver,pattern={{version}},suffix=-spark${{ matrix.major }}
- name: Print tags
run: echo '${{ steps.meta.outputs.tags }}'
- name: Login to Docker Hub
uses: ./.github/actions/login-action # docker/login-action v4.5.2 (371161bb)
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- 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: >-
./mvnw clean package
-pl 'amoro-optimizer/amoro-optimizer-spark' -am
-Doptimizer.spark.version=${{ matrix.spark }}
-DskipTests -B -ntp
- name: Build and Push Spark Optimizer Docker Image
uses: ./.github/actions/build-push-action # docker/build-push-action v7.3.0 (53b7df96)
env:
AMORO_VERSION: ${{ steps.version.outputs.AMORO_VERSION }}
SPARK_MAJOR_VERSION: ${{ matrix.major }}
SCALA_BINARY_VERSION: ${{ matrix.scala_binary }}
with:
context: .
push: ${{ github.event_name != 'workflow_dispatch' || inputs.dry-run == false }}
file: docker/optimizer-spark/Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
build-args: |
SPARK_VERSION=${{ matrix.spark }}
AWS_VERSION=${{ matrix.aws }}
OPTIMIZER_JOB=amoro-optimizer/amoro-optimizer-spark/target/amoro-optimizer-spark-${{ env.SPARK_MAJOR_VERSION}}_${{ env.SCALA_BINARY_VERSION}}-${{ env.AMORO_VERSION }}-jar-with-dependencies.jar