Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK-6807 - Pull request approve workflow Fail #90

Merged
merged 31 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e280466
cicd: Upload reference to develop branch in pull-request-approve to t…
juanfeSanahuja Sep 4, 2024
e8552ed
cicd: Refactor and fix SSH env values #TASK-6807
juanfeSanahuja Sep 5, 2024
59ad86b
Env variables to FIX error #TASK-6807
juanfeSanahuja Sep 5, 2024
85e297a
Env variables to FIX error #TASK-6807
juanfeSanahuja Sep 5, 2024
abb3b6b
Fix get-xetabase-branch #TASK-6807
juanfeSanahuja Sep 5, 2024
12a5159
Fix get-xetabase-branch #TASK-6807
juanfeSanahuja Sep 5, 2024
9182e1e
Fix get-xetabase-branch #TASK-6807
juanfeSanahuja Sep 5, 2024
2d940e3
Fix get-xetabase-branch #TASK-6807
juanfeSanahuja Sep 5, 2024
230010e
Fix get-xetabase-branch #TASK-6807
juanfeSanahuja Sep 5, 2024
a4d2fbb
Fix get-xetabase-branch #TASK-6807
juanfeSanahuja Sep 5, 2024
8e3cc88
Fix get-xetabase-branch #TASK-6807
juanfeSanahuja Sep 5, 2024
f84ebf3
Fix get-xetabase-branch #TASK-6807
juanfeSanahuja Sep 5, 2024
6ca7c8c
Fix get-xetabase-branch #TASK-6807
juanfeSanahuja Sep 5, 2024
9272829
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
5d473dd
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
7b2a8b0
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
c3fbf52
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
546ea97
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
b870aa0
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
ba5a19e
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
ca2ede1
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
9241eb2
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
ca6debc
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
47688af
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
3efd0b5
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
45e3902
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
f4a286f
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
534106c
TEST workflow for pull-request #TASK-6807
juanfeSanahuja Sep 5, 2024
039c4fd
Fix ssh to report server #TASK-6807
juanfeSanahuja Sep 9, 2024
c07c902
pull-request-approve Remove fail-never #TASK-6807
juanfeSanahuja Sep 12, 2024
502537f
pull-request-approve Remove fail-never #TASK-6807
juanfeSanahuja Sep 12, 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
11 changes: 9 additions & 2 deletions .github/workflows/pull-request-approved.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,25 @@ jobs:
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
xetabase_branch=$(./.github/workflows/scripts/get-xetabase-branch.sh ${{ github.event.pull_request.base.ref }})
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.head.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"
needs: calculate-xetabase-branch
uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@TASK-6399
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 }}
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/scripts/get-xetabase-branch.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/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://github.com/zetta-genomics/opencga-enterprise.git "$input_branch" )" ] ; then
echo "$GIT_BRANCH";
exit 0;
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

Expand Down Expand Up @@ -40,11 +41,6 @@ get_xetabase_branch() {
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"
48 changes: 48 additions & 0 deletions .github/workflows/test-pull-request-approved.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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:
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-6807" )" ] ; then
echo "OPENCGA TASK-6807 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-6807" )
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-6807
secrets: inherit
49 changes: 14 additions & 35 deletions .github/workflows/test-xetabase-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ on:
description: 'Branch of opencga-enterprise to be tested and built.'
required: true

env:
AZCOPY_AUTO_LOGIN_TYPE: "SPN"


jobs:
test:
name: Execute JUnit and Jacoco tests
Expand All @@ -35,16 +31,13 @@ jobs:
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
SSH_TESTING_SERVER_HOST/field/Secret Value > env:SSH_HOST
SSH_TESTING_SERVER_PORT/field/Secret Value > env:SSH_PORT
SSH_TESTING_SERVER_USER/field/Secret Value > env:SSH_USER
SSH_TESTING_SERVER_PASSWORD/field/Secret Value > env:SSH_PASS
- name: Log inputs
run: |
echo "__OpenCGA-enterprise branch:__ \"${{ inputs.branch }}\"" | tee -a $GITHUB_STEP_SUMMARY
Expand Down Expand Up @@ -93,29 +86,25 @@ jobs:
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: ${{ env.DOCKER_HUB_USER }}
password: ${{ env.DOCKER_HUB_PASSWORD }}
- name: Install sshpass
run: sudo apt-get install sshpass
- name: Add SSH Host to known_hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -p ${{ env.SSH_PORT }} ${{ env.SSH_HOST }} >> ~/.ssh/known_hosts
env:
SSH_HOST: ${{ env.SSH_HOST }}
SSH_PORT: ${{ env.SSH_PORT }}
- name: Run all OpenCB Junit tests, ie. java-common-libs, biodata, cellbase, opencga and opencga-enterprise
run: |
pwd
ls -lrtha
echo "------------------------------------"
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
./build.sh -t -l runShortTests -b -s -f -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1
./build.sh -t -l runShortTests -b -s -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1
- name: Upload reports results to Github
uses: actions/upload-artifact@v4
with:
Expand All @@ -126,16 +115,6 @@ jobs:
with:
name: 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/${{ 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
Expand Down
Loading