Skip to content

Temporary GHA modification to run workflow off of this feature branch #1

Temporary GHA modification to run workflow off of this feature branch

Temporary GHA modification to run workflow off of this feature branch #1

name: DataRepo Workshop Scale Tests
env:
K8_CLUSTER: jade-master-us-central1
GOOGLE_APPLICATION_CREDENTIALS: /tmp/staging-test-runner.json
GOOGLE_CLOUD_PROJECT: terra-datarepo-staging
GOOGLE_CLOUD_DATA_PROJECT: terra-datarepo-staging-data
JADE_USER_EMAIL: [email protected]
TDR_LOG_APPENDER: Console-Standard
on:
workflow_dispatch: {}
## TODO: remove the below block once tested.
push:
branches:
- okotsopo-WOR-1503-workshop-scale-test
jobs:
test-runner-staging:
runs-on: ubuntu-latest
steps:
- name: "Checkout jade-data-repo"
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Setup Java 17"
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: "Fetch current staging version from /configuration endpoint"
id: configuration
run: |
staging_version=$(curl -s -X GET "https://data.staging.envs-terra.bio/configuration" -H "accept: application/json" | jq -r '.semVer|rtrimstr("-SNAPSHOT")')
echo "staging_version=${staging_version}" >> $GITHUB_OUTPUT
echo "Staging Version: $staging_version"
- name: "Checkout tag for DataBiosphere/jade-data-repo"
if: github.ref == 'refs/heads/develop'
run: |
git checkout ${{ steps.configuration.outputs.staging_version }}
echo "Current branch is ${{ github.ref }}"
- name: "Import Vault staging secrets"
uses: hashicorp/[email protected]
with:
url: ${{ secrets.VAULT_ADDR }}
method: approle
roleId: ${{ secrets.STAGING_ROLE_ID }}
secretId: ${{ secrets.STAGING_SECRET_ID }}
secrets: |
secret/dsde/datarepo/staging/test-runner-sa key | B64_APPLICATION_CREDENTIALS ;
- name: "Perform IAM policy cleanup for staging"
run: |
# write vault tokens
base64 --decode <<< ${B64_APPLICATION_CREDENTIALS} > ${GOOGLE_APPLICATION_CREDENTIALS}
gcloud auth activate-service-account --key-file ${GOOGLE_APPLICATION_CREDENTIALS}
./tools/cleanupPolicies.sh ${GOOGLE_CLOUD_DATA_PROJECT}
- name: "Import Vault dev secrets"
uses: hashicorp/[email protected]
with:
url: ${{ secrets.VAULT_ADDR }}
method: approle
roleId: ${{ secrets.ROLE_ID }}
secretId: ${{ secrets.SECRET_ID }}
secrets: |
secret/dsde/datarepo/dev/sa-key-b64 sa | B64_APPLICATION_CREDENTIALS ;
- name: "Add jade-k8-sa credentials to run as Harry Potter test users"
env:
# note: hack to overwrite the env var to grab the dev credentials too
GOOGLE_APPLICATION_CREDENTIALS: /tmp/jade-dev-account.json
run: |
# write vault tokens
base64 --decode <<< ${B64_APPLICATION_CREDENTIALS} > ${GOOGLE_APPLICATION_CREDENTIALS}
- name: "Build and run Test Runner"
run: |
cd ${GITHUB_WORKSPACE}/${workingDir}
echo "Building Data Repo client library"
export TEST_RUNNER_SERVER_SPECIFICATION_FILE="staging.json"
export TEST_RUNNER_BILLING_PROFILE_NAME="stest1"
ENABLE_SUBPROJECT_TASKS=1 ./gradlew :datarepo-client:clean :datarepo-client:assemble
cd ${GITHUB_WORKSPACE}/${workingDir}/datarepo-clienttests
export ORG_GRADLE_PROJECT_datarepoclientjar=$(find .. -type f -name "datarepo-client*.jar")
echo "ORG_GRADLE_PROJECT_datarepoclientjar = ${ORG_GRADLE_PROJECT_datarepoclientjar}"
echo "Running test suite"
./gradlew runTest --args="suites/TdrWorkshopScaleTests.json tmp/TestRunnerResults"
echo "Collecting measurements"
./gradlew collectMeasurements --args="TdrWorkshopScaleTests.json tmp/TestRunnerResults"
echo "Uploading results"
./gradlew uploadResults --args="BroadJadeDev.json tmp/TestRunnerResults"
cd ${GITHUB_WORKSPACE}/${workingDir}