diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml
index 9b4179e31..c68cc16b4 100644
--- a/.github/workflows/pull-request-approved.yml
+++ b/.github/workflows/pull-request-approved.yml
@@ -6,11 +6,36 @@ on:
types: [ submitted ]
jobs:
- build:
- uses: ./.github/workflows/build-java-app-workflow.yml
-
+ calculate-xetabase-branch:
+ 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
+ with:
+ fetch-depth: '10'
+ ## This is important to avoid the error in the next step: "fatal: repository 'https://github.com/zetta-genomics/opencga-enterprise.git/' not found"
+ persist-credentials: false
+ - id: get_xetabase_branch
+ name: "Get current branch for Xetabase from target branch"
+ run: |
+ chmod +x ./.github/workflows/scripts/get-xetabase-branch.sh
+ echo "github.event.pull_request.base.ref: ${{ github.event.pull_request.base.ref }}"
+ echo "github.event.pull_request.head.ref: ${{ github.event.pull_request.head.ref }}"
+ echo "secrets.ZETTA_REPO_ACCESS_TOKEN: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}"
+ 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
+ env:
+ ZETTA_REPO_ACCESS_TOKEN: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}
+
test:
name: "Run all tests before merging"
- uses: ./.github/workflows/test-analysis.yml
- needs: build
+ needs: calculate-xetabase-branch
+ uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@develop
+ with:
+ branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }}
+ task: ${{ github.event.pull_request.head.ref }}
secrets: inherit
\ No newline at end of file
diff --git a/.github/workflows/scripts/get-xetabase-branch.sh b/.github/workflows/scripts/get-xetabase-branch.sh
new file mode 100644
index 000000000..be89ffbf2
--- /dev/null
+++ b/.github/workflows/scripts/get-xetabase-branch.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+set -e
+set -x
+# Function to calculate the corresponding branch of Xetabase project
+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://$ZETTA_REPO_ACCESS_TOKEN@github.com/zetta-genomics/opencga-enterprise.git" "$input_branch" )" ] ; then
+ echo $input_branch;
+ return 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"
+ return 0
+ fi
+
+ # Check if the branch name starts with "release-" and follows the patterns "release-a.x.x" or "release-a.b.x"
+ if [[ "$input_branch" =~ ^release-([0-9]+)\.x\.x$ ]] || [[ "$input_branch" =~ ^release-([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
+}
+
+
+# Call the function with the input branch name
+get_xetabase_branch "$1"
diff --git a/.github/workflows/tmp-test-xetabase-branch.yml b/.github/workflows/tmp-test-xetabase-branch.yml
new file mode 100644
index 000000000..c10d99ec5
--- /dev/null
+++ b/.github/workflows/tmp-test-xetabase-branch.yml
@@ -0,0 +1,48 @@
+name: TMP test-xetabase-branch
+run-name: 'Pull request approve workflow ${{ github.event.pull_request.head.ref }} -> ${{ github.event.pull_request.base.ref }} by @${{ github.actor }}'
+
+on:
+ push:
+ branches:
+ - TASK-*
+
+
+jobs:
+ calculate-xetabase-branch:
+ 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
+ with:
+ fetch-depth: '10'
+ ## This is important to avoid the error in the next step: "fatal: repository 'https://github.com/zetta-genomics/opencga-enterprise.git/' not found"
+ persist-credentials: false
+ - id: get_xetabase_branch
+ name: "Get current branch for Xetabase from target branch"
+ run: |
+ if [ "$( git ls-remote https://$ZETTA_REPO_ACCESS_TOKEN@github.com/opencb/opencga.git "TASK-6879" )" ] ; then
+ echo "OPENCGA TASK-6879 branch";
+ fi
+
+ if [ "$( git ls-remote https://$ZETTA_REPO_ACCESS_TOKEN@github.com/zetta-genomics/opencga-enterprise.git "$input_branch" )" ] ; then
+ echo "Here it is TASK-6807 branch";
+ fi
+ chmod +x ./.github/workflows/scripts/get-xetabase-branch.sh
+ echo "secrets.ZETTA_REPO_ACCESS_TOKEN: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}" | tee -a ${GITHUB_STEP_SUMMARY}
+ xetabase_branch=$(./.github/workflows/scripts/get-xetabase-branch.sh "TASK-6879" )
+ echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY}
+ echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT
+ env:
+ ZETTA_REPO_ACCESS_TOKEN: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}
+
+ test:
+ name: "Run all tests before merging"
+ needs: calculate-xetabase-branch
+ uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@develop
+ with:
+ branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }}
+ task: TASK-6879
+ secrets: inherit
\ No newline at end of file
diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml
index ed5c139e5..f75e11a92 100644
--- a/commons-datastore/commons-datastore-core/pom.xml
+++ b/commons-datastore/commons-datastore-core/pom.xml
@@ -6,7 +6,7 @@
org.opencb.commons
commons-datastore
- 5.3.0-SNAPSHOT
+ 6.0.0-SNAPSHOT
../pom.xml
diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml
index 294dd6ec9..842daef6b 100644
--- a/commons-datastore/commons-datastore-mongodb/pom.xml
+++ b/commons-datastore/commons-datastore-mongodb/pom.xml
@@ -6,7 +6,7 @@
org.opencb.commons
commons-datastore
- 5.3.0-SNAPSHOT
+ 6.0.0-SNAPSHOT
../pom.xml
diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml
index a6d4bc14d..e178396a7 100644
--- a/commons-datastore/commons-datastore-solr/pom.xml
+++ b/commons-datastore/commons-datastore-solr/pom.xml
@@ -22,7 +22,7 @@
org.opencb.commons
commons-datastore
- 5.3.0-SNAPSHOT
+ 6.0.0-SNAPSHOT
../pom.xml
diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml
index db85378f8..1e503e66c 100644
--- a/commons-datastore/pom.xml
+++ b/commons-datastore/pom.xml
@@ -6,7 +6,7 @@
org.opencb.commons
commons
- 5.3.0-SNAPSHOT
+ 6.0.0-SNAPSHOT
../pom.xml
diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml
index b00de26c8..9147f9b33 100644
--- a/commons-lib/pom.xml
+++ b/commons-lib/pom.xml
@@ -6,7 +6,7 @@
org.opencb.commons
commons
- 5.3.0-SNAPSHOT
+ 6.0.0-SNAPSHOT
../pom.xml
diff --git a/pom.xml b/pom.xml
index 8a184d389..34df5f277 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
org.opencb.commons
commons
- 5.3.0-SNAPSHOT
+ 6.0.0-SNAPSHOT
pom
OpenCB commons project