From df70872e5d941c6a76327332103ebd9ac3044dc5 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 20 Jun 2024 12:07:42 +0200 Subject: [PATCH 01/39] test-xetabase-workflow.yml: New workflow to test xetabase on pullrequest approve of the libraries #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 93 ++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/test-xetabase-workflow.yml diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml new file mode 100644 index 000000000..49c4c2af0 --- /dev/null +++ b/.github/workflows/test-xetabase-workflow.yml @@ -0,0 +1,93 @@ +name: Pull request approve workflow + +on: + workflow_call: + inputs: + task: + type: string + required: true + branch: + type: string + required: true + +jobs: + test: + name: Execute JUnit and Jacoco tests + runs-on: ubuntu-22.04 + steps: + - name: Clone OpenCGA Enterprise branch '${{ github.event.inputs.branch }}' + uses: actions/checkout@v4 + with: + repository: zetta-genomics/opencga-enterprise + ref: ${{ github.event.inputs.branch }} + token: ${{ secrets.GH_PRIVATE_TOKEN }} + path: opencga-enterprise + fetch-depth: "10" + - id: get_opencga_branch + name: Get OpenCGA branch from 'pom.xml' property + run: | + pwd + chmod +x ./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh + opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh ${{ github.event.inputs.task }}) + echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT + - uses: actions/checkout@v4 + with: + repository: opencb/opencga + ref: ${{ steps.get_opencga_branch.outputs.opencga_branch }} + path: opencga + fetch-depth: '10' + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '8' + cache: 'maven' + - name: Install Samtools + run: sudo apt-get install samtools python3-deeptools + - name: Start MongoDB v6.0 + uses: supercharge/mongodb-github-action@1.8.0 + with: + mongodb-version: 6.0 + mongodb-replica-set: rs-test + - name: K8s Tunnel MongoDB + run: | + wget https://dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl + chmod +x ./kubectl + echo "${{ secrets.AZURE_KUBE_CONFIG }}" > admin.conf + ./kubectl -n cellbase-db port-forward services/cellbase-rs0-svc 27018:27017 --kubeconfig ./admin.conf & + - name: Install Azure AZCOPY + uses: kheiakiyama/install-azcopy-action@v1 + with: + version: 'v10' + - name: DockerHub login + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Run all OpenCB Junit tests, ie. java-common-libs, biodata, cellbase, opencga and opencga-enterprise + run: | + ln -s opencga opencga-enterprise/opencga-home + cd opencga-enterprise + ./build.sh -t -l runShortTests,runMediumTests,runLongTests -b -s -f -T ${{ github.event.inputs.task }} -c localhost:27018 -H hdp3.1 + - name: Upload reports results to Github + uses: actions/upload-artifact@v4 + with: + name: report-test + path: /home/runner/work/testing-environment/testing-environment/opencga-enterprise/reports/test + - name: Upload log + uses: actions/upload-artifact@v4 + with: + name: build-log + path: /home/runner/work/testing-environment/testing-environment/opencga-enterprise/build.log + - name: Upload junit reports to a remote scp server + uses: garygrossgarten/github-action-scp@release + with: + local: opencga-enterprise/reports/test + remote: /var/www/html/reports/xetabase/${{ github.event.inputs.task }}/ + host: ${{ secrets.SSH_TESTING_SERVER_HOST}} + port: ${{ secrets.SSH_TESTING_SERVER_PORT}} + username: ${{ secrets.SSH_TESTING_SERVER_USER }} + password: ${{ secrets.SSH_TESTING_SERVER_PASSWORD }} + concurrency: 2 + + From 3f2f4eb710dab9238ead39aee8d47a0a4213d652 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 20 Jun 2024 12:08:14 +0200 Subject: [PATCH 02/39] test-xetabase-workflow.yml: New workflow to test xetabase on pullrequest approve of the libraries #TASK-6399 --- .github/workflows/scripts/xetabase-branch.sh | 42 ++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/scripts/xetabase-branch.sh diff --git a/.github/workflows/scripts/xetabase-branch.sh b/.github/workflows/scripts/xetabase-branch.sh new file mode 100644 index 000000000..af17f7f12 --- /dev/null +++ b/.github/workflows/scripts/xetabase-branch.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Function to calculate the corresponding branch of Xetabase project +get_xetabase_branch() { + # Input parameter (branch name) + input_branch="$1" + + # Check if the branch name is "develop" in that case return the same branch name + if [[ "$input_branch" == "develop" ]]; then + echo "develop" + return 0 + fi + + # Check if the branch name starts with "release-" and follows the patterns "release-a.b.x" or "release-a.b.c.x" + if [[ "$input_branch" =~ ^release-([0-9]+)\.([0-9]+)\.x$ ]] || [[ "$input_branch" =~ ^release-([0-9]+)\.([0-9]+)\.([0-9]+)\.x$ ]]; then + # Extract the MAJOR part of the branch name + MAJOR=${BASH_REMATCH[1]} + # Calculate the XETABASE_MAJOR by subtracting 3 from MAJOR + XETABASE_MAJOR=$((MAJOR - 3)) + # Check if the XETABASE_MAJOR is negative + if (( XETABASE_MAJOR < 0 )); then + echo "Error: 'MAJOR' digit after subtraction results in a negative number." + return 1 + fi + # Construct and echo the new branch name + echo "release-$XETABASE_MAJOR.${input_branch#release-$MAJOR.}" + return 0 + fi + + # If the branch name does not match any of the expected patterns + echo "Error: The branch name is not correct." + return 1 +} + +# Check if the script receives exactly one argument +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +# Call the function with the input branch name +get_xetabase_branch "$1" From 37bfcd14022f33c5f23b6b449148709935f409bd Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 20 Jun 2024 12:09:42 +0200 Subject: [PATCH 03/39] test-xetabase-workflow.yml: Modify pull_request approve workflow to test all Xetabase instead only jcl #TASK-6399 --- .github/workflows/pull-request-approved.yml | 22 ++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 329df1be1..c20e61c90 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -5,11 +5,19 @@ on: types: [ submitted ] jobs: - build: - uses: ./.github/workflows/build-java-app-workflow.yml - test: - name: "Run all tests before merging" - uses: ./.github/workflows/test-analysis.yml - needs: build - secrets: inherit \ No newline at end of file + name: Execute JUnit and Jacoco tests + runs-on: ubuntu-22.04 + steps: + - id: get_xetabase_branch + name: Get current branch for Xetabase from 'pom.xml' property + run: | + chmod +x ./.github/workflows/scripts/xetabase-branch.sh + xetabase_branch=$(./.github/workflows/scripts/xetabase-branch.sh ${{ github.event.pull_request.base.ref }} + echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY} + echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT + - name: "Run all tests before merging" + uses: ./.github/workflows/test-xetabase-workflow.yml + with: + branch: ${{ steps.get_xetabase_branch.outputs.xetabase_branch }} + task: ${{ github.event.pull_request.head.ref }} \ No newline at end of file From f930213af02064275854e38a3665f4167f0644bf Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 20 Jun 2024 12:31:42 +0200 Subject: [PATCH 04/39] cicd:clone jcl to exec script in pull request approve #TASK-6399 --- .github/workflows/pull-request-approved.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index c20e61c90..ecc007801 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -9,6 +9,8 @@ jobs: name: Execute JUnit and Jacoco tests runs-on: ubuntu-22.04 steps: + - name: Clone java-common-libs + uses: actions/checkout@v4 - id: get_xetabase_branch name: Get current branch for Xetabase from 'pom.xml' property run: | From 9b2e5cf79cc6a5263e05a88da1235d0d0125420f Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 20 Jun 2024 12:34:25 +0200 Subject: [PATCH 05/39] cicd: fix parenthesi #TASK-6399 --- .github/workflows/pull-request-approved.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index ecc007801..7f80bfed0 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -15,7 +15,7 @@ jobs: name: Get current branch for Xetabase from 'pom.xml' property run: | chmod +x ./.github/workflows/scripts/xetabase-branch.sh - xetabase_branch=$(./.github/workflows/scripts/xetabase-branch.sh ${{ github.event.pull_request.base.ref }} + xetabase_branch=$(./.github/workflows/scripts/xetabase-branch.sh ${{ github.event.pull_request.base.ref }}) echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY} echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT - name: "Run all tests before merging" From b5149297841333bdab23748264999675dbf72df9 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 20 Jun 2024 13:00:11 +0200 Subject: [PATCH 06/39] cicd: debug ./.github/workflows/ #TASK-6399 --- .github/workflows/pull-request-approved.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 7f80bfed0..36defafab 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -11,10 +11,14 @@ jobs: steps: - name: Clone java-common-libs uses: actions/checkout@v4 + with: + fetch-depth: '10' - id: get_xetabase_branch - name: Get current branch for Xetabase from 'pom.xml' property + name: "Get current branch for Xetabase from 'pom.xml' property" run: | chmod +x ./.github/workflows/scripts/xetabase-branch.sh + ls ./.github/workflows/scripts/ + ls ./.github/workflows/ xetabase_branch=$(./.github/workflows/scripts/xetabase-branch.sh ${{ github.event.pull_request.base.ref }}) echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY} echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT From f8be19c4ec6154c7fe8ecc03394fb5acf9414531 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 09:42:26 +0200 Subject: [PATCH 07/39] CICD: Added ZETTA_REPO_ACCESS_TOKEN to co xetabase #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 49c4c2af0..fa78b2e24 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -1,4 +1,4 @@ -name: Pull request approve workflow +name: TEST Xetabase and publish report workflow on: workflow_call: @@ -20,7 +20,7 @@ jobs: with: repository: zetta-genomics/opencga-enterprise ref: ${{ github.event.inputs.branch }} - token: ${{ secrets.GH_PRIVATE_TOKEN }} + token: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }} path: opencga-enterprise fetch-depth: "10" - id: get_opencga_branch From 6cca2db321899bfe48e857b437de5b242a9d3a32 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 09:57:54 +0200 Subject: [PATCH 08/39] cicd: Temporal workflow_dispatch for PR to tests #TASK-6399 --- .github/workflows/pull-request-approved.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 36defafab..de45af750 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -1,6 +1,7 @@ name: Pull request approve workflow on: + workflow_dispatch: pull_request_review: types: [ submitted ] From 1aa53aa3a12df7d065c2574b246e2b91db435ae7 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 09:59:05 +0200 Subject: [PATCH 09/39] cicd: Delete Temporal workflow_dispatch for PR to tests #TASK-6399 --- .github/workflows/pull-request-approved.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index de45af750..36defafab 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -1,7 +1,6 @@ name: Pull request approve workflow on: - workflow_dispatch: pull_request_review: types: [ submitted ] From e29adf1e6c06ad520b56c947e4fa6308a84f822d Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 10:07:45 +0200 Subject: [PATCH 10/39] cicd: Temporal call to TASK-6399 yml #TASK-6399 --- .github/workflows/pull-request-approved.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 36defafab..1ee5a1419 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -23,7 +23,7 @@ jobs: echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY} echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT - name: "Run all tests before merging" - uses: ./.github/workflows/test-xetabase-workflow.yml + uses: ./.github/workflows/test-xetabase-workflow.yml@TASK-6399 with: branch: ${{ steps.get_xetabase_branch.outputs.xetabase_branch }} task: ${{ github.event.pull_request.head.ref }} \ No newline at end of file From 55e0c2f25e0c418453b718a1e42e3de62a1f9919 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 10:11:00 +0200 Subject: [PATCH 11/39] cicd: Temporal call to TASK-6399 yml #TASK-6399 --- .github/workflows/pull-request-approved.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 1ee5a1419..4169383cf 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -23,7 +23,7 @@ jobs: echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY} echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT - name: "Run all tests before merging" - uses: ./.github/workflows/test-xetabase-workflow.yml@TASK-6399 + uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@TASK-6399 with: branch: ${{ steps.get_xetabase_branch.outputs.xetabase_branch }} task: ${{ github.event.pull_request.head.ref }} \ No newline at end of file From 2083020f3b2ed2035d264a8dcff845d6127b47a2 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 10:43:16 +0200 Subject: [PATCH 12/39] create workflow in develop to test xetabase #TASK-6399 --- .github/workflows/pull-request-approved.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 4169383cf..609bec4ac 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -1,4 +1,5 @@ name: Pull request approve workflow +run-name: 'Pull request approve workflow ${{ github.event.pull_request.head.ref }} -> ${{ github.event.pull_request.base.ref }} by @${{ github.actor }}' on: pull_request_review: From e0d260146f9c5f8e655d1c7be7c8151ccf190121 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 10:52:58 +0200 Subject: [PATCH 13/39] Separate in two jobs to run the tests #TASK-6399 --- .github/workflows/pull-request-approved.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 609bec4ac..f5c6d8a6d 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -6,7 +6,7 @@ on: types: [ submitted ] jobs: - test: + calculate-xetabase-branch: name: Execute JUnit and Jacoco tests runs-on: ubuntu-22.04 steps: @@ -15,7 +15,7 @@ jobs: with: fetch-depth: '10' - id: get_xetabase_branch - name: "Get current branch for Xetabase from 'pom.xml' property" + name: "Get current branch for Xetabase from target branch" run: | chmod +x ./.github/workflows/scripts/xetabase-branch.sh ls ./.github/workflows/scripts/ @@ -23,8 +23,11 @@ jobs: xetabase_branch=$(./.github/workflows/scripts/xetabase-branch.sh ${{ github.event.pull_request.base.ref }}) echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY} echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT - - name: "Run all tests before merging" - uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@TASK-6399 - with: - branch: ${{ steps.get_xetabase_branch.outputs.xetabase_branch }} - task: ${{ github.event.pull_request.head.ref }} \ No newline at end of file + + test: + name: "Run all tests before merging" + needs: calculate-xetabase-branch + uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@TASK-6399 + with: + branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }} + task: ${{ github.event.pull_request.head.ref }} \ No newline at end of file From 606b93ef03e0d71e161e07f80f8cc509ba18b6a1 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 11:01:43 +0200 Subject: [PATCH 14/39] cicd secrets: inherit #TASK-6399 --- .github/workflows/pull-request-approved.yml | 3 ++- .github/workflows/test-xetabase-workflow.yml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index f5c6d8a6d..e02607698 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -30,4 +30,5 @@ jobs: uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@TASK-6399 with: branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }} - task: ${{ github.event.pull_request.head.ref }} \ No newline at end of file + task: ${{ github.event.pull_request.head.ref }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index fa78b2e24..12e8504ab 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -15,6 +15,10 @@ jobs: name: Execute JUnit and Jacoco tests runs-on: ubuntu-22.04 steps: + - name: Log inputs + run: | + echo "__OpenCGA-enterprise branch:__ \"${{ github.event.inputs.branch }}\"" | tee -a $GITHUB_STEP_SUMMARY + echo "__Task to test:__ \"${{ github.event.inputs.task }}\"" | tee -a $GITHUB_STEP_SUMMARY - name: Clone OpenCGA Enterprise branch '${{ github.event.inputs.branch }}' uses: actions/checkout@v4 with: From 8014992836d93e82c259478a4c4301f2983627a6 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 12:34:23 +0200 Subject: [PATCH 15/39] cicd create outputs #TASK-6399 --- .github/workflows/pull-request-approved.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index e02607698..36baa148d 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -4,11 +4,17 @@ run-name: 'Pull request approve workflow ${{ github.event.pull_request.head.ref on: pull_request_review: types: [ submitted ] + outputs: + version: + description: "XetaBase branch to test" + value: ${{ jobs.calculate-xetabase-branch.outputs.xetabase_branch }} jobs: calculate-xetabase-branch: - name: Execute JUnit and Jacoco tests + name: Calculate Xetabase branch runs-on: ubuntu-22.04 + outputs: + xetabase_branch: ${{ steps.get_xetabase_branch.outputs.xetabase_branch }} steps: - name: Clone java-common-libs uses: actions/checkout@v4 @@ -23,7 +29,7 @@ jobs: xetabase_branch=$(./.github/workflows/scripts/xetabase-branch.sh ${{ github.event.pull_request.base.ref }}) echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY} echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT - + test: name: "Run all tests before merging" needs: calculate-xetabase-branch From 8c8cf8c95c09c06fbc93a0eeb521db94add3716c Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 12:38:14 +0200 Subject: [PATCH 16/39] cicd check bash --version #TASK-6399 --- .github/workflows/pull-request-approved.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 36baa148d..8a32022fa 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -26,6 +26,7 @@ jobs: chmod +x ./.github/workflows/scripts/xetabase-branch.sh ls ./.github/workflows/scripts/ ls ./.github/workflows/ + bash --version xetabase_branch=$(./.github/workflows/scripts/xetabase-branch.sh ${{ github.event.pull_request.base.ref }}) echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY} echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT From f6719a7a5ff185936fbdbeb759c0c25f19b67683 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 12:39:55 +0200 Subject: [PATCH 17/39] cicd check bash --version #TASK-6399 --- .github/workflows/pull-request-approved.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 8a32022fa..93efbc861 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -4,10 +4,6 @@ run-name: 'Pull request approve workflow ${{ github.event.pull_request.head.ref on: pull_request_review: types: [ submitted ] - outputs: - version: - description: "XetaBase branch to test" - value: ${{ jobs.calculate-xetabase-branch.outputs.xetabase_branch }} jobs: calculate-xetabase-branch: From 26914c71e137a412432514661fc15abde6291476 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 13:25:31 +0200 Subject: [PATCH 18/39] cicd: remove github.event. in inputs #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 12e8504ab..6fceeaa54 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -17,13 +17,13 @@ jobs: steps: - name: Log inputs run: | - echo "__OpenCGA-enterprise branch:__ \"${{ github.event.inputs.branch }}\"" | tee -a $GITHUB_STEP_SUMMARY - echo "__Task to test:__ \"${{ github.event.inputs.task }}\"" | tee -a $GITHUB_STEP_SUMMARY - - name: Clone OpenCGA Enterprise branch '${{ github.event.inputs.branch }}' + echo "__OpenCGA-enterprise branch:__ \"${{ inputs.branch }}\"" | tee -a $GITHUB_STEP_SUMMARY + echo "__Task to test:__ \"${{ inputs.task }}\"" | tee -a $GITHUB_STEP_SUMMARY + - name: Clone OpenCGA Enterprise branch '${{ inputs.branch }}' uses: actions/checkout@v4 with: repository: zetta-genomics/opencga-enterprise - ref: ${{ github.event.inputs.branch }} + ref: ${{ inputs.branch }} token: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }} path: opencga-enterprise fetch-depth: "10" @@ -32,7 +32,7 @@ jobs: run: | pwd chmod +x ./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh - opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh ${{ github.event.inputs.task }}) + opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh ${{ inputs.task }}) echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT - uses: actions/checkout@v4 with: @@ -72,7 +72,7 @@ jobs: run: | ln -s opencga opencga-enterprise/opencga-home cd opencga-enterprise - ./build.sh -t -l runShortTests,runMediumTests,runLongTests -b -s -f -T ${{ github.event.inputs.task }} -c localhost:27018 -H hdp3.1 + ./build.sh -t -l runShortTests,runMediumTests,runLongTests -b -s -f -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1 - name: Upload reports results to Github uses: actions/upload-artifact@v4 with: @@ -87,7 +87,7 @@ jobs: uses: garygrossgarten/github-action-scp@release with: local: opencga-enterprise/reports/test - remote: /var/www/html/reports/xetabase/${{ github.event.inputs.task }}/ + remote: /var/www/html/reports/xetabase/${{ inputs.task }}/ host: ${{ secrets.SSH_TESTING_SERVER_HOST}} port: ${{ secrets.SSH_TESTING_SERVER_PORT}} username: ${{ secrets.SSH_TESTING_SERVER_USER }} From b4b7a47f23852753aa7e82559227091d232a6c8b Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 13:41:16 +0200 Subject: [PATCH 19/39] cicd: workflow dispatch to test#TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 6fceeaa54..94782ae08 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -9,6 +9,16 @@ on: branch: type: string required: true + workflow_dispatch: + inputs: + task: + type: string + description: 'Task ID to be tested.' + required: true + branch: + type: string + description: 'Branch of opencga-enterprise to be tested and built.' + required: true jobs: test: From 39ec574b58d5b6b8d0023dd8fcea2ce499a33b3c Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 13:44:09 +0200 Subject: [PATCH 20/39] cicd: debug logs added #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 94782ae08..3cf699528 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -80,6 +80,11 @@ jobs: password: ${{ secrets.DOCKER_HUB_PASSWORD }} - name: Run all OpenCB Junit tests, ie. java-common-libs, biodata, cellbase, opencga and opencga-enterprise run: | + pwd + ls -lrtha + echo "------------------------------------" + ls -lrtha /home/runner/work/java-common-libs/java-common-libs + echo "------------------------------------" ln -s opencga opencga-enterprise/opencga-home cd opencga-enterprise ./build.sh -t -l runShortTests,runMediumTests,runLongTests -b -s -f -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1 From 3bea1075a79d7b0c305c3e6cb1212988282cc7b1 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 13:49:39 +0200 Subject: [PATCH 21/39] cicd: debug logs added #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 3cf699528..7b14f4829 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -83,10 +83,13 @@ jobs: pwd ls -lrtha echo "------------------------------------" - ls -lrtha /home/runner/work/java-common-libs/java-common-libs - echo "------------------------------------" - ln -s opencga opencga-enterprise/opencga-home cd opencga-enterprise + pwd + ls -lrtha + echo "------------------------------------" + ln -s ../opencga opencga-home + echo "------------------------------------" + ls -lrtha ./build.sh -t -l runShortTests,runMediumTests,runLongTests -b -s -f -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1 - name: Upload reports results to Github uses: actions/upload-artifact@v4 From ae6267643cf5cc16b6e5fd4953f74af94b565e67 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 25 Jun 2024 13:53:17 +0200 Subject: [PATCH 22/39] cicd: debug logs added #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 7b14f4829..54e684b5b 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -9,16 +9,16 @@ on: branch: type: string required: true - workflow_dispatch: - inputs: - task: - type: string - description: 'Task ID to be tested.' - required: true - branch: - type: string - description: 'Branch of opencga-enterprise to be tested and built.' - required: true +# workflow_dispatch: +# inputs: +# task: +# type: string +# description: 'Task ID to be tested.' +# required: true +# branch: +# type: string +# description: 'Branch of opencga-enterprise to be tested and built.' +# required: true jobs: test: From 6a7eee58003057ef8f4658639533008cf15be168 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 28 Jun 2024 10:04:47 +0200 Subject: [PATCH 23/39] cicd: Test level short to fast test upload to report server #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 54e684b5b..6f9636314 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -90,7 +90,8 @@ jobs: ln -s ../opencga opencga-home echo "------------------------------------" ls -lrtha - ./build.sh -t -l runShortTests,runMediumTests,runLongTests -b -s -f -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1 + #./build.sh -t -l runShortTests,runMediumTests,runLongTests -b -s -f -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1 + ./build.sh -t -l runShortTests -b -s -f -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1 - name: Upload reports results to Github uses: actions/upload-artifact@v4 with: From d5b4f38f6164c9684b87157149b972f304efffe3 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 28 Jun 2024 10:19:20 +0200 Subject: [PATCH 24/39] cicd: Uncomment workflow_dispatch Test level short to fast test upload to report server #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 6f9636314..f0f56f3f7 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -9,16 +9,16 @@ on: branch: type: string required: true -# workflow_dispatch: -# inputs: -# task: -# type: string -# description: 'Task ID to be tested.' -# required: true -# branch: -# type: string -# description: 'Branch of opencga-enterprise to be tested and built.' -# required: true + workflow_dispatch: + inputs: + task: + type: string + description: 'Task ID to be tested.' + required: true + branch: + type: string + description: 'Branch of opencga-enterprise to be tested and built.' + required: true jobs: test: From 5bb1d4c55600a2c0ccd564e3bbda50812c254036 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 28 Jun 2024 12:17:23 +0200 Subject: [PATCH 25/39] cicd: fix paths to upload artifacts #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index eab1f53ee..f0e5ad1df 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -103,12 +103,12 @@ jobs: uses: actions/upload-artifact@v4 with: name: report-test - path: /home/runner/work/testing-environment/testing-environment/opencga-enterprise/reports/test + path: /home/runner/work/java-common-libs/java-common-libs/opencga-enterprise/reports/test - name: Upload log uses: actions/upload-artifact@v4 with: name: build-log - path: /home/runner/work/testing-environment/testing-environment/opencga-enterprise/build.log + path: /home/runner/work/java-common-libs/java-common-libs/opencga-enterprise/build.log - name: Upload junit reports to a remote scp server uses: garygrossgarten/github-action-scp@release with: From d4ebf31452cd2c8caf33a0acb28ed96f79a38c71 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 28 Jun 2024 12:45:13 +0200 Subject: [PATCH 26/39] Added keeper passwords #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 34 ++++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index f0e5ad1df..57294ee6a 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -21,10 +21,7 @@ on: required: true env: - AZCOPY_SPA_CLIENT_SECRET: ${{ secrets.AZCOPY_SPA_CLIENT_SECRET }} AZCOPY_AUTO_LOGIN_TYPE: "SPN" - AZCOPY_SPA_APPLICATION_ID: ${{ secrets.AZCOPY_SPA_APPLICATION_ID }} - AZCOPY_TENANT_ID: ${{ secrets.AZCOPY_TENANT_ID }} jobs: @@ -32,6 +29,23 @@ jobs: name: Execute JUnit and Jacoco tests runs-on: ubuntu-22.04 steps: + - name: Retrieve secrets from Keeper + id: ksecrets + uses: Keeper-Security/ksm-action@master + with: + keeper-secret-config: ${{ secrets.KEEPER_SM_GH_OPENCB }} + secrets: | + AZCOPY_SPA_CLIENT_SECRET/field/Secret Value > env:AZCOPY_SPA_CLIENT_SECRET + AZCOPY_SPA_APPLICATION_ID/field/Secret Value > env:AZCOPY_SPA_APPLICATION_ID + AZCOPY_TENANT_ID/field/Secret Value > env:AZCOPY_TENANT_ID + #ZETTA_REPO_ACCESS_TOKEN/field/Secret Value > env:ZETTA_REPO_ACCESS_TOKEN + AZURE_KUBE_CONFIG/field/Secret Value > env:AZURE_KUBE_CONFIG + DOCKER_HUB_USER/field/Secret Value > env:DOCKER_HUB_USER + DOCKER_HUB_PASSWORD/field/Secret Value > env:DOCKER_HUB_PASSWORD + SSH_TESTING_SERVER_HOST/field/Secret Value > env:SSH_TESTING_SERVER_HOST + SSH_TESTING_SERVER_PORT/field/Secret Value > env:SSH_TESTING_SERVER_PORT + SSH_TESTING_SERVER_USER/field/Secret Value > env:SSH_TESTING_SERVER_USER + SSH_TESTING_SERVER_PASSWORD/field/Secret Value > env:SSH_TESTING_SERVER_PASSWORD - name: Log inputs run: | echo "__OpenCGA-enterprise branch:__ \"${{ inputs.branch }}\"" | tee -a $GITHUB_STEP_SUMMARY @@ -74,7 +88,7 @@ jobs: run: | wget https://dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl chmod +x ./kubectl - echo "${{ secrets.AZURE_KUBE_CONFIG }}" > admin.conf + echo "${{ env.AZURE_KUBE_CONFIG }}" > admin.conf ./kubectl -n cellbase-db port-forward services/cellbase-rs0-svc 27018:27017 --kubeconfig ./admin.conf & - name: Install Azure AZCOPY uses: kheiakiyama/install-azcopy-action@v1 @@ -83,8 +97,8 @@ jobs: - name: DockerHub login uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_HUB_USER }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} + username: ${{ env.DOCKER_HUB_USER }} + password: ${{ env.DOCKER_HUB_PASSWORD }} - name: Run all OpenCB Junit tests, ie. java-common-libs, biodata, cellbase, opencga and opencga-enterprise run: | pwd @@ -114,10 +128,10 @@ jobs: with: local: opencga-enterprise/reports/test remote: /var/www/html/reports/xetabase/${{ inputs.task }}/ - host: ${{ secrets.SSH_TESTING_SERVER_HOST}} - port: ${{ secrets.SSH_TESTING_SERVER_PORT}} - username: ${{ secrets.SSH_TESTING_SERVER_USER }} - password: ${{ secrets.SSH_TESTING_SERVER_PASSWORD }} + host: ${{ env.SSH_TESTING_SERVER_HOST}} + port: ${{ env.SSH_TESTING_SERVER_PORT}} + username: ${{ env.SSH_TESTING_SERVER_USER }} + password: ${{ env.SSH_TESTING_SERVER_PASSWORD }} concurrency: 2 From df6f77b2ffe82780c8ccf33bdbf74fd128bc3676 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 28 Jun 2024 12:50:53 +0200 Subject: [PATCH 27/39] Added keeper passwords #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 57294ee6a..afa045211 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -38,7 +38,6 @@ jobs: AZCOPY_SPA_CLIENT_SECRET/field/Secret Value > env:AZCOPY_SPA_CLIENT_SECRET AZCOPY_SPA_APPLICATION_ID/field/Secret Value > env:AZCOPY_SPA_APPLICATION_ID AZCOPY_TENANT_ID/field/Secret Value > env:AZCOPY_TENANT_ID - #ZETTA_REPO_ACCESS_TOKEN/field/Secret Value > env:ZETTA_REPO_ACCESS_TOKEN AZURE_KUBE_CONFIG/field/Secret Value > env:AZURE_KUBE_CONFIG DOCKER_HUB_USER/field/Secret Value > env:DOCKER_HUB_USER DOCKER_HUB_PASSWORD/field/Secret Value > env:DOCKER_HUB_PASSWORD From 8c9f95802cdcd658edcc091ef7146212db0f8237 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 1 Jul 2024 11:31:44 +0200 Subject: [PATCH 28/39] cicd: Remove absolute references in Path #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index afa045211..459768a62 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -116,12 +116,12 @@ jobs: uses: actions/upload-artifact@v4 with: name: report-test - path: /home/runner/work/java-common-libs/java-common-libs/opencga-enterprise/reports/test + path: ./opencga-enterprise/reports/test - name: Upload log uses: actions/upload-artifact@v4 with: name: build-log - path: /home/runner/work/java-common-libs/java-common-libs/opencga-enterprise/build.log + path: ./opencga-enterprise/build.log - name: Upload junit reports to a remote scp server uses: garygrossgarten/github-action-scp@release with: From 2b5ccecda260326ae715ad249f64dc244a1c4d08 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 1 Jul 2024 17:15:39 +0200 Subject: [PATCH 29/39] Added get-xetabase-branch.sh #TASK-6399 --- .github/workflows/pull-request-approved.yml | 2 +- .../workflows/scripts/get-opencga-branch.sh | 44 +++++++++++++++++++ ...abase-branch.sh => get-xetabase-branch.sh} | 8 ++++ .github/workflows/test-xetabase-workflow.yml | 5 ++- 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/scripts/get-opencga-branch.sh rename .github/workflows/scripts/{xetabase-branch.sh => get-xetabase-branch.sh} (82%) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 93efbc861..5fdf66da6 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -23,7 +23,7 @@ jobs: ls ./.github/workflows/scripts/ ls ./.github/workflows/ bash --version - xetabase_branch=$(./.github/workflows/scripts/xetabase-branch.sh ${{ github.event.pull_request.base.ref }}) + xetabase_branch=$(./.github/workflows/scripts/get-xetabase-branch.sh ${{ github.event.pull_request.base.ref }}) echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY} echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/scripts/get-opencga-branch.sh b/.github/workflows/scripts/get-opencga-branch.sh new file mode 100644 index 000000000..29aa68712 --- /dev/null +++ b/.github/workflows/scripts/get-opencga-branch.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +## Navigate to the root folder where the pom.xml is +cd "$(dirname "$0")"/../../../ || exit 2 + +## Use the first argument passed as the branch. If it is not passed, I exit +if [[ -n $1 ]]; then + GIT_BRANCH=$1 +else + exit 2 +fi + +# If the branch exists in the opencga repository, I return it +if [ "$(git ls-remote https://github.com/opencb/opencga.git "$GIT_BRANCH" )" ] ; then + echo "$GIT_BRANCH"; + exit 0; +fi + +## Read the opencga version from the pom.xml +BUILD_VERSION=$(mvn help:evaluate -Dexpression=opencga.version -q -DforceStdout) + +## We remove the -SNAPSHOT if it exists +CLEAN_BUILD_VERSION=$(echo "$BUILD_VERSION" | cut -d "-" -f 1) + +## Read the numbers separately to compose the name of the branch +MAJOR=$(echo "$CLEAN_BUILD_VERSION" | cut -d "." -f 1) +MINOR=$(echo "$CLEAN_BUILD_VERSION" | cut -d "." -f 2) +PATCH=$(echo "$CLEAN_BUILD_VERSION" | cut -d "." -f 3) + +## it's a HOTFIX. Count the number of points to know if it is a hotfix +COUNT=$(echo "$CLEAN_BUILD_VERSION" | grep -o '\.' | wc -l ) +if [ "$COUNT" -gt 2 ]; then + echo "release-$MAJOR.$MINOR.$PATCH.x" + exit 0 +fi + +## It's develop branch +if [[ "$PATCH" == "0" ]]; then + echo "develop" + exit 0 +else #Is release branch + echo "release-$MAJOR.$MINOR.x" + exit 0 +fi \ No newline at end of file diff --git a/.github/workflows/scripts/xetabase-branch.sh b/.github/workflows/scripts/get-xetabase-branch.sh similarity index 82% rename from .github/workflows/scripts/xetabase-branch.sh rename to .github/workflows/scripts/get-xetabase-branch.sh index af17f7f12..0be5cb32d 100644 --- a/.github/workflows/scripts/xetabase-branch.sh +++ b/.github/workflows/scripts/get-xetabase-branch.sh @@ -5,6 +5,14 @@ get_xetabase_branch() { # Input parameter (branch name) input_branch="$1" + # If the branch begins with 'TASK' and exists in the opencga-enterprise repository, I return it + if [[ $input_branch == TASK* ]]; then + if [ "$(git ls-remote https://github.com/zetta-genomics/opencga-enterprise.git "$input_branch" )" ] ; then + echo "$GIT_BRANCH"; + exit 0; + fi + fi + # Check if the branch name is "develop" in that case return the same branch name if [[ "$input_branch" == "develop" ]]; then echo "develop" diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 459768a62..d332ec409 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -62,9 +62,10 @@ jobs: run: | pwd chmod +x ./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh - opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh ${{ inputs.task }}) + opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/get-opencga-branch.sh ${{ inputs.task }}) echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT - - uses: actions/checkout@v4 + - name: Clone OpenCGA branch '${{ steps.get_opencga_branch.outputs.opencga_branch }}' + uses: actions/checkout@v4 with: repository: opencb/opencga ref: ${{ steps.get_opencga_branch.outputs.opencga_branch }} From 7d6d051929a10ab8306d52494d9b617bdd7e0ef3 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 1 Jul 2024 17:24:30 +0200 Subject: [PATCH 30/39] Added remove get-opencga-branch.sh #TASK-6399 --- .../workflows/scripts/get-opencga-branch.sh | 44 ------------------- .github/workflows/test-xetabase-workflow.yml | 4 +- 2 files changed, 2 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/scripts/get-opencga-branch.sh diff --git a/.github/workflows/scripts/get-opencga-branch.sh b/.github/workflows/scripts/get-opencga-branch.sh deleted file mode 100644 index 29aa68712..000000000 --- a/.github/workflows/scripts/get-opencga-branch.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -## Navigate to the root folder where the pom.xml is -cd "$(dirname "$0")"/../../../ || exit 2 - -## Use the first argument passed as the branch. If it is not passed, I exit -if [[ -n $1 ]]; then - GIT_BRANCH=$1 -else - exit 2 -fi - -# If the branch exists in the opencga repository, I return it -if [ "$(git ls-remote https://github.com/opencb/opencga.git "$GIT_BRANCH" )" ] ; then - echo "$GIT_BRANCH"; - exit 0; -fi - -## Read the opencga version from the pom.xml -BUILD_VERSION=$(mvn help:evaluate -Dexpression=opencga.version -q -DforceStdout) - -## We remove the -SNAPSHOT if it exists -CLEAN_BUILD_VERSION=$(echo "$BUILD_VERSION" | cut -d "-" -f 1) - -## Read the numbers separately to compose the name of the branch -MAJOR=$(echo "$CLEAN_BUILD_VERSION" | cut -d "." -f 1) -MINOR=$(echo "$CLEAN_BUILD_VERSION" | cut -d "." -f 2) -PATCH=$(echo "$CLEAN_BUILD_VERSION" | cut -d "." -f 3) - -## it's a HOTFIX. Count the number of points to know if it is a hotfix -COUNT=$(echo "$CLEAN_BUILD_VERSION" | grep -o '\.' | wc -l ) -if [ "$COUNT" -gt 2 ]; then - echo "release-$MAJOR.$MINOR.$PATCH.x" - exit 0 -fi - -## It's develop branch -if [[ "$PATCH" == "0" ]]; then - echo "develop" - exit 0 -else #Is release branch - echo "release-$MAJOR.$MINOR.x" - exit 0 -fi \ No newline at end of file diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index d332ec409..411c0ee82 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -61,8 +61,8 @@ jobs: name: Get OpenCGA branch from 'pom.xml' property run: | pwd - chmod +x ./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh - opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/get-opencga-branch.sh ${{ inputs.task }}) + chmod +x ./opencga-enterprise/.github/workflows/scripts/opencga_branch.sh + opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/opencga_branch.sh false) echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT - name: Clone OpenCGA branch '${{ steps.get_opencga_branch.outputs.opencga_branch }}' uses: actions/checkout@v4 From 61b806a7df651eea18c891477ed97d5e4f3b83fd Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 1 Jul 2024 17:46:35 +0200 Subject: [PATCH 31/39] Added log summary step #TASK-6399 --- .github/workflows/pull-request-approved.yml | 5 +---- .github/workflows/test-xetabase-workflow.yml | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 5fdf66da6..d96c95627 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -19,10 +19,7 @@ jobs: - id: get_xetabase_branch name: "Get current branch for Xetabase from target branch" run: | - chmod +x ./.github/workflows/scripts/xetabase-branch.sh - ls ./.github/workflows/scripts/ - ls ./.github/workflows/ - bash --version + chmod +x ./.github/workflows/scripts/get-xetabase-branch.sh xetabase_branch=$(./.github/workflows/scripts/get-xetabase-branch.sh ${{ github.event.pull_request.base.ref }}) echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY} echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 411c0ee82..1dbfed69f 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -133,5 +133,10 @@ jobs: username: ${{ env.SSH_TESTING_SERVER_USER }} password: ${{ env.SSH_TESTING_SERVER_PASSWORD }} concurrency: 2 + - name: Log summary + run: | + cat ./opencga-enterprise/build.log | tee -a $GITHUB_STEP_SUMMARY + + From 1f896dcdcc3535a58951e414a421a717ccad45d9 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 1 Jul 2024 17:47:53 +0200 Subject: [PATCH 32/39] cicd: Removed test step in develop.yml #TASK-6399 --- .github/workflows/develop.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 196fc122b..f4d59ed60 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -10,11 +10,6 @@ jobs: build: uses: ./.github/workflows/build-java-app-workflow.yml - test: - uses: ./.github/workflows/test-analysis.yml - needs: build - secrets: inherit - deploy-maven: uses: ./.github/workflows/deploy-maven-repository-workflow.yml needs: test From af9e16d2ee192734fdc48769439c789e7e3ebab6 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 1 Jul 2024 21:12:50 +0200 Subject: [PATCH 33/39] cicd: Add debug outputs #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 1dbfed69f..3d01cf422 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -61,6 +61,8 @@ jobs: name: Get OpenCGA branch from 'pom.xml' property run: | pwd + ls -lrtha + ls -lrtha ./opencga-enterprise chmod +x ./opencga-enterprise/.github/workflows/scripts/opencga_branch.sh opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/opencga_branch.sh false) echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT From a0861c29c8afefd1665ca364f496efdef562f9cf Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 1 Jul 2024 21:15:24 +0200 Subject: [PATCH 34/39] cicd: delete param to opencga_branch #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 3d01cf422..0cc013038 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -64,7 +64,7 @@ jobs: ls -lrtha ls -lrtha ./opencga-enterprise chmod +x ./opencga-enterprise/.github/workflows/scripts/opencga_branch.sh - opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/opencga_branch.sh false) + opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/opencga_branch.sh) echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT - name: Clone OpenCGA branch '${{ steps.get_opencga_branch.outputs.opencga_branch }}' uses: actions/checkout@v4 From 9de5d3c998b7cf23d5e5a3777fc0d08d6ec885bf Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 1 Jul 2024 21:19:05 +0200 Subject: [PATCH 35/39] cicd: delete param to opencga_branch #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 0cc013038..c4e3e099d 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -65,6 +65,7 @@ jobs: ls -lrtha ./opencga-enterprise chmod +x ./opencga-enterprise/.github/workflows/scripts/opencga_branch.sh opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/opencga_branch.sh) + echo "opencga_branch=${opencga_branch}" echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT - name: Clone OpenCGA branch '${{ steps.get_opencga_branch.outputs.opencga_branch }}' uses: actions/checkout@v4 From 98d385234221b50c4d732c16ed13cc78bf3dcbc7 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 1 Jul 2024 21:24:32 +0200 Subject: [PATCH 36/39] cicd:call to xetabase-branch.sh #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index c4e3e099d..950c0b2f6 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -63,8 +63,8 @@ jobs: pwd ls -lrtha ls -lrtha ./opencga-enterprise - chmod +x ./opencga-enterprise/.github/workflows/scripts/opencga_branch.sh - opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/opencga_branch.sh) + chmod +x ./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh + opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh) echo "opencga_branch=${opencga_branch}" echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT - name: Clone OpenCGA branch '${{ steps.get_opencga_branch.outputs.opencga_branch }}' From 75536daaf8c52917cd82cd521221211441742c5c Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 2 Jul 2024 10:39:31 +0200 Subject: [PATCH 37/39] cicd: Change AZURE_KUBE_CONFIG to secrets #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 950c0b2f6..eab8d1c05 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -91,7 +91,7 @@ jobs: run: | wget https://dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl chmod +x ./kubectl - echo "${{ env.AZURE_KUBE_CONFIG }}" > admin.conf + echo "${{ secrets.AZURE_KUBE_CONFIG }}" > admin.conf ./kubectl -n cellbase-db port-forward services/cellbase-rs0-svc 27018:27017 --kubeconfig ./admin.conf & - name: Install Azure AZCOPY uses: kheiakiyama/install-azcopy-action@v1 From 3bfbf9a51afa6d13bd71f492b23aafb082e513f3 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 9 Jul 2024 15:32:54 +0200 Subject: [PATCH 38/39] Rename get-opencga-xetabase-branch.sh reference --- .github/workflows/test-xetabase-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index eab8d1c05..1dfcdc786 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -63,8 +63,8 @@ jobs: pwd ls -lrtha ls -lrtha ./opencga-enterprise - chmod +x ./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh - opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh) + chmod +x ./opencga-enterprise/.github/workflows/scripts/get-opencga-xetabase-branch.sh + opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/get-opencga-xetabase-branch.sh) echo "opencga_branch=${opencga_branch}" echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT - name: Clone OpenCGA branch '${{ steps.get_opencga_branch.outputs.opencga_branch }}' From 8431eb89a25088057483dc8690c07e59e0b5a08a Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Tue, 9 Jul 2024 15:32:54 +0200 Subject: [PATCH 39/39] cicd: Rename get-opencga-xetabase-branch.sh reference #TASK-6399 --- .github/workflows/test-xetabase-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index eab8d1c05..1dfcdc786 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -63,8 +63,8 @@ jobs: pwd ls -lrtha ls -lrtha ./opencga-enterprise - chmod +x ./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh - opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh) + chmod +x ./opencga-enterprise/.github/workflows/scripts/get-opencga-xetabase-branch.sh + opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/get-opencga-xetabase-branch.sh) echo "opencga_branch=${opencga_branch}" echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT - name: Clone OpenCGA branch '${{ steps.get_opencga_branch.outputs.opencga_branch }}'