The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Fix Uberjar artifact reuse (#62109)
Nicolò Maria Mezzopera56e4ed86a39c
diff --git a/.github/actions/fetch-artifact/action.yml b/.github/actions/fetch-artifact/action.ymlindex df03997f1a3..e3524a78e40 100644--- a/.github/actions/fetch-artifact/action.yml+++ b/.github/actions/fetch-artifact/action.yml@@ -33,7 +33,7 @@ runs:});if (!artifacts.data?.artifacts?.[0]?.id) {- throw new Error(`No artifacts found for: ${{ inputs.name }}`);+ throw new Error(`No artifacts found for ${{ inputs.name }}`);}const artifact_id = artifacts.data.artifacts[0].id;@@ -47,53 +47,41 @@ runs:fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/mb.zip`, Buffer.from(download.data));- - name: unzip uberjar artifact- shell: bash- run: unzip mb.zip- - name: Process the Uberjar+ - name: Extract and rename JARshell: bashrun: | # bashOUTPUT_NAME="${{ inputs.output-name }}"EXTRACT_PATH="${{ inputs.extract-path }}"- # Function to determine the final JAR path- get_jar_path() {- if [ "$EXTRACT_PATH" == "." ]; then- echo "$OUTPUT_NAME"- else- echo "$EXTRACT_PATH/$OUTPUT_NAME"- fi- }-- # Create target directory if it doesn't exist- if [ "$EXTRACT_PATH" != "." ]; then- mkdir -p "$EXTRACT_PATH"- fi+ # Create a temporary directory for extraction to avoid conflicts+ TEMP_DIR=$(mktemp -d)++ # Extract to temporary directory+ unzip mb.zip -d "$TEMP_DIR"- # Find the source jar file- if [ -e "metabase.jar" ]; then- SOURCE_JAR="metabase.jar"- elif [ -e "target/uberjar/metabase.jar" ]; then- SOURCE_JAR="target/uberjar/metabase.jar"+ # Create target directory+ mkdir -p "$EXTRACT_PATH"++ # Find and move the jar to final location+ if [ -e "$TEMP_DIR/metabase.jar" ]; then+ mv "$TEMP_DIR/metabase.jar" "$EXTRACT_PATH/$OUTPUT_NAME"+ elif [ -e "$TEMP_DIR/target/uberjar/metabase.jar" ]; then+ mv "$TEMP_DIR/target/uberjar/metabase.jar" "$EXTRACT_PATH/$OUTPUT_NAME"else- echo "Could not find the metabase.jar file"+ echo "Could not find metabase.jar in extracted files"exit 1fi- # Get the target path- TARGET_PATH=$(get_jar_path)+ # Clean up temporary directory+ rm -rf "$TEMP_DIR"- # Move the jar if source and target differ- if [ "$SOURCE_JAR" == "$TARGET_PATH" ]; then- echo "Jar is already at the correct location: $TARGET_PATH"+ # Set the JAR_PATH environment variable+ if [ "$EXTRACT_PATH" == "." ]; then+ echo "JAR_PATH=$OUTPUT_NAME" >> $GITHUB_ENVelse- echo "Moving $SOURCE_JAR to $TARGET_PATH"- mv "$SOURCE_JAR" "$TARGET_PATH"+ echo "JAR_PATH=$EXTRACT_PATH/$OUTPUT_NAME" >> $GITHUB_ENVfi- # Export the path for subsequent steps- echo "JAR_PATH=$TARGET_PATH" >> $GITHUB_ENV-- name: Verify that this is a valid JAR fileshell: bashrun: |diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.ymlindex 0026a637fc4..7363c770ca6 100644--- a/.github/workflows/run-tests.yml+++ b/.github/workflows/run-tests.yml@@ -72,8 +72,6 @@ jobs:if: ${{ !cancelled() && !(needs.files-changed.outputs.documentation == 'true' && needs.files-changed.outputs.backend_all == 'false' && needs.files-changed.outputs.frontend_all == 'false' && needs.files-changed.outputs.e2e_all == 'false') }}uses: ./.github/workflows/uberjar.ymlsecrets: inherit- with:- source_changed: ${{ needs.files-changed.outputs.backend_all == 'true' || needs.files-changed.outputs.frontend_all == 'true' || needs.static-viz-files-changed.outputs.static_viz == 'true' }}backend-tests:if: ${{ !cancelled() }}diff --git a/.github/workflows/uberjar-containerize-labeled.yml b/.github/workflows/uberjar-containerize-labeled.ymlindex 87aa90c4453..f99fbdcc2a3 100644--- a/.github/workflows/uberjar-containerize-labeled.yml+++ b/.github/workflows/uberjar-containerize-labeled.yml@@ -13,8 +13,6 @@ jobs:if: ${{ github.event.label.name == 'build-docker-uberjar' }}uses: ./.github/workflows/uberjar.ymlsecrets: inherit- with:- source_changed: falsecontainerize:needs: [uberjar]diff --git a/.github/workflows/uberjar.yml b/.github/workflows/uberjar.ymlindex f987be50c9e..602b091c7c3 100644--- a/.github/workflows/uberjar.yml+++ b/.github/workflows/uberjar.yml@@ -4,7 +4,7 @@ name: Build Uberjar# or automatically for the listed branchesconcurrency:- group: uberjar-${{ github.ref }}+ group: uberjar-${{ github.event.inputs.commit || github.event.pull_request.head.sha || github.sha }}cancel-in-progress: falseon:@@ -27,11 +27,6 @@ on:commit:description: "Optional full-length commit SHA-1 hash"workflow_call:- inputs:- source_changed:- description: "Whether source code has changed"- type: boolean- default: truejobs:check-existing-artifacts:@@ -63,21 +58,20 @@ jobs:- name: Decide if build is neededid: deciderun: |- SOURCE_CHANGED="${{ inputs.source_changed == true }}"EE_EXISTS="${{ steps.check-ee.outcome == 'success' }}"OSS_EXISTS="${{ steps.check-oss.outcome == 'success' }}"- echo "Source changed: $SOURCE_CHANGED"echo "EE exists: $EE_EXISTS"echo "OSS exists: $OSS_EXISTS"- # Build if source changed OR artifacts don't exist- if [[ "$SOURCE_CHANGED" == "true" ]] || [[ "$EE_EXISTS" == "false" ]] || [[ "$OSS_EXISTS" == "false" ]]; then+ # Build only if artifacts don't exist for this commit hash+ # Since we build by hash, if artifacts exist for this hash, we don't need to rebuild+ if [[ "$EE_EXISTS" == "false" ]] || [[ "$OSS_EXISTS" == "false" ]]; thenSHOULD_BUILD="true"- echo "Will build: source_changed=$SOURCE_CHANGED, ee_exists=$EE_EXISTS, oss_exists=$OSS_EXISTS"+ echo "Will build: ee_exists=$EE_EXISTS, oss_exists=$OSS_EXISTS"elseSHOULD_BUILD="false"- echo "Skipping build: artifacts exist and no source changes"+ echo "Skipping build: artifacts exist for this commit hash"fiecho "should_build=$SHOULD_BUILD" >> $GITHUB_OUTPUT