@@ -305,7 +305,7 @@ jobs:
305305 overwrite : true
306306
307307 docker-default :
308- needs : [npm, cubestore_linux, native_linux]
308+ needs : [npm, cubestore_linux, native_linux, detect_branch ]
309309 name : Debian docker image
310310 runs-on : ${{ matrix.os }}
311311 strategy :
@@ -345,7 +345,11 @@ jobs:
345345 if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
346346 MINOR=${VERSION%.*}
347347 MAJOR=${MINOR%.*}
348- TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
348+ TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR}"
349+ fi
350+
351+ if [ "${{ needs['detect_branch'].outputs.is_master }}" = "true" ]; then
352+ TAGS="$TAGS,${DOCKER_IMAGE}:latest"
349353 fi
350354
351355 {
@@ -385,7 +389,7 @@ jobs:
385389 IMAGE_VERSION=${{ steps.prep.outputs.version }}
386390
387391 docker-debian-jdk :
388- needs : [npm, cubestore_linux, native_linux]
392+ needs : [npm, cubestore_linux, native_linux, detect_branch ]
389393 name : Debian with jdk docker image
390394 runs-on : ubuntu-24.04
391395 timeout-minutes : 30
@@ -420,11 +424,15 @@ jobs:
420424 if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
421425 MINOR=${VERSION%.*}
422426 MAJOR=${MINOR%.*}
423- TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR}-jdk,${DOCKER_IMAGE}:${MAJOR}-jdk,${DOCKER_IMAGE}:jdk "
427+ TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR}-jdk,${DOCKER_IMAGE}:${MAJOR}-jdk"
424428 elif [ "${{ github.event_name }}" = "push" ]; then
425429 TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}-jdk"
426430 fi
427431
432+ if [ "${{ needs['detect_branch'].outputs.is_master }}" = "true" ]; then
433+ TAGS="$TAGS,${DOCKER_IMAGE}:jdk"
434+ fi
435+
428436 {
429437 echo "version=${VERSION}"
430438 echo "tags=${TAGS}"
@@ -464,6 +472,7 @@ jobs:
464472 docker-cubestore :
465473 name : Cube Store Docker
466474 runs-on : ${{ matrix.os }}
475+ needs : [detect_branch]
467476 strategy :
468477 fail-fast : false
469478 matrix :
@@ -521,7 +530,11 @@ jobs:
521530 if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
522531 MINOR=${VERSION%.*}
523532 MAJOR=${MINOR%.*}
524- TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR}${{ matrix.postfix }},${DOCKER_IMAGE}:${MAJOR}${{ matrix.postfix }},${DOCKER_IMAGE}:${{ matrix.tag }}"
533+ TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR}${{ matrix.postfix }},${DOCKER_IMAGE}:${MAJOR}${{ matrix.postfix }}"
534+ fi
535+
536+ if [ "${{ needs['detect_branch'].outputs.is_master }}" = "true" ]; then
537+ TAGS="$TAGS,${DOCKER_IMAGE}:${{ matrix.tag }}"
525538 fi
526539
527540 {
@@ -744,7 +757,7 @@ jobs:
744757 name : Trigger test suites run
745758 runs-on : ubuntu-20.04
746759 needs : [docker-default]
747- timeout-minutes : 60
760+ timeout-minutes : 15
748761 steps :
749762 - name : Checkout
750763 uses : actions/checkout@v4
@@ -753,12 +766,71 @@ jobs:
753766 with :
754767 github-token : ${{ secrets.GH_TRIGGER_TOKEN }}
755768 script : |
769+ const prUrl = context.payload.pull_request ? context.payload.pull_request.html_url : '';
770+ const commitUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${context.sha}`;
771+
756772 await github.rest.actions.createWorkflowDispatch({
757773 owner: 'cubedevinc',
758774 repo: 'sql-api-test-suite',
759775 workflow_id: 'test_and_run_test_suites.yml',
760776 ref: 'main',
761777 inputs: {
762- 'cube-image': 'cubejs/cube:latest'
778+ 'cube-image': 'cubejs/cube:latest',
779+ 'source-repo': context.repo.repo,
780+ 'source-pr-url': prUrl,
781+ 'source-commit-url': commitUrl,
782+ 'initiator': '${{ github.actor }}'
783+ }
784+ })
785+
786+ detect_branch :
787+ runs-on : ubuntu-20.04
788+ outputs :
789+ is_master : ${{ steps.detect_branch.outputs.is_master }}
790+ branch : ${{ steps.detect_branch.outputs.branch }}
791+ steps :
792+ - name : Checkout
793+ uses : actions/checkout@v4
794+ - name : Detect branch name
795+ id : detect_branch
796+ env :
797+ EVENT_BASE_REF : ${{ github.event.base_ref || 'master' }}
798+ run : |
799+ BRANCH=${EVENT_BASE_REF#refs/heads/}
800+ echo "Detected branch: $BRANCH"
801+
802+ IS_MASTER=false
803+ if [ "$BRANCH" == "master" ]; then
804+ IS_MASTER=true
805+ fi
806+ echo "Detected is_master: $IS_MASTER"
807+
808+ echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
809+ echo "is_master=$IS_MASTER" >> "$GITHUB_OUTPUT"
810+
811+ trigger-repo-sync :
812+ name : Trigger runtime repo
813+ runs-on : ubuntu-20.04
814+ needs : [docker-default, detect_branch]
815+ timeout-minutes : 15
816+ steps :
817+ - name : Checkout
818+ uses : actions/checkout@v4
819+ - name : Trigger runtime
820+ uses : actions/github-script@v6
821+ with :
822+ github-token : ${{ secrets.GH_TRIGGER_TOKEN }}
823+ script : |
824+ const tagName = process.env.GITHUB_REF.replace('refs/tags/', '');
825+ const branchName = '${{ needs['detect_branch'].outputs.branch }}';
826+
827+ await github.rest.actions.createWorkflowDispatch({
828+ owner: 'cubedevinc',
829+ repo: 'cube-runtime',
830+ workflow_id: 'sync.yml',
831+ ref: 'master',
832+ inputs: {
833+ 'tag': tagName,
834+ 'branch': branchName,
763835 }
764836 })
0 commit comments