MLH-1226 Handle add list/set property value methods #6878
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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. | |
# | |
name: Java CI with Maven | |
on: | |
push: | |
branches: | |
- beta | |
- master | |
- staging | |
- mlh-1226-denorm-attrs-push-kafka | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Print JDK version | |
run: java -version | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/build.sh') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Get branch name | |
run: | | |
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
echo BRANCH_NAME=${GITHUB_REF#refs/heads/} | |
- name: Create Maven Settings | |
uses: s4u/[email protected] | |
with: | |
servers: | | |
[{ | |
"id": "github", | |
"username": "atlan-ci", | |
"password": "${{ secrets.ORG_PAT_GITHUB }}" | |
}] | |
- name: Build with Maven | |
run: | | |
echo "build without dashboard" | |
chmod +x ./build.sh && ./build.sh | |
- name: Get Repository Name | |
run: echo "REPOSITORY_NAME=`echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//"`" >> $GITHUB_ENV | |
shell: bash | |
- name: Get version tag | |
# run: echo "##[set-output name=version;]$(echo `git ls-remote https://${{ secrets.ORG_PAT_GITHUB }}@github.com/atlanhq/${REPOSITORY_NAME}.git ${{ env.BRANCH_NAME }} | awk '{ print $1}' | cut -c1-7`)abcd" | |
run: | | |
echo "VERSION=$(git ls-remote https://${{ secrets.ORG_PAT_GITHUB }}@github.com/atlanhq/${REPOSITORY_NAME}.git ${{ env.BRANCH_NAME }} | awk '{ print $1}' | cut -c1-7 | head -n 1)abcd" | |
echo "VERSION=$(git ls-remote https://${{ secrets.ORG_PAT_GITHUB }}@github.com/atlanhq/${REPOSITORY_NAME}.git ${{ env.BRANCH_NAME }} | awk '{ print $1}' | cut -c1-7 | tr -d '[:space:]')abcd" | |
echo "VERSION=$(git ls-remote https://${{ secrets.ORG_PAT_GITHUB }}@github.com/atlanhq/${REPOSITORY_NAME}.git ${{ env.BRANCH_NAME }} | awk '{ print $1}' | cut -c1-7 | tr -d '[:space:]')abcd" >> $GITHUB_ENV | |
- name: Get commit ID | |
run: echo "COMMIT_ID=$(echo ${GITHUB_SHA} | cut -c1-7)abcd" >> $GITHUB_ENV | |
# QEMU is required to build arm from a non-arm build machine | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:qemu-v7.0.0-28 | |
platforms: arm64 | |
- name: Set up Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: $GITHUB_ACTOR | |
password: ${{ secrets.ORG_PAT_GITHUB }} | |
- name: Build and push with retry | |
id: docker_build | |
run: | | |
# Build and push with retry logic | |
echo "Building and pushing Docker image with retry mechanism..." | |
retry_count=0 | |
max_retries=3 | |
retry_delay=5 | |
while [ $retry_count -lt $max_retries ]; do | |
echo "Build and push attempt $((retry_count + 1)) of $max_retries" | |
if docker buildx build \ | |
--platform linux/amd64,linux/arm64 \ | |
--file ./Dockerfile \ | |
--no-cache \ | |
--sbom=true \ | |
--provenance=true \ | |
--push \ | |
--tag ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ env.BRANCH_NAME }}:latest \ | |
--tag ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ env.BRANCH_NAME }}:${{ env.COMMIT_ID }} \ | |
.; then | |
echo "Build and push successful!" | |
break | |
else | |
retry_count=$((retry_count + 1)) | |
if [ $retry_count -lt $max_retries ]; then | |
echo "Build and push failed. Retrying in $retry_delay seconds..." | |
sleep $retry_delay | |
else | |
echo "Build and push failed after $max_retries attempts. Exiting." | |
exit 1 | |
fi | |
fi | |
done | |
- name: Check Image Manifest | |
run: docker buildx imagetools inspect --raw ghcr.io/atlanhq/${{ github.event.repository.name }}-${{ env.BRANCH_NAME }}:${{ env.COMMIT_ID }} | |
- name: Scan Image | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: 'ubuntu:18.04' | |
vuln-type: 'os,library' | |
format: 'sarif' | |
output: 'trivy-image-results.sarif' | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/[email protected] | |
with: | |
sarif_file: 'trivy-image-results.sarif' |