Skip to content

Commit

Permalink
Merge branch 'release-3.2.x' into TASK-6324
Browse files Browse the repository at this point in the history
  • Loading branch information
jtarraga authored Aug 14, 2024
2 parents f77ca2e + cb26306 commit 8666ba9
Show file tree
Hide file tree
Showing 44 changed files with 1,346 additions and 1,197 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/pull-request-approved.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
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:
types: [submitted]
types: [ submitted ]

jobs:
build:
uses: opencb/java-common-libs/.github/workflows/build-java-app-workflow.yml@develop
with:
maven_opts: -Phdp3.1,RClient -Dopencga.war.name=opencga -Dcheckstyle.skip
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 project
uses: actions/checkout@v4
with:
fetch-depth: '10'
- id: get_xetabase_branch
name: "Get current branch for Xetabase from target branch"
run: |
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
test:
name: "Run all tests before merging, ie. short, medium and long tests."
uses: ./.github/workflows/test-analysis.yml
needs: build
name: "Run all tests before merging"
needs: calculate-xetabase-branch
uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@TASK-6399
with:
test_profile: runShortTests,runMediumTests,runLongTests
branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }}
task: ${{ github.event.pull_request.head.ref }}
secrets: inherit

50 changes: 50 additions & 0 deletions .github/workflows/scripts/get-xetabase-branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

# 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://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"
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 - 1))
# 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 <branch-name>"
exit 1
fi

# Call the function with the input branch name
get_xetabase_branch "$1"
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def get_method_definition(self, category, endpoint):
f'"{self.get_endpoint_subcategory()}"' if self.subcategory else "null",
self.get_endpoint_id2() if self.get_endpoint_id2() else "null",
f'"{self.get_endpoint_action()}"' if self.get_endpoint_action() else "null",
"data" if self.has_body() else False,
"data" if self.has_body() else ("null" if self.get_endpoint_method(endpoint).lower() == "post" else False),
query_string_params
] if s)
return (f' {self.get_method_doc(endpoint)}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ private RestResponse<ObjectMap> installCatalog() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), InstallationParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "secretKey",commandOptions.secretKey, true);
putNestedIfNotEmpty(beanParams, "password",commandOptions.password, true);
putNestedIfNotEmpty(beanParams, "email",commandOptions.email, true);
putNestedIfNotEmpty(beanParams, "secretKey", commandOptions.secretKey, true);
putNestedIfNotEmpty(beanParams, "password", commandOptions.password, true);
putNestedIfNotEmpty(beanParams, "email", commandOptions.email, true);

installationParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -161,7 +161,7 @@ private RestResponse<ObjectMap> jwtCatalog() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), JWTParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "secretKey",commandOptions.secretKey, true);
putNestedIfNotEmpty(beanParams, "secretKey", commandOptions.secretKey, true);

jWTParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand All @@ -186,11 +186,11 @@ private RestResponse<User> createUsers() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), UserCreateParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "id",commandOptions.id, true);
putNestedIfNotEmpty(beanParams, "name",commandOptions.name, true);
putNestedIfNotEmpty(beanParams, "email",commandOptions.email, true);
putNestedIfNotEmpty(beanParams, "password",commandOptions.password, true);
putNestedIfNotEmpty(beanParams, "organization",commandOptions.organization, true);
putNestedIfNotEmpty(beanParams, "id", commandOptions.id, true);
putNestedIfNotEmpty(beanParams, "name", commandOptions.name, true);
putNestedIfNotEmpty(beanParams, "email", commandOptions.email, true);
putNestedIfNotEmpty(beanParams, "password", commandOptions.password, true);
putNestedIfNotEmpty(beanParams, "organization", commandOptions.organization, true);

userCreateParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -219,11 +219,11 @@ private RestResponse<User> importUsers() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), UserImportParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "authenticationOriginId",commandOptions.authenticationOriginId, true);
putNestedIfNotNull(beanParams, "id",commandOptions.id, true);
putNestedIfNotNull(beanParams, "resourceType",commandOptions.resourceType, true);
putNestedIfNotEmpty(beanParams, "study",commandOptions.study, true);
putNestedIfNotEmpty(beanParams, "studyGroup",commandOptions.studyGroup, true);
putNestedIfNotEmpty(beanParams, "authenticationOriginId", commandOptions.authenticationOriginId, true);
putNestedIfNotNull(beanParams, "id", commandOptions.id, true);
putNestedIfNotNull(beanParams, "resourceType", commandOptions.resourceType, true);
putNestedIfNotEmpty(beanParams, "study", commandOptions.study, true);
putNestedIfNotEmpty(beanParams, "studyGroup", commandOptions.studyGroup, true);

userImportParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -287,12 +287,12 @@ private RestResponse<Group> syncUsers() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), GroupSyncParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "authenticationOriginId",commandOptions.authenticationOriginId, true);
putNestedIfNotEmpty(beanParams, "from",commandOptions.from, true);
putNestedIfNotEmpty(beanParams, "to",commandOptions.to, true);
putNestedIfNotEmpty(beanParams, "study",commandOptions.study, true);
putNestedIfNotNull(beanParams, "syncAll",commandOptions.syncAll, true);
putNestedIfNotNull(beanParams, "force",commandOptions.force, true);
putNestedIfNotEmpty(beanParams, "authenticationOriginId", commandOptions.authenticationOriginId, true);
putNestedIfNotEmpty(beanParams, "from", commandOptions.from, true);
putNestedIfNotEmpty(beanParams, "to", commandOptions.to, true);
putNestedIfNotEmpty(beanParams, "study", commandOptions.study, true);
putNestedIfNotNull(beanParams, "syncAll", commandOptions.syncAll, true);
putNestedIfNotNull(beanParams, "force", commandOptions.force, true);

groupSyncParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -322,8 +322,8 @@ private RestResponse<Group> usersUpdateGroups() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), UserUpdateGroup.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotNull(beanParams, "studyIds",commandOptions.studyIds, true);
putNestedIfNotNull(beanParams, "groupIds",commandOptions.groupIds, true);
putNestedIfNotNull(beanParams, "studyIds", commandOptions.studyIds, true);
putNestedIfNotNull(beanParams, "groupIds", commandOptions.groupIds, true);

userUpdateGroup = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ private RestResponse<Job> runBwa() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), BwaWrapperParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "command",commandOptions.command, true);
putNestedIfNotEmpty(beanParams, "fastaFile",commandOptions.fastaFile, true);
putNestedIfNotEmpty(beanParams, "fastq1File",commandOptions.fastq1File, true);
putNestedIfNotEmpty(beanParams, "fastq2File",commandOptions.fastq2File, true);
putNestedIfNotEmpty(beanParams, "outdir",commandOptions.outdir, true);
putNestedIfNotNull(beanParams, "bwaParams",commandOptions.bwaParams, true);
putNestedIfNotEmpty(beanParams, "command", commandOptions.command, true);
putNestedIfNotEmpty(beanParams, "fastaFile", commandOptions.fastaFile, true);
putNestedIfNotEmpty(beanParams, "fastq1File", commandOptions.fastq1File, true);
putNestedIfNotEmpty(beanParams, "fastq2File", commandOptions.fastq2File, true);
putNestedIfNotEmpty(beanParams, "outdir", commandOptions.outdir, true);
putNestedMapIfNotEmpty(beanParams, "bwaParams", commandOptions.bwaParams, true);

bwaWrapperParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -184,9 +184,9 @@ private RestResponse<Job> runCoverageIndex() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), CoverageIndexParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "bamFileId",commandOptions.bamFileId, true);
putNestedIfNotEmpty(beanParams, "baiFileId",commandOptions.baiFileId, true);
putNestedIfNotNull(beanParams, "windowSize",commandOptions.windowSize, true);
putNestedIfNotEmpty(beanParams, "bamFileId", commandOptions.bamFileId, true);
putNestedIfNotEmpty(beanParams, "baiFileId", commandOptions.baiFileId, true);
putNestedIfNotNull(beanParams, "windowSize", commandOptions.windowSize, true);

coverageIndexParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -225,9 +225,9 @@ private RestResponse<Job> coverageQcGeneCoverageStatsRun() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), AlignmentGeneCoverageStatsParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "bamFile",commandOptions.bamFile, true);
putNestedIfNotNull(beanParams, "genes",commandOptions.genes, true);
putNestedIfNotEmpty(beanParams, "outdir",commandOptions.outdir, true);
putNestedIfNotEmpty(beanParams, "bamFile", commandOptions.bamFile, true);
putNestedIfNotNull(beanParams, "genes", commandOptions.genes, true);
putNestedIfNotEmpty(beanParams, "outdir", commandOptions.outdir, true);

alignmentGeneCoverageStatsParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -323,9 +323,9 @@ private RestResponse<Job> runDeeptools() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), DeeptoolsWrapperParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "command",commandOptions.command, true);
putNestedIfNotEmpty(beanParams, "outdir",commandOptions.outdir, true);
putNestedIfNotNull(beanParams, "deeptoolsParams",commandOptions.deeptoolsParams, true);
putNestedIfNotEmpty(beanParams, "command", commandOptions.command, true);
putNestedIfNotEmpty(beanParams, "outdir", commandOptions.outdir, true);
putNestedMapIfNotEmpty(beanParams, "deeptoolsParams", commandOptions.deeptoolsParams, true);

deeptoolsWrapperParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -364,9 +364,9 @@ private RestResponse<Job> runFastqc() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), FastqcWrapperParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "inputFile",commandOptions.inputFile, true);
putNestedIfNotEmpty(beanParams, "outdir",commandOptions.outdir, true);
putNestedIfNotNull(beanParams, "fastqcParams",commandOptions.fastqcParams, true);
putNestedIfNotEmpty(beanParams, "inputFile", commandOptions.inputFile, true);
putNestedIfNotEmpty(beanParams, "outdir", commandOptions.outdir, true);
putNestedMapIfNotEmpty(beanParams, "fastqcParams", commandOptions.fastqcParams, true);

fastqcWrapperParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -405,8 +405,8 @@ private RestResponse<Job> runIndex() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), AlignmentIndexParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "fileId",commandOptions.fileId, true);
putNestedIfNotNull(beanParams, "overwrite",commandOptions.overwrite, true);
putNestedIfNotEmpty(beanParams, "fileId", commandOptions.fileId, true);
putNestedIfNotNull(beanParams, "overwrite", commandOptions.overwrite, true);

alignmentIndexParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -445,9 +445,9 @@ private RestResponse<Job> runPicard() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), PicardWrapperParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "command",commandOptions.command, true);
putNestedIfNotEmpty(beanParams, "outdir",commandOptions.outdir, true);
putNestedIfNotNull(beanParams, "picardParams",commandOptions.picardParams, true);
putNestedIfNotEmpty(beanParams, "command", commandOptions.command, true);
putNestedIfNotEmpty(beanParams, "outdir", commandOptions.outdir, true);
putNestedMapIfNotEmpty(beanParams, "picardParams", commandOptions.picardParams, true);

picardWrapperParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -486,10 +486,10 @@ private RestResponse<Job> runQc() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), AlignmentQcParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "bamFile",commandOptions.bamFile, true);
putNestedIfNotEmpty(beanParams, "skip",commandOptions.skip, true);
putNestedIfNotNull(beanParams, "overwrite",commandOptions.overwrite, true);
putNestedIfNotEmpty(beanParams, "outdir",commandOptions.outdir, true);
putNestedIfNotEmpty(beanParams, "bamFile", commandOptions.bamFile, true);
putNestedIfNotEmpty(beanParams, "skip", commandOptions.skip, true);
putNestedIfNotNull(beanParams, "overwrite", commandOptions.overwrite, true);
putNestedIfNotEmpty(beanParams, "outdir", commandOptions.outdir, true);

alignmentQcParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down Expand Up @@ -560,10 +560,10 @@ private RestResponse<Job> runSamtools() throws Exception {
.readValue(new java.io.File(commandOptions.jsonFile), SamtoolsWrapperParams.class);
} else {
ObjectMap beanParams = new ObjectMap();
putNestedIfNotEmpty(beanParams, "command",commandOptions.command, true);
putNestedIfNotEmpty(beanParams, "inputFile",commandOptions.inputFile, true);
putNestedIfNotEmpty(beanParams, "outdir",commandOptions.outdir, true);
putNestedIfNotNull(beanParams, "samtoolsParams",commandOptions.samtoolsParams, true);
putNestedIfNotEmpty(beanParams, "command", commandOptions.command, true);
putNestedIfNotEmpty(beanParams, "inputFile", commandOptions.inputFile, true);
putNestedIfNotEmpty(beanParams, "outdir", commandOptions.outdir, true);
putNestedMapIfNotEmpty(beanParams, "samtoolsParams", commandOptions.samtoolsParams, true);

samtoolsWrapperParams = JacksonUtils.getDefaultObjectMapper().copy()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
Expand Down
Loading

0 comments on commit 8666ba9

Please sign in to comment.