Skip to content

Commit eb158d1

Browse files
committed
Add action to publish docker images
1 parent f82bdf0 commit eb158d1

File tree

4 files changed

+651
-334
lines changed

4 files changed

+651
-334
lines changed

.github/workflows/presto-release-publish.yml

Lines changed: 13 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -291,179 +291,24 @@ jobs:
291291
./presto-benchmark-driver/target/presto-benchmark-driver-*-executable.jar
292292
./presto-testing-server-launcher/target/presto-testing-server-launcher-*-executable.jar
293293
294-
publish-docker-image:
295-
needs: publish-maven-artifacts
296-
if: (!failure() && !cancelled()) && github.event.inputs.publish_image == 'true'
297-
runs-on: ubuntu-latest
298-
environment: release
299-
timeout-minutes: 150
300-
permissions:
301-
packages: write
302-
contents: read
303-
steps:
304-
- name: Checkout
305-
uses: actions/checkout@v4
306-
with:
307-
ref: ${{ env.RELEASE_TAG}}
308-
persist-credentials: false
309-
310-
- name: Download artifacts
311-
uses: actions/download-artifact@v4
312-
with:
313-
name: presto-artifacts-${{ env.RELEASE_TAG }}
314-
path: ./
315-
316-
- name: Login to dockerhub
317-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
318-
with:
319-
username: ${{ secrets.DOCKERHUB_USERNAME }}
320-
password: ${{ secrets.DOCKERHUB_TOKEN }}
321-
322-
- name: Set up qemu
323-
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
324-
325-
- name: Set up docker buildx
326-
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
327-
328-
- name: Create and use builder
329-
run: |
330-
docker buildx create --name container --use
331-
docker buildx inspect --bootstrap
332-
333-
- name: Move artifacts to docker directory
334-
run: |
335-
mv ./presto-server/target/presto-server-*.tar.gz docker/
336-
mv ./presto-cli/target/presto-cli-*-executable.jar docker/
337-
338-
- name: Build docker image and publish
339-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
340-
with:
341-
context: docker
342-
platforms: linux/amd64,linux/arm64,linux/ppc64le
343-
file: docker/Dockerfile
344-
push: true
345-
build-args: |
346-
PRESTO_VERSION=${{ env.RELEASE_TAG }}
347-
JMX_PROMETHEUS_JAVAAGENT_VERSION=0.20.0
348-
tags: |
349-
${{ env.DOCKER_REPO }}:${{ env.RELEASE_TAG }}
350-
${{ github.event.inputs.tag_image_as_latest == 'true' && format('{0}:latest', env.DOCKER_REPO) || '' }}
351-
352-
publish-native-image:
353-
needs: publish-release-tag
354-
if: (!failure() && !cancelled()) && github.event.inputs.publish_native_image == 'true'
355-
runs-on: ubuntu-latest
294+
publish-docker-images:
295+
needs: [publish-maven-artifacts, publish-release-tag]
296+
if: (!failure() && !cancelled()) && (github.event.inputs.publish_image == 'true' || github.event.inputs.publish_native_image == 'true')
297+
uses: ./.github/workflows/publish-docker-images.yml
298+
with:
299+
branch_or_tag: ${{ github.event.inputs.RELEASE_VERSION }}
300+
os: centos
301+
tag_suffix: ''
302+
tag_latest: ${{ github.event.inputs.tag_image_as_latest == 'true' }}
303+
publish_dependency: ${{ github.event.inputs.dependency_image == '' && github.event.inputs.publish_native_image == 'true' }}
304+
publish_presto: ${{ github.event.inputs.publish_image == 'true' }}
305+
publish_prestissimo: ${{ github.event.inputs.publish_native_image == 'true' }}
306+
secrets: inherit
356307
permissions:
357308
contents: read
358309
packages: write
359310
attestations: write
360311
id-token: write
361-
environment: release
362-
timeout-minutes: 300
363-
steps:
364-
- name: Free Disk Space (Ubuntu)
365-
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
366-
with:
367-
tool-cache: false
368-
large-packages: false
369-
docker-images: false
370-
swap-storage: false
371-
372-
- name: Checkout
373-
uses: actions/checkout@v4
374-
with:
375-
ref: ${{ env.RELEASE_TAG }}
376-
submodules: true
377-
persist-credentials: false
378-
379-
- name: Initialize Prestissimo submodules
380-
run: |
381-
df -h
382-
cd presto-native-execution && make submodules
383-
echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
384-
385-
- name: Login to DockerHub
386-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
387-
with:
388-
username: ${{ secrets.DOCKERHUB_USERNAME }}
389-
password: ${{ secrets.DOCKERHUB_TOKEN }}
390-
391-
- name: Set dependency image tag
392-
env:
393-
DEPENDENCY_IMAGE: ${{ github.event.inputs.dependency_image }}
394-
RELEASE_TAG: ${{ env.RELEASE_TAG }}
395-
run: |
396-
if [[ -n "$DEPENDENCY_IMAGE" ]]; then
397-
echo "DEPENDENCY_IMAGE=$DEPENDENCY_IMAGE" >> $GITHUB_ENV
398-
else
399-
echo "DEPENDENCY_IMAGE=${{ github.repository_owner }}/presto-native-dependency:$RELEASE_TAG-${{ env.COMMIT_SHA }}" >> $GITHUB_ENV
400-
fi
401-
402-
- name: Build Dependency Image
403-
working-directory: presto-native-execution
404-
env:
405-
PUBLISH_NATIVE_IMAGE: ${{ github.event.inputs.publish_native_image }}
406-
TAG_IMAGE_AS_LATEST: ${{ github.event.inputs.tag_image_as_latest }}
407-
RELEASE_TAG: ${{ env.RELEASE_TAG }}
408-
run: |
409-
df -h
410-
if docker pull ${{ env.DEPENDENCY_IMAGE }}; then
411-
echo "Using dependency image ${{ env.DEPENDENCY_IMAGE }}"
412-
docker tag ${{ env.DEPENDENCY_IMAGE }} presto/prestissimo-dependency:centos9
413-
else
414-
echo "Building new depedency image"
415-
docker compose build centos-native-dependency
416-
if [[ "$PUBLISH_NATIVE_IMAGE" == "true" ]]; then
417-
docker tag presto/prestissimo-dependency:centos9 ${{ github.repository_owner }}/presto-native-dependency:$RELEASE_TAG-${{ env.COMMIT_SHA }}
418-
docker push ${{ github.repository_owner }}/presto-native-dependency:$RELEASE_TAG-${{ env.COMMIT_SHA }}
419-
420-
if [[ "$TAG_IMAGE_AS_LATEST" == "true" ]]; then
421-
docker tag presto/prestissimo-dependency:centos9 ${{ github.repository_owner }}/presto-native-dependency:latest
422-
docker push ${{ github.repository_owner }}/presto-native-dependency:latest
423-
fi
424-
fi
425-
fi
426-
docker images
427-
428-
- name: Build Runtime Image
429-
working-directory: presto-native-execution
430-
run: |
431-
df -h
432-
docker compose build --build-arg EXTRA_CMAKE_FLAGS="
433-
-DPRESTO_ENABLE_PARQUET=ON \
434-
-DPRESTO_ENABLE_REMOTE_FUNCTIONS=ON \
435-
-DPRESTO_ENABLE_JWT=ON \
436-
-DPRESTO_STATS_REPORTER_TYPE=PROMETHEUS \
437-
-DPRESTO_MEMORY_CHECKER_TYPE=LINUX_MEMORY_CHECKER \
438-
-DPRESTO_ENABLE_SPATIAL=ON \
439-
-DPRESTO_ENABLE_TESTING=OFF \
440-
-DPRESTO_ENABLE_S3=ON" \
441-
--build-arg NUM_THREADS=2 \
442-
centos-native-runtime
443-
444-
- name: Add release tag
445-
working-directory: presto-native-execution
446-
env:
447-
TAG_IMAGE_AS_LATEST: ${{ github.event.inputs.tag_image_as_latest }}
448-
ORG_NAME: ${{ env.ORG_NAME }}
449-
RELEASE_TAG: ${{ env.RELEASE_TAG }}
450-
run: |
451-
docker tag presto/prestissimo-runtime:centos9 $ORG_NAME/${{ env.IMAGE_NAME }}:$RELEASE_TAG
452-
if [[ "$TAG_IMAGE_AS_LATEST" == "true" ]]; then
453-
docker tag presto/prestissimo-runtime:centos9 $ORG_NAME/${{ env.IMAGE_NAME }}:latest
454-
fi
455-
456-
- name: Push to DockerHub
457-
env:
458-
TAG_IMAGE_AS_LATEST: ${{ github.event.inputs.tag_image_as_latest }}
459-
ORG_NAME: ${{ env.ORG_NAME }}
460-
RELEASE_TAG: ${{ env.RELEASE_TAG }}
461-
run: |
462-
docker push $ORG_NAME/${{ env.IMAGE_NAME }}:$RELEASE_TAG
463-
if [[ "$TAG_IMAGE_AS_LATEST" == "true" ]]; then
464-
docker tag $ORG_NAME/${{ env.IMAGE_NAME }}:$RELEASE_TAG $ORG_NAME/${{ env.IMAGE_NAME }}:latest
465-
docker push $ORG_NAME/${{ env.IMAGE_NAME }}:latest
466-
fi
467312

468313
publish-docs:
469314
needs: publish-maven-artifacts

.github/workflows/publish-dependency-image.yml

Lines changed: 0 additions & 164 deletions
This file was deleted.

0 commit comments

Comments
 (0)