Skip to content

Commit 89ee779

Browse files
Merge branch 'release-5.2.x'
2 parents b0812f6 + 113c1f2 commit 89ee779

File tree

12 files changed

+205
-47
lines changed

12 files changed

+205
-47
lines changed

.github/workflows/develop.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ jobs:
1010
build:
1111
uses: ./.github/workflows/build-java-app-workflow.yml
1212

13-
test:
14-
uses: ./.github/workflows/test-analysis.yml
15-
needs: build
16-
secrets: inherit
17-
1813
deploy-maven:
1914
uses: ./.github/workflows/deploy-maven-repository-workflow.yml
20-
needs: test
15+
needs: build
2116
secrets: inherit

.github/workflows/pull-request-approved.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,36 @@ on:
66
types: [ submitted ]
77

88
jobs:
9-
build:
10-
uses: ./.github/workflows/build-java-app-workflow.yml
11-
9+
calculate-xetabase-branch:
10+
name: Calculate Xetabase branch
11+
runs-on: ubuntu-22.04
12+
outputs:
13+
xetabase_branch: ${{ steps.get_xetabase_branch.outputs.xetabase_branch }}
14+
steps:
15+
- name: Clone java-common-libs
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: '10'
19+
## This is important to avoid the error in the next step: "fatal: repository 'https://github.com/zetta-genomics/opencga-enterprise.git/' not found"
20+
persist-credentials: false
21+
- id: get_xetabase_branch
22+
name: "Get current branch for Xetabase from target branch"
23+
run: |
24+
chmod +x ./.github/workflows/scripts/get-xetabase-branch.sh
25+
echo "github.event.pull_request.base.ref: ${{ github.event.pull_request.base.ref }}"
26+
echo "github.event.pull_request.head.ref: ${{ github.event.pull_request.head.ref }}"
27+
echo "secrets.ZETTA_REPO_ACCESS_TOKEN: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}"
28+
xetabase_branch=$(./.github/workflows/scripts/get-xetabase-branch.sh ${{ github.event.pull_request.head.ref }})
29+
echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY}
30+
echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT
31+
env:
32+
ZETTA_REPO_ACCESS_TOKEN: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}
33+
1234
test:
1335
name: "Run all tests before merging"
14-
uses: ./.github/workflows/test-analysis.yml
15-
needs: build
36+
needs: calculate-xetabase-branch
37+
uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@develop
38+
with:
39+
branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }}
40+
task: ${{ github.event.pull_request.head.ref }}
1641
secrets: inherit
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
set -e
3+
set -x
4+
# Function to calculate the corresponding branch of Xetabase project
5+
get_xetabase_branch() {
6+
# Input parameter (branch name)
7+
input_branch="$1"
8+
9+
# If the branch begins with 'TASK' and exists in the opencga-enterprise repository, I return it
10+
if [[ $input_branch == TASK* ]]; then
11+
if [ "$(git ls-remote "https://$ZETTA_REPO_ACCESS_TOKEN@github.com/zetta-genomics/opencga-enterprise.git" "$input_branch" )" ] ; then
12+
echo $input_branch;
13+
return 0;
14+
fi
15+
fi
16+
17+
# Check if the branch name is "develop" in that case return the same branch name
18+
if [[ "$input_branch" == "develop" ]]; then
19+
echo "develop"
20+
return 0
21+
fi
22+
23+
# Check if the branch name starts with "release-" and follows the patterns "release-a.b.x" or "release-a.b.c.x"
24+
if [[ "$input_branch" =~ ^release-([0-9]+)\.([0-9]+)\.x$ ]] || [[ "$input_branch" =~ ^release-([0-9]+)\.([0-9]+)\.([0-9]+)\.x$ ]]; then
25+
# Extract the MAJOR part of the branch name
26+
MAJOR=${BASH_REMATCH[1]}
27+
# Calculate the XETABASE_MAJOR by subtracting 3 from MAJOR
28+
XETABASE_MAJOR=$((MAJOR - 3))
29+
# Check if the XETABASE_MAJOR is negative
30+
if (( XETABASE_MAJOR < 0 )); then
31+
echo "Error: 'MAJOR' digit after subtraction results in a negative number."
32+
return 1
33+
fi
34+
# Construct and echo the new branch name
35+
echo "release-$XETABASE_MAJOR.${input_branch#release-$MAJOR.}"
36+
return 0
37+
fi
38+
39+
# If the branch name does not match any of the expected patterns
40+
echo "Error: The branch name is not correct."
41+
return 1
42+
}
43+
44+
45+
# Call the function with the input branch name
46+
get_xetabase_branch "$1"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Pull request approve workflow
2+
run-name: 'Pull request approve workflow ${{ github.event.pull_request.head.ref }} -> ${{ github.event.pull_request.base.ref }} by @${{ github.actor }}'
3+
4+
on:
5+
push:
6+
branches:
7+
- TASK-*
8+
9+
10+
jobs:
11+
calculate-xetabase-branch:
12+
name: Calculate Xetabase branch
13+
runs-on: ubuntu-22.04
14+
outputs:
15+
xetabase_branch: ${{ steps.get_xetabase_branch.outputs.xetabase_branch }}
16+
steps:
17+
- name: Clone java-common-libs
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: '10'
21+
## This is important to avoid the error in the next step: "fatal: repository 'https://github.com/zetta-genomics/opencga-enterprise.git/' not found"
22+
persist-credentials: false
23+
- id: get_xetabase_branch
24+
name: "Get current branch for Xetabase from target branch"
25+
run: |
26+
if [ "$( git ls-remote https://[email protected]/opencb/opencga.git "TASK-6807" )" ] ; then
27+
echo "OPENCGA TASK-6807 branch";
28+
fi
29+
30+
if [ "$( git ls-remote https://[email protected]/zetta-genomics/opencga-enterprise.git "$input_branch" )" ] ; then
31+
echo "Here it is TASK-6807 branch";
32+
fi
33+
chmod +x ./.github/workflows/scripts/get-xetabase-branch.sh
34+
echo "secrets.ZETTA_REPO_ACCESS_TOKEN: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}" | tee -a ${GITHUB_STEP_SUMMARY}
35+
xetabase_branch=$(./.github/workflows/scripts/get-xetabase-branch.sh "TASK-6807" )
36+
echo "__Xetabase ref:__ \"${xetabase_branch}\"" | tee -a ${GITHUB_STEP_SUMMARY}
37+
echo "xetabase_branch=${xetabase_branch}" >> $GITHUB_OUTPUT
38+
env:
39+
ZETTA_REPO_ACCESS_TOKEN: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}
40+
41+
test:
42+
name: "Run all tests before merging"
43+
needs: calculate-xetabase-branch
44+
uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@develop
45+
with:
46+
branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }}
47+
task: TASK-6807
48+
secrets: inherit

.github/workflows/test-xetabase-workflow.yml

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,49 @@ on:
1919
type: string
2020
description: 'Branch of opencga-enterprise to be tested and built.'
2121
required: true
22-
env:
23-
AZCOPY_SPA_CLIENT_SECRET: ${{ secrets.AZCOPY_SPA_CLIENT_SECRET }}
24-
AZCOPY_AUTO_LOGIN_TYPE: "SPN"
25-
AZCOPY_SPA_APPLICATION_ID: ${{ secrets.AZCOPY_SPA_APPLICATION_ID }}
26-
AZCOPY_TENANT_ID: ${{ secrets.AZCOPY_TENANT_ID }}
2722

2823
jobs:
2924
test:
3025
name: Execute JUnit and Jacoco tests
3126
runs-on: ubuntu-22.04
3227
steps:
33-
- name: Clone OpenCGA Enterprise branch '${{ github.event.inputs.branch }}'
28+
- name: Retrieve secrets from Keeper
29+
id: ksecrets
30+
uses: Keeper-Security/ksm-action@master
31+
with:
32+
keeper-secret-config: ${{ secrets.KEEPER_SM_GH_OPENCB }}
33+
secrets: |
34+
AZURE_KUBE_CONFIG/field/Secret Value > env:AZURE_KUBE_CONFIG
35+
DOCKER_HUB_USER/field/Secret Value > env:DOCKER_HUB_USER
36+
DOCKER_HUB_PASSWORD/field/Secret Value > env:DOCKER_HUB_PASSWORD
37+
SSH_TESTING_SERVER_HOST/field/Secret Value > env:SSH_HOST
38+
SSH_TESTING_SERVER_PORT/field/Secret Value > env:SSH_PORT
39+
SSH_TESTING_SERVER_USER/field/Secret Value > env:SSH_USER
40+
SSH_TESTING_SERVER_PASSWORD/field/Secret Value > env:SSH_PASS
41+
- name: Log inputs
42+
run: |
43+
echo "__OpenCGA-enterprise branch:__ \"${{ inputs.branch }}\"" | tee -a $GITHUB_STEP_SUMMARY
44+
echo "__Task to test:__ \"${{ inputs.task }}\"" | tee -a $GITHUB_STEP_SUMMARY
45+
- name: Clone OpenCGA Enterprise branch '${{ inputs.branch }}'
3446
uses: actions/checkout@v4
3547
with:
3648
repository: zetta-genomics/opencga-enterprise
37-
ref: ${{ github.event.inputs.branch }}
49+
ref: ${{ inputs.branch }}
3850
token: ${{ secrets.ZETTA_REPO_ACCESS_TOKEN }}
3951
path: opencga-enterprise
4052
fetch-depth: "10"
4153
- id: get_opencga_branch
4254
name: Get OpenCGA branch from 'pom.xml' property
4355
run: |
4456
pwd
45-
chmod +x ./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh
46-
opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/xetabase-branch.sh ${{ github.event.inputs.task }})
57+
ls -lrtha
58+
ls -lrtha ./opencga-enterprise
59+
chmod +x ./opencga-enterprise/.github/workflows/scripts/get-opencga-xetabase-branch.sh
60+
opencga_branch=$(./opencga-enterprise/.github/workflows/scripts/get-opencga-xetabase-branch.sh)
61+
echo "opencga_branch=${opencga_branch}"
4762
echo "opencga_branch=${opencga_branch}" >> $GITHUB_OUTPUT
48-
- uses: actions/checkout@v4
63+
- name: Clone OpenCGA branch '${{ steps.get_opencga_branch.outputs.opencga_branch }}'
64+
uses: actions/checkout@v4
4965
with:
5066
repository: opencb/opencga
5167
ref: ${{ steps.get_opencga_branch.outputs.opencga_branch }}
@@ -70,39 +86,39 @@ jobs:
7086
chmod +x ./kubectl
7187
echo "${{ secrets.AZURE_KUBE_CONFIG }}" > admin.conf
7288
./kubectl -n cellbase-db port-forward services/cellbase-rs0-svc 27018:27017 --kubeconfig ./admin.conf &
73-
- name: Install Azure AZCOPY
74-
uses: kheiakiyama/install-azcopy-action@v1
75-
with:
76-
version: 'v10'
7789
- name: DockerHub login
7890
uses: docker/login-action@v3
7991
with:
80-
username: ${{ secrets.DOCKER_HUB_USER }}
81-
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
92+
username: ${{ env.DOCKER_HUB_USER }}
93+
password: ${{ env.DOCKER_HUB_PASSWORD }}
94+
- name: Install sshpass
95+
run: sudo apt-get install sshpass
96+
- name: Add SSH Host to known_hosts
97+
run: |
98+
mkdir -p ~/.ssh
99+
ssh-keyscan -p ${{ env.SSH_PORT }} ${{ env.SSH_HOST }} >> ~/.ssh/known_hosts
100+
env:
101+
SSH_HOST: ${{ env.SSH_HOST }}
102+
SSH_PORT: ${{ env.SSH_PORT }}
82103
- name: Run all OpenCB Junit tests, ie. java-common-libs, biodata, cellbase, opencga and opencga-enterprise
83104
run: |
84-
ln -s opencga opencga-enterprise/opencga-home
85105
cd opencga-enterprise
86-
./build.sh -t -l runShortTests,runMediumTests,runLongTests -b -s -f -T ${{ github.event.inputs.task }} -c localhost:27018 -H hdp3.1
106+
ln -s ../opencga opencga-home
107+
./build.sh -t -l runShortTests -b -s -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1
87108
- name: Upload reports results to Github
88109
uses: actions/upload-artifact@v4
89110
with:
90111
name: report-test
91-
path: /home/runner/work/testing-environment/testing-environment/opencga-enterprise/reports/test
112+
path: ./opencga-enterprise/reports/test
92113
- name: Upload log
93114
uses: actions/upload-artifact@v4
94115
with:
95116
name: build-log
96-
path: /home/runner/work/testing-environment/testing-environment/opencga-enterprise/build.log
97-
- name: Upload junit reports to a remote scp server
98-
uses: garygrossgarten/github-action-scp@release
99-
with:
100-
local: opencga-enterprise/reports/test
101-
remote: /var/www/html/reports/xetabase/${{ github.event.inputs.task }}/
102-
host: ${{ secrets.SSH_TESTING_SERVER_HOST}}
103-
port: ${{ secrets.SSH_TESTING_SERVER_PORT}}
104-
username: ${{ secrets.SSH_TESTING_SERVER_USER }}
105-
password: ${{ secrets.SSH_TESTING_SERVER_PASSWORD }}
106-
concurrency: 2
117+
path: ./opencga-enterprise/build.log
118+
- name: Log summary
119+
run: |
120+
cat ./opencga-enterprise/build.log | tee -a $GITHUB_STEP_SUMMARY
121+
122+
107123
108124

commons-datastore/commons-datastore-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.opencb.commons</groupId>
88
<artifactId>commons-datastore</artifactId>
9-
<version>5.2.0</version>
9+
<version>5.2.1</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

commons-datastore/commons-datastore-mongodb/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.opencb.commons</groupId>
88
<artifactId>commons-datastore</artifactId>
9-
<version>5.2.0</version>
9+
<version>5.2.1</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

commons-datastore/commons-datastore-solr/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>org.opencb.commons</groupId>
2424
<artifactId>commons-datastore</artifactId>
25-
<version>5.2.0</version>
25+
<version>5.2.1</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828

commons-datastore/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.opencb.commons</groupId>
88
<artifactId>commons</artifactId>
9-
<version>5.2.0</version>
9+
<version>5.2.1</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

commons-lib/pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.opencb.commons</groupId>
88
<artifactId>commons</artifactId>
9-
<version>5.2.0</version>
9+
<version>5.2.1</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

@@ -69,5 +69,11 @@
6969
<artifactId>jackson-databind</artifactId>
7070
<scope>test</scope>
7171
</dependency>
72+
<dependency>
73+
<groupId>commons-io</groupId>
74+
<artifactId>commons-io</artifactId>
75+
<version>2.8.0</version>
76+
<scope>compile</scope>
77+
</dependency>
7278
</dependencies>
7379
</project>

commons-lib/src/main/java/org/opencb/commons/utils/FileUtils.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import org.apache.commons.lang3.StringUtils;
2020
import org.opencb.commons.exec.Command;
21+
import org.slf4j.LoggerFactory;
2122

2223
import java.io.*;
2324
import java.nio.charset.Charset;
@@ -188,6 +189,27 @@ public static String[] getUserAndGroup(Path path, boolean numericId) throws IOEx
188189
return new String[]{split[2], split[3]};
189190
}
190191

192+
193+
public static void copyFile(File src, File dest) throws IOException {
194+
try {
195+
org.apache.commons.io.FileUtils.copyFile(src, dest);
196+
} catch (IOException e) {
197+
try {
198+
if (src.length() == dest.length()) {
199+
LoggerFactory.getLogger(FileUtils.class).warn(e.getMessage());
200+
return;
201+
}
202+
throw e;
203+
} catch (Exception e1) {
204+
throw e;
205+
}
206+
}
207+
}
208+
209+
//-------------------------------------------------------------------------
210+
// P R I V A T E M E T H O D S
211+
//-------------------------------------------------------------------------
212+
191213
private static String getLsOutput(Path path, boolean numericId) throws IOException {
192214
FileUtils.checkPath(path);
193215

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.opencb.commons</groupId>
88
<artifactId>commons</artifactId>
9-
<version>5.2.0</version>
9+
<version>5.2.1</version>
1010
<packaging>pom</packaging>
1111

1212
<name>OpenCB commons project</name>

0 commit comments

Comments
 (0)