8000 TASK-6399 - CI/CD: Include save reports option for tasks workflows by juanfeSanahuja · Pull Request #87 · opencb/java-common-libs · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
df70872
test-xetabase-workflow.yml: New workflow to test xetabase on pullrequ…
juanfeSanahuja Jun 20, 2024
3f2f4eb
test-xetabase-workflow.yml: New workflow to test xetabase on pullrequ…
juanfeSanahuja Jun 20, 2024
37bfcd1
test-xetabase-workflow.yml: Modify pull_request approve workflow to t…
juanfeSanahuja Jun 20, 2024
f930213
cicd:clone jcl to exec script in pull request approve #TASK-6399
juanfeSanahuja Jun 20, 2024
9b2e5cf
cicd: fix parenthesi #TASK-6399
juanfeSanahuja Jun 20, 2024
b514929
cicd: debug ./.github/workflows/ #TASK-6399
juanfeSanahuja Jun 20, 2024
f8be19c
CICD: Added ZETTA_REPO_ACCESS_TOKEN to co xetabase #TASK-6399
juanfeSanahuja Jun 25, 2024
9a6e09c
Merge branch 'develop' into TASK-6399
juanfeSanahuja Jun 25, 2024
6cca2db
cicd: Temporal workflow_dispatch for PR to tests #TASK-6399
juanfeSanahuja Jun 25, 2024
1aa53aa
cicd: Delete Temporal workflow_dispatch for PR to tests #TASK-6399
juanfeSanahuja Jun 25, 2024
2d4f90f
Merge branch 'develop' into TASK-6399
juanfeSanahuja Jun 25, 2024
e29adf1
cicd: Temporal call to TASK-6399 yml #TASK-6399
juanfeSanahuja Jun 25, 2024
55e0c2f
cicd: Temporal call to TASK-6399 yml #TASK-6399
juanfeSanahuja Jun 25, 2024
2083020
create workflow in develop to test xetabase #TASK-6399
juanfeSanahuja Jun 25, 2024
e0d2601
Separate in two jobs to run the tests #TASK-6399
juanfeSanahuja Jun 25, 2024
fa6d57a
Merge branch 'develop' into TASK-6399
juanfeSanahuja Jun 25, 2024
606b93e
cicd secrets: inherit #TASK-6399
juanfeSanahuja Jun 25, 2024
8014992
cicd create outputs #TASK-6399
juanfeSanahuja Jun 25, 2024
8c8cf8c
cicd check bash --version #TASK-6399
juanfeSanahuja Jun 25, 2024
f6719a7
cicd check bash --version #TASK-6399
juanfeSanahuja Jun 25, 2024
26914c7
cicd: remove github.event. in inputs #TASK-6399
juanfeSanahuja Jun 25, 2024
b4b7a47
cicd: workflow dispatch to test#TASK-6399
juanfeSanahuja Jun 25, 2024
39ec574
cicd: debug logs added #TASK-6399
juanfeSanahuja Jun 25, 2024
3bea107
cicd: debug logs added #TASK-6399
juanfeSanahuja Jun 25, 2024
ae62676
cicd: debug logs added #TASK-6399
juanfeSanahuja Jun 25, 2024
6a7eee5
cicd: Test level short to fast test upload to report server #TASK-6399
juanfeSanahuja Jun 28, 2024
d5b4f38
cicd: Uncomment workflow_dispatch Test level short to fast test uploa…
juanfeSanahuja Jun 28, 2024
16d1cf8
Merge branch 'develop' into TASK-6399
juanfeSanahuja Jun 28, 2024
5bb1d4c
cicd: fix paths to upload artifacts #TASK-6399
juanfeSanahuja Jun 28, 2024
d4ebf31
Added keeper passwords #TASK-6399
juanfeSanahuja Jun 28, 2024
df6f77b
Added keeper passwords #TASK-6399
juanfeSanahuja Jun 28, 2024
8c9f958
cicd: Remove absolute references in Path #TASK-6399
juanfeSanahuja Jul 1, 2024
2b5ccec
Added get-xetabase-branch.sh #TASK-6399
juanfeSanahuja Jul 1, 2024
7d6d051
Added remove get-opencga-branch.sh #TASK-6399
juanfeSanahuja Jul 1, 2024
61b806a
Added log summary step #TASK-6399
juanfeSanahuja Jul 1, 2024
1f896dc
cicd: Removed test step in develop.yml #TASK-6399
juanfeSanahuja Jul 1, 2024
af9e16d
cicd: Add debug outputs #TASK-6399
juanfeSanahuja Jul 1, 2024
a0861c2
cicd: delete param to opencga_branch #TASK-6399
juanfeSanahuja Jul 1, 2024
9de5d3c
cicd: delete param to opencga_branch #TASK-6399
juanfeSanahuja Jul 1, 2024
98d3852
cicd:call to xetabase-branch.sh #TASK-6399
juanfeSanahuja Jul 1, 2024
75536da
cicd: Change AZURE_KUBE_CONFIG to secrets #TASK-6399
juanfeSanahuja Jul 2, 2024
3bfbf9a
Rename get-opencga-xetabase-branch.sh reference
juanfeSanahuja Jul 9, 2024
8431eb8
cicd: Rename get-opencga-xetabase-branch.sh reference #TASK-6399
juanfeSanahuja Jul 9, 2024
49c4b3d
Merge branch 'TASK-6399' of github.com:opencb/java-common-libs into T…
juanfeSanahuja Jul 9, 2024
d90261e
Merge branch 'release-5.2.x' into TASK-6399
juanfeSanahuja Jul 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/pull-request-approved.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,29 @@ 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'
- 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"
uses: ./.github/workflows/test-analysis.yml
needs: build
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 }}
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 - 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 <branch-name>"
exit 1
fi

# Call the function with the input branch name
get_xetabase_branch "$1"
75 changes: 56 additions & 19 deletions .github/workflows/test-xetabase-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,56 @@ on:
type: string
description: 'Branch of opencga-enterprise to be tested and built.'
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:
test:
name: Execute JUnit and Jacoco tests
runs-on: ubuntu-22.04
steps:
- name: Clone OpenCGA Enterprise branch '${{ github.event.inputs.branch }}'
- 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
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
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"
- 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 }})
ls -lrtha
ls -lrtha ./opencga-enterprise
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
- 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 }}
Expand Down Expand Up @@ -77,32 +100,46 @@ 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: |
ln -s opencga opencga-enterprise/opencga-home
pwd
ls -lrtha
echo "------------------------------------"
cd opencga-enterprise
./build.sh -t -l runShortTests,runMediumTests,runLongTests -b -s -f -T ${{ github.event.inputs.task }} -c localhost:27018 -H hdp3.1
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
./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:
name: report-test
path: /home/runner/work/testing-environment/testing-environment/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/testing-environment/testing-environment/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:
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 }}
remote: /var/www/html/reports/xetabase/${{ inputs.task }}/
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
- name: Log summary
run: |
cat ./opencga-enterprise/build.log | tee -a $GITHUB_STEP_SUMMARY




0