feat: Ingestion Docker Image Tags (#16819)

* feat: Enable Ingestion Docker Image Tags using meta step

* feat: conditional latest tag

* chore: use separator tags

* chore: refactor use of metadata-action

* test: disable push

* chore: Add env `DOCKER_BUILD_NO_SUMMARY: true`

* chore: Use flavor for `latest` tag

* chore: Enable push of docker images to DockerHub
This commit is contained in:
Akash Jain 2024-06-27 18:40:06 +05:30 committed by GitHub
parent 47a13e27cf
commit 06d2967a80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 83 additions and 53 deletions

View File

@ -16,6 +16,8 @@ inputs:
description: true if we are building an Ingestion image, false otherwise description: true if we are building an Ingestion image, false otherwise
required: true required: true
default: "false" default: "false"
release_version:
description: OpenMetadata Release Version
dockerhub_username: dockerhub_username:
description: Dockerhub Username description: Dockerhub Username
required: true required: true
@ -26,19 +28,19 @@ inputs:
outputs: outputs:
tags: tags:
description: Generated Docker Tags description: Generated Docker Tags
value: ${{ steps.generate-tags.outputs.tags }} value: ${{ steps.meta.outputs.tags }}
runs: runs:
using: composite using: composite
steps: steps:
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v3
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
username: ${{ inputs.dockerhub_username }} username: ${{ inputs.dockerhub_username }}
password: ${{ inputs.dockerhub_token }} password: ${{ inputs.dockerhub_token }}
@ -59,12 +61,15 @@ runs:
sudo make install_antlr_cli sudo make install_antlr_cli
make install_dev generate make install_dev generate
- name: Process Docker Tags - name: Docker Meta
id: generate-tags id: meta
shell: bash uses: docker/metadata-action@v5
run: | with:
if ${{ inputs.push_latest == 'true' }}; then flavor:
echo "tags=${{ inputs.image }}:${{ inputs.tag }},${{ inputs.image }}:latest" >> $GITHUB_OUTPUT latest=${{ inputs.push_latest }}
else images: |
echo "tags=${{ inputs.image }}:${{ inputs.tag }}" >> $GITHUB_OUTPUT ${{ inputs.image }}
fi sep-tags: ','
tags: |
type=raw,value=${{ inputs.release_version }},enable=${{ inputs.is_ingestion }}
type=raw,${{ inputs.tag }}

View File

@ -13,8 +13,8 @@ name: docker-openmetadata-db docker
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
tag: docker_release_tag:
description: "Input tag" description: "OpenMetadata MySQL Docker Image Tag"
required: true required: true
push_latest_tag_to_release: push_latest_tag_to_release:
description: "Do you want to update docker image latest tag as well ?" description: "Do you want to update docker image latest tag as well ?"
@ -26,21 +26,23 @@ jobs:
steps: steps:
- name: Check out the Repo - name: Check out the Repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Prepare for Docker Build&Push - name: Prepare for Docker Build&Push
id: prepare id: prepare
uses: ./.github/actions/prepare-for-docker-build-and-push uses: ./.github/actions/prepare-for-docker-build-and-push
with: with:
image: openmetadata/db image: openmetadata/db
tag: ${{ inputs.tag }} tag: ${{ inputs.docker_release_tag }}
push_latest: ${{ inputs.push_latest_tag_to_release }} push_latest: ${{ inputs.push_latest_tag_to_release }}
dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }} dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }} dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }}
- name: Build and push if event is workflow_dispatch and input is checked - name: Build and push if event is workflow_dispatch and input is checked
uses: docker/build-push-action@v3 uses: docker/build-push-action@v6
env:
DOCKER_BUILD_NO_SUMMARY: true
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64

View File

@ -13,8 +13,11 @@ name: docker-openmetadata-ingestion-base-slim docker
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
tag: docker_release_tag:
description: "Input tag" description: "Ingestion Base Slim Docker Image Tag"
required: true
release_version:
description: "Provide the Release Version"
required: true required: true
push_latest_tag_to_release: push_latest_tag_to_release:
description: "Do you want to update docker image latest tag as well ?" description: "Do you want to update docker image latest tag as well ?"
@ -26,21 +29,24 @@ jobs:
steps: steps:
- name: Check out the Repo - name: Check out the Repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Prepare for Docker Build&Push - name: Prepare for Docker Build&Push
id: prepare id: prepare
uses: ./.github/actions/prepare-for-docker-build-and-push uses: ./.github/actions/prepare-for-docker-build-and-push
with: with:
image: openmetadata/ingestion-base-slim image: openmetadata/ingestion-base-slim
tag: ${{ inputs.tag }} tag: ${{ inputs.docker_release_tag }}
push_latest: ${{ inputs.push_latest_tag_to_release }} push_latest: ${{ inputs.push_latest_tag_to_release }}
is_ingestion: true is_ingestion: true
release_version: ${{ inputs.release_version }}
dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }} dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }} dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }}
- name: Build and push if event is workflow_dispatch and input is checked - name: Build and push if event is workflow_dispatch and input is checked
uses: docker/build-push-action@v3 uses: docker/build-push-action@v6
env:
DOCKER_BUILD_NO_SUMMARY: true
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64

View File

@ -13,8 +13,11 @@ name: docker-openmetadata-ingestion-base docker
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
tag: docker_release_tag:
description: "Input tag" description: "Ingestion Base Docker Image Tag"
required: true
release_version:
description: "Provide the Release Version"
required: true required: true
push_latest_tag_to_release: push_latest_tag_to_release:
description: "Do you want to update docker image latest tag as well ?" description: "Do you want to update docker image latest tag as well ?"
@ -26,21 +29,24 @@ jobs:
steps: steps:
- name: Check out the Repo - name: Check out the Repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Prepare for Docker Build&Push - name: Prepare for Docker Build&Push
id: prepare id: prepare
uses: ./.github/actions/prepare-for-docker-build-and-push uses: ./.github/actions/prepare-for-docker-build-and-push
with: with:
image: openmetadata/ingestion-base image: openmetadata/ingestion-base
tag: ${{ inputs.tag }} tag: ${{ inputs.docker_release_tag }}
push_latest: ${{ inputs.push_latest_tag_to_release }} push_latest: ${{ inputs.push_latest_tag_to_release }}
is_ingestion: true is_ingestion: true
release_version: ${{ inputs.release_version }}
dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }} dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }} dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }}
- name: Build and push if event is workflow_dispatch and input is checked - name: Build and push if event is workflow_dispatch and input is checked
uses: docker/build-push-action@v3 uses: docker/build-push-action@v6
env:
DOCKER_BUILD_NO_SUMMARY: true
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64

View File

@ -13,11 +13,14 @@ name: docker-openmetadata-ingestion docker
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
tag: docker_release_tag:
description: "Input tag" description: "Ingestion Docker Image Tag"
required: true
release_version:
description: "Provide the Release Version"
required: true required: true
push_latest_tag_to_release: push_latest_tag_to_release:
description: "Do you want to update docker image latest tag as well ?" description: "Mark this as latest tag as well ?"
type: boolean type: boolean
jobs: jobs:
@ -26,21 +29,24 @@ jobs:
steps: steps:
- name: Check out the Repo - name: Check out the Repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Prepare for Docker Build&Push - name: Prepare for Docker Build&Push
id: prepare id: prepare
uses: ./.github/actions/prepare-for-docker-build-and-push uses: ./.github/actions/prepare-for-docker-build-and-push
with: with:
image: openmetadata/ingestion image: openmetadata/ingestion
tag: ${{ inputs.tag }} tag: ${{ inputs.docker_release_tag }}
push_latest: ${{ inputs.push_latest_tag_to_release }} push_latest: ${{ inputs.push_latest_tag_to_release }}
is_ingestion: true is_ingestion: true
release_version: ${{ inputs.release_version }}
dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }} dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }} dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }}
- name: Build and push if event is workflow_dispatch and input is checked - name: Build and push if event is workflow_dispatch and input is checked
uses: docker/build-push-action@v3 env:
DOCKER_BUILD_NO_SUMMARY: true
uses: docker/build-push-action@v6
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64

View File

@ -13,8 +13,8 @@ name: docker-openmetadata-postgres-db docker
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
tag: docker_release_tag:
description: "Input tag" description: "OpenMetadata PostgreSQL Docker Image Tag"
required: true required: true
push_latest_tag_to_release: push_latest_tag_to_release:
description: "Do you want to update docker image latest tag as well ?" description: "Do you want to update docker image latest tag as well ?"
@ -26,20 +26,22 @@ jobs:
steps: steps:
- name: Check out the Repo - name: Check out the Repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Prepare for Docker Build&Push - name: Prepare for Docker Build&Push
id: prepare id: prepare
uses: ./.github/actions/prepare-for-docker-build-and-push uses: ./.github/actions/prepare-for-docker-build-and-push
with: with:
image: openmetadata/postgresql image: openmetadata/postgresql
tag: ${{ inputs.tag }} tag: ${{ inputs.docker_release_tag }}
push_latest: ${{ inputs.push_latest_tag_to_release }} push_latest: ${{ inputs.push_latest_tag_to_release }}
dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }} dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }} dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }}
- name: Build and push if event is workflow_dispatch and input is checked - name: Build and push if event is workflow_dispatch and input is checked
uses: docker/build-push-action@v3 uses: docker/build-push-action@v6
env:
DOCKER_BUILD_NO_SUMMARY: true
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64

View File

@ -13,8 +13,8 @@ name: docker-openmetadata-server release app
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
DOCKER_RELEASE_TAG: docker_release_tag:
description: "Docker Release Tag" description: "Server Docker Image Tag"
required: true required: true
push_latest_tag_to_release: push_latest_tag_to_release:
description: "Do you want to update docker image latest tag as well ?" description: "Do you want to update docker image latest tag as well ?"
@ -25,10 +25,10 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Set up JDK 17 - name: Set up JDK 17
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
java-version: 17 java-version: 17
distribution: 'temurin' distribution: 'temurin'
@ -49,7 +49,7 @@ jobs:
mvn -DskipTests clean package mvn -DskipTests clean package
- name: Upload OpenMetadata application to Artifact - name: Upload OpenMetadata application to Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: openmetadata-binary name: openmetadata-binary
path: /home/runner/work/OpenMetadata/OpenMetadata/openmetadata-dist/target/*.tar.gz path: /home/runner/work/OpenMetadata/OpenMetadata/openmetadata-dist/target/*.tar.gz
@ -69,7 +69,7 @@ jobs:
echo "UPLOAD_URL=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/open-metadata/OpenMetadata/releases/tags/${{ inputs.DOCKER_RELEASE_TAG }}-release | jq .upload_url | tr -d '"' )" >> $GITHUB_OUTPUT echo "UPLOAD_URL=$(curl -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/open-metadata/OpenMetadata/releases/tags/${{ inputs.DOCKER_RELEASE_TAG }}-release | jq .upload_url | tr -d '"' )" >> $GITHUB_OUTPUT
- name: Download application from Artifact - name: Download application from Artifact
uses: actions/download-artifact@v2 uses: actions/download-artifact@v4
with: with:
name: openmetadata-binary name: openmetadata-binary
@ -86,27 +86,30 @@ jobs:
push_to_docker_hub: push_to_docker_hub:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }} if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
needs: [release-project-event-workflow_dispatch] needs: [ release-project-event-workflow_dispatch ]
steps: steps:
- name: Check out the Repo - name: Check out the Repo
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Set build arguments - name: Set build arguments
id: build-args
run: | run: |
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Prepare for Docker Build&Push - name: Prepare for Docker Build&Push
id: prepare id: prepare
uses: ./.github/actions/prepare-for-docker-build-and-push uses: ./.github/actions/prepare-for-docker-build-and-push
with: with:
image: openmetadata/server image: openmetadata/server
tag: ${{ inputs.DOCKER_RELEASE_TAG }} tag: ${{ inputs.docker_release_tag }}
push_latest: ${{ inputs.push_latest_tag_to_release }} push_latest: ${{ inputs.push_latest_tag_to_release }}
dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }} dockerhub_username: ${{ secrets.DOCKERHUB_OPENMETADATA_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }} dockerhub_token: ${{ secrets.DOCKERHUB_OPENMETADATA_TOKEN }}
- name: Build and push if event is workflow_dispatch and input is checked - name: Build and push if event is workflow_dispatch and input is checked
uses: docker/build-push-action@v3 uses: docker/build-push-action@v6
env:
DOCKER_BUILD_NO_SUMMARY: true
with: with:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
@ -114,5 +117,5 @@ jobs:
tags: ${{ steps.prepare.outputs.tags }} tags: ${{ steps.prepare.outputs.tags }}
file: ./docker/docker-compose-quickstart/Dockerfile file: ./docker/docker-compose-quickstart/Dockerfile
build-args: | build-args: |
BUILD_DATE=${{ env.BUILD_DATE }} BUILD_DATE=${{ steps.build-args.outputs.BUILD_DATE }}
COMMIT_ID=${{ env.github.sha }} COMMIT_ID=${{ github.sha }}