1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616#
17+ # Modified by Datazip Inc. in 2026
1718
1819
19- # This workflow will build docker images when commit merged or pushed to master.
20- # or tags pushed.
20+ # Build and publish Docker images. Triggered by push (dev-v3) or workflow_call with tag (e.g. release).
2121
2222name : Publish Docker Image
2323
2424on :
25- push :
26- branches :
27- - " master"
28- tags :
29- - " v*"
25+ workflow_call :
26+ inputs :
27+ tag :
28+ description : ' Version tag for the image (e.g. v1.0.0).'
29+ type : string
30+ required : true
31+ # Use org-level or repo-level secrets; caller must pass with secrets: inherit
32+ secrets :
33+ DOCKER_USERNAME :
34+ description : ' Docker Hub username (org or repo secret)'
35+ required : true
36+ DOCKER_PASSWORD :
37+ description : ' Docker Hub password or token (org or repo secret)'
38+ required : true
3039
3140
3241concurrency :
3342 group : ${{ github.workflow }}-${{ github.ref }}
3443 cancel-in-progress : true
3544
3645jobs :
37- docker-amoro :
38- name : Push Amoro Docker Image to Docker Hub
46+ docker-fusion :
47+ name : Push Fusion Docker Image
3948 runs-on : ubuntu-latest
40- if : ${{ startsWith(github.repository, 'apache/') }}
41- strategy :
42- matrix :
43- hadoop : [ "v2", "v3" ]
49+ environment : docker publish
50+ if : ${{ startsWith(github.repository, 'datazip-inc/') }}
4451 steps :
4552 - uses : actions/checkout@v3
46- - name : Set up JDK 11
53+ - name : Set up JDK 17
4754 uses : actions/setup-java@v3
4855 with :
49- java-version : ' 11 '
56+ java-version : ' 17 '
5057 distribution : ' temurin'
5158 cache : maven
5259 check-latest : false
@@ -56,40 +63,30 @@ jobs:
5663 - name : Set up Docker Buildx
5764 uses : docker/setup-buildx-action@v2
5865
59- - name : Set up Docker tags
60- uses : docker/metadata-action@v5
66+ - name : Set Docker tags
6167 id : meta
62- with :
63- flavor : |
64- latest=false
65- images : |
66- name=apache/amoro
67- tags : |
68- type=ref,event=branch,enable=${{ matrix.hadoop == 'v3' }},suffix=-snapshot
69- type=ref,event=branch,enable=${{ matrix.hadoop == 'v2' }},suffix=-snapshot-hadoop2
70- type=raw,enable=${{ matrix.hadoop == 'v3' && startsWith(github.ref, 'refs/tags/v') }},value=latest
71- type=semver,event=tag,enable=${{ matrix.hadoop == 'v3' }},pattern={{version}}
72- type=semver,event=tag,enable=${{ matrix.hadoop == 'v3' }},pattern={{version}}, suffix=-hadoop3
73- type=semver,event=tag,enable=${{ matrix.hadoop == 'v2' }},pattern={{version}}, suffix=-hadoop2
68+ run : |
69+ VERSION_TAG="${{ github.event_name == 'workflow_call' && inputs.tag || 'dev-v3' }}"
70+ if [ "${{ github.ref }}" = "refs/heads/master" ]; then
71+ case "${VERSION_TAG}" in v*) ;; *) echo "::error::On master branch, version tag must start with 'v' (e.g. v1.0.0). Got: ${VERSION_TAG}"; exit 1 ;; esac
72+ echo "tags=olakego/fusion:latest,olakego/fusion:${VERSION_TAG}" >> $GITHUB_OUTPUT
73+ else
74+ echo "tags=olakego/fusion:latest-${VERSION_TAG},olakego/fusion:${VERSION_TAG}" >> $GITHUB_OUTPUT
75+ fi
7476
7577 - name : Print tags
7678 run : echo '${{ steps.meta.outputs.tags }}'
7779
7880 - name : Login to Docker Hub
7981 uses : docker/login-action@v2
8082 with :
81- username : ${{ secrets.DOCKERHUB_USER }}
82- password : ${{ secrets.DOCKERHUB_TOKEN }}
83-
84- - name : Set Maven Build Properties
85- if : ${{ matrix.hadoop == 'v2' }}
86- run : |
87- echo "MVN_HADOOP=-Phadoop2" >> $GITHUB_ENV
83+ username : ${{ secrets.DOCKER_USERNAME }}
84+ password : ${{ secrets.DOCKER_PASSWORD }}
8885
8986 - name : Build dist module with Maven
90- run : ./mvnw clean package -pl 'dist' -am -e ${MVN_HADOOP} -DskipTests -B -ntp -Psupport-all-formats -Pno-extended-disk-storage -Pno-plugin-bin
87+ run : ./mvnw clean package -pl 'dist' -am -e -DskipTests -B -ntp -Psupport-all-formats -Pno-extended-disk-storage -Pno-plugin-bin
9188
92- - name : Build and Push Amoro Docker Image
89+ - name : Build and Push Fusion Docker Image to olakego/fusion
9390 uses : docker/build-push-action@v4
9491 with :
9592 context : .
@@ -98,19 +95,21 @@ jobs:
9895 platforms : linux/amd64,linux/arm64
9996 tags : ${{ steps.meta.outputs.tags }}
10097
101- docker-optimizer-flink :
102- name : Push Amoro Optimizer-Flink Docker Image to Docker Hub
98+ docker-optimizer-spark :
99+ name : Push Fusion Spark Optimizer Docker Image to olakego/fusion-spark
103100 runs-on : ubuntu-latest
104- if : ${{ startsWith(github.repository, 'apache/') }}
101+ environment : docker publish
102+ if : ${{ startsWith(github.repository, 'datazip-inc/') }}
105103 strategy :
106104 matrix :
107- flink : [ "1.14.6", "1.20.0" ]
105+ spark : [ "3.5.8" ] # spark version supported
106+ scala : [ "2.13.18" ] # scala version supported
108107 steps :
109108 - uses : actions/checkout@v3
110- - name : Set up JDK 11
109+ - name : Set up JDK 17
111110 uses : actions/setup-java@v3
112111 with :
113- java-version : ' 11 '
112+ java-version : ' 17 '
114113 distribution : ' temurin'
115114 cache : maven
116115 check-latest : false
@@ -120,112 +119,25 @@ jobs:
120119 - name : Set up Docker Buildx
121120 uses : docker/setup-buildx-action@v2
122121
123- - name : Set up Docker tags
124- uses : docker/metadata-action@v5
122+ - name : Set Docker tags
125123 id : meta
126- with :
127- flavor : |
128- latest=false
129- images : |
130- name=apache/amoro-flink-optimizer
131- tags : |
132- type=ref,event=branch,enable=${{ matrix.flink == '1.14.6' }},suffix=-snapshot
133- type=ref,event=branch,enable=${{ matrix.flink == '1.14.6' }},suffix=-snapshot-flink1.14
134- type=ref,event=branch,enable=${{ matrix.flink == '1.20.0' }},suffix=-snapshot-flink1.20
135- type=raw,enable=${{ matrix.hadoop == '1.14.6' && startsWith(github.ref, 'refs/tags/v') }},value=latest
136- type=semver,enable=${{ matrix.flink == '1.14.6' }},pattern={{version}}
137- type=semver,enable=${{ matrix.flink == '1.14.6' }},pattern={{version}}, suffix=-flink1.14
138- type=semver,enable=${{ matrix.flink == '1.20.0' }},pattern={{version}}, suffix=-flink1.20
139-
140- - name : Print tags
141- run : echo '${{ steps.meta.outputs.tags }}'
142-
143- - name : Login to Docker Hub
144- uses : docker/login-action@v2
145- with :
146- username : ${{ secrets.DOCKERHUB_USER }}
147- password : ${{ secrets.DOCKERHUB_TOKEN }}
148-
149- - name : Set optimizer flink version
150124 run : |
151- OPTIMIZER_FLINK=${{ matrix.flink }} && \
152- echo "OPTIMIZER_FLINK=-Dflink-optimizer.flink-version${OPTIMIZER_FLINK}" >> $GITHUB_ENV
153- if [[ "$OPTIMIZER_FLINK" < "1.15" ]]; then
154- echo "Adding -Pflink-optimizer-pre-1.15 for Flink version less than 1.15"
155- echo "OPTIMIZER_FLINK=-Pflink-optimizer-pre-1.15 -Dflink-optimizer.flink-version=${OPTIMIZER_FLINK}" >> $GITHUB_ENV
125+ VERSION_TAG="${{ github.event_name == 'workflow_call' && inputs.tag || 'dev-v3' }}"
126+ if [ "${{ github.ref }}" = "refs/heads/master" ]; then
127+ case "${VERSION_TAG}" in v*) ;; *) echo "::error::On master branch, version tag must start with 'v' (e.g. v1.0.0). Got: ${VERSION_TAG}"; exit 1 ;; esac
128+ echo "tags=olakego/fusion-spark:latest,olakego/fusion-spark:${VERSION_TAG}" >> $GITHUB_OUTPUT
129+ else
130+ echo "tags=olakego/fusion-spark:latest-${VERSION_TAG},olakego/fusion-spark:${VERSION_TAG}" >> $GITHUB_OUTPUT
156131 fi
157132
158- - name : Set ENV Amoro version
159- id : version
160- run : |
161- AMORO_VERSION=`cat pom.xml | grep 'amoro-parent' -C 3 | grep -Eo '<version>.*</version>' | awk -F'[><]' '{print $3}'` \
162- && echo "$AMORO_VERSION" \
163- && echo "AMORO_VERSION=${AMORO_VERSION}" >> $GITHUB_ENV \
164- && echo "AMORO_VERSION=${AMORO_VERSION}" >> $GITHUB_OUTPUT
165-
166- - name : Build optimizer module with Maven
167- run : ./mvnw clean package -pl 'amoro-optimizer/amoro-optimizer-flink' -am -e ${OPTIMIZER_FLINK} -DskipTests -B -ntp
168-
169- - name : Build and Push Flink Optimizer Docker Image
170- uses : docker/build-push-action@v4
171- env :
172- AMORO_VERSION : ${{ steps.version.outputs.AMORO_VERSION }}
173- with :
174- context : .
175- push : true
176- file : docker/optimizer-flink/Dockerfile
177- platforms : linux/amd64,linux/arm64
178- tags : ${{ steps.meta.outputs.tags }}
179- build-args : |
180- FLINK_VERSION=${{ matrix.flink }}
181- OPTIMIZER_JOB=amoro-optimizer/amoro-optimizer-flink/target/amoro-optimizer-flink-${{ env.AMORO_VERSION }}-jar-with-dependencies.jar
182-
183- docker-optimizer-spark :
184- name : Push Amoro Optimizer-Spark Docker Image to Docker Hub
185- runs-on : ubuntu-latest
186- if : ${{ startsWith(github.repository, 'apache/') }}
187- strategy :
188- matrix :
189- spark : [ "3.5.7" ]
190- scala : [ "2.12.15" ]
191- steps :
192- - uses : actions/checkout@v3
193- - name : Set up JDK 11
194- uses : actions/setup-java@v3
195- with :
196- java-version : ' 11'
197- distribution : ' temurin'
198- cache : maven
199- check-latest : false
200- - name : Set up QEMU
201- uses : docker/setup-qemu-action@v2
202-
203- - name : Set up Docker Buildx
204- uses : docker/setup-buildx-action@v2
205-
206- - name : Set up Docker tags
207- uses : docker/metadata-action@v5
208- id : meta
209- with :
210- flavor : |
211- latest=false
212- images : |
213- name=apache/amoro-spark-optimizer
214- tags : |
215- type=ref,event=branch,enable=${{ matrix.spark == '3.5.7' }},suffix=-snapshot
216- type=ref,event=branch,enable=${{ matrix.spark == '3.5.7' }},suffix=-snapshot-spark3.5
217- type=raw,enable=${{ matrix.hadoop == '3.5.7' && startsWith(github.ref, 'refs/tags/v') }},value=latest
218- type=semver,enable=${{ matrix.spark == '3.5.7' }},pattern={{version}}
219- type=semver,enable=${{ matrix.spark == '3.5.7' }},pattern={{version}}, suffix=-spark3.5
220-
221133 - name : Print tags
222134 run : echo '${{ steps.meta.outputs.tags }}'
223135
224136 - name : Login to Docker Hub
225137 uses : docker/login-action@v2
226138 with :
227- username : ${{ secrets.DOCKERHUB_USER }}
228- password : ${{ secrets.DOCKERHUB_TOKEN }}
139+ username : ${{ secrets.DOCKER_USERNAME }}
140+ password : ${{ secrets.DOCKER_PASSWORD }}
229141
230142 - name : Set optimizer spark version and extract versions
231143 id : versions
@@ -245,9 +157,9 @@ jobs:
245157 && echo "AMORO_VERSION=${AMORO_VERSION}" >> $GITHUB_OUTPUT
246158
247159 - name : Build optimizer module with Maven
248- run : ./mvnw clean package -pl 'amoro-optimizer/amoro-optimizer-spark' -am -e ${SPARK_VERSION} -DskipTests -B -ntp
160+ run : ./mvnw clean package -pl 'amoro-optimizer/amoro-optimizer-spark' -am -e ${SPARK_VERSION} -Dscala.version=${{ matrix.scala }} -Dscala.binary.version=${{ steps.versions.outputs.SCALA_BINARY_VERSION }} - DskipTests -B -ntp
249161
250- - name : Build and Push Spark Optimizer Docker Image
162+ - name : Build and Push Spark Optimizer Docker Image to olakego/fusion-spark
251163 uses : docker/build-push-action@v4
252164 env :
253165 AMORO_VERSION : ${{ steps.version.outputs.AMORO_VERSION }}
@@ -261,6 +173,7 @@ jobs:
261173 tags : ${{ steps.meta.outputs.tags }}
262174 build-args : |
263175 SPARK_VERSION=${{ matrix.spark }}
176+ SPARK_JAVA_TAG=${{ matrix.spark }}-java17
264177 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
265178
266179
0 commit comments