From 224d3a9d6ed14a3a1a6ac19ea277b23cfabcdb49 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 10:50:18 +0100 Subject: [PATCH 01/18] Bash script for running the Simbank app and all IVTs locally, GH workflow to run the SimBankIVT locally in a workflow, updates to the .secrets.baseline Signed-off-by: Jade Carino --- .github/workflows/test.yaml | 130 ++++++++++++++++++++++++++++++++++++ .secrets.baseline | 13 +++- test-locally.sh | 112 ++++++++++++++++++++++++++----- 3 files changed, 239 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..fb948c8c --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,130 @@ +# +# Copyright contributors to the Galasa project +# +# SPDX-License-Identifier: EPL-2.0 +# +name: Test SimBank + +on: + workflow_dispatch: + push: + branches: [main] + +env: + NAMESPACE: ${{ github.repository_owner }} + +jobs: + get-galasa-version: + name: Get Galasa Version + # Use the build.properties file in the galasa repo to source the galasa-version output variable. + # This variable can be referenced by other jobs in this flow using ${{ needs.get-galasa-version.outputs.galasa-version }} + runs-on: ubuntu-latest + + steps: + - name: Checkout 'galasa' repository + uses: actions/checkout@v4 + with: + repository: ${{ env.NAMESPACE }}/galasa + path: ${{ github.workspace }}/galasa + sparse-checkout: | + build.properties + + - name: Get Galasa Version from build.properties file + id: get-galasa-version + run: | + cat build.properties | grep "=" >> $GITHUB_OUTPUT + + outputs: + galasa-version: ${{ steps.get-galasa-version.outputs.GALASA_VERSION }} + + run-simbank-tests: + name: Run SimBank Tests + runs-on: ubuntu-latest + + needs: get-galasa-version + + env: + GALASA_HOME: ${{ github.workspace }}/.galasa + + steps: + + #---------------------------------------------------------------------------------- + # Build the Simplatform application that the tests connect to + - name: Checkout the Simplatform repository + uses: actions/checkout@v4 + with: + repository: ${{ env.NAMESPACE }}/simplatform + path: ${{ github.workspace }}/simplatform + + + - name: Build Simplatform application + working-directory: ${{ github.workspace }}/simplatform + run: | + ./build-locally.sh + + #---------------------------------------------------------------------------------- + # Set up Galasa environment + - name: Create credentials.properties file + working-directory: ${{ env.GALASA_HOME }} + run: | + echo "${{ secrets.SIMBANK_CREDENTIALS }}" >> credentials.properties + + # The credentials.properties file should look something like this: + # secure.credentials.MYSIMBANKUSER.username=XXX + # secure.credentials.MYSIMBANKUSER.password=XXX + # Needs to be created dynamically as they cannot be checked into GitHub and exposed. + + - name: Initialise local Galasa environment to create remaining files and folders + run: | + galasactl local init --log - + + #---------------------------------------------------------------------------------- + # Run the Simplatform application + - name: Start the Simplatform application + env: + GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }} + run: | + echo "Starting SimBank application..." + java -jar /Users/runner/.m2/repository/dev/galasa/galasa-simplatform/${GALASA_VERSION}/galasa-simplatform-${GALASA_VERSION}.jar & + + #---------------------------------------------------------------------------------- + # Run the Simbank tests + # - name: Ensure permissions for mounted /galasa directory + # run: | + # sudo mkdir -p ${{ github.workspace }}/galasa + # sudo chown -R 999:999 ${{ github.workspace }}/galasa + + # - name: Clean /galasa workspace in CLI image + # run: | + # docker run --rm \ + # --user galasa:galasa \ + # -v ${{ github.workspace }}/galasa:/galasa \ + # ghcr.io/${{ env.NAMESPACE }}/galasactl-x86_64:main \ + # rm -rf /galasa/* + + - name: Run the SimBankIVT + run: | + docker run --rm \ + --env GALASA_HOME=${{ env.GALASA_HOME }} \ + --user galasa:galasa \ + -v ${{ github.workspace }}/galasa:/galasa:rw \ + ghcr.io/${{ env.NAMESPACE }}/galasactl-x86_64:main \ + galasactl runs submit local \ + --obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \ + --obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \ + --class dev.galasa.simbank.tests/dev.galasa.simbank.tests.SimBankIVT \ + --log - + + # - name: Report results into Slack channel + # env: + # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + # run: | + # docker run --rm \ + # --env SLACK_WEBHOOK=${{ env.SLACK_WEBHOOK }} \ + # -v ${{ github.workspace }}/galasa:/galasa:rw \ + # ghcr.io/${{ env.NAMESPACE }}/galasabld-ibm:main \ + # slackpost tests \ + # --path /galasa/test.json \ + # --name "Simbank" \ + # --desc "Tests running locally on GitHub Actions" \ + # --hook ${{ env.SLACK_WEBHOOK }} \ No newline at end of file diff --git a/.secrets.baseline b/.secrets.baseline index fafda2d6..33cc808c 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -75,7 +75,18 @@ "name": "TwilioKeyDetector" } ], - "results": {}, + "results": { + ".github/workflows/test.yaml": [ + { + "hashed_secret": "b60d121b438a380c343d5ec3c2037564b82ffef3", + "is_secret": false, + "is_verified": false, + "line_number": 74, + "type": "Secret Keyword", + "verified_result": null + } + ] + }, "version": "0.13.1+ibm.62.dss", "word_list": { "file": null, diff --git a/test-locally.sh b/test-locally.sh index 6ac60b91..28eb57d3 100755 --- a/test-locally.sh +++ b/test-locally.sh @@ -7,7 +7,7 @@ # #----------------------------------------------------------------------------------------- # -# Objectives: Build this repository code locally. +# Objectives: Run the Simbank tests locally. # #----------------------------------------------------------------------------------------- @@ -92,6 +92,89 @@ function checkGalasaCtlAvailable { fi } +function checkSimBankTestAreBuilt { + SIMBANK_TESTS_PATH=$(ls ~/.m2/repository/dev/galasa/dev.galasa.simbank.tests/${SIMBANK_VERSION}/dev.galasa.simbank.tests-${SIMBANK_VERSION}.jar 2>/dev/null) + + if [ -f "$SIMBANK_TESTS_PATH" ]; then + info "Found dev.galasa.simbank.tests in local Maven repo: $SIMBANK_TESTS_PATH" + else + error "dev.galasa.simbank.tests not found in local Maven repo." >&2 + exit 1 + fi +} + +function checkSimBankAppIsBuilt { + SIMBANK_APP_PATH=$(ls ~/.m2/repository/dev/galasa/galasa-simplatform/${SIMBANK_VERSION}/galasa-simplatform-${SIMBANK_VERSION}.jar 2>/dev/null) + + if [ -f "$SIMBANK_APP_PATH" ]; then + info "Found galasa-simplatform in local Maven repo: $SIMBANK_APP_PATH" + else + error "galasa-simplatform not found in local Maven repo." >&2 + exit 1 + fi +} + +#----------------------------------------------------------------------------------------- +# Test methods. +#----------------------------------------------------------------------------------------- +function runSimBankIVT { + cmd="galasactl runs submit local \ + --obr mvn:dev.galasa/dev.galasa.simbank.obr/${TEST_OBR_VERSION}/obr \ + --obr mvn:dev.galasa/dev.galasa.uber.obr/${TEST_OBR_VERSION}/obr \ + --class dev.galasa.simbank.tests/dev.galasa.simbank.tests.SimBankIVT \ + --log ${BASEDIR}/temp/simbank-test-log.txt" + + info "Command is ${cmd}" + + $cmd + rc=$? + if [[ "${rc}" != "0" ]]; then + error "Command to run tests failed. rc=${rc}. Log is at ${BASEDIR}/temp/log.txt" + exit 1 + fi + + success "Ran SimBankIVT test OK" +} + +function runBasicAccountCreditTest { + cmd="galasactl runs submit local \ + --obr mvn:dev.galasa/dev.galasa.simbank.obr/${TEST_OBR_VERSION}/obr \ + --obr mvn:dev.galasa/dev.galasa.uber.obr/${TEST_OBR_VERSION}/obr \ + --class dev.galasa.simbank.tests/dev.galasa.simbank.tests.BasicAccountCreditTest \ + --log ${BASEDIR}/temp/simbank-test-log.txt" + + info "Command is ${cmd}" + + $cmd + rc=$? + if [[ "${rc}" != "0" ]]; then + error "Command to run tests failed. rc=${rc}. Log is at ${BASEDIR}/temp/log.txt" + exit 1 + fi + + success "Ran BasicAccountCreditTest test OK" +} + +function runProvisionedAccountCreditTests { + cmd="galasactl runs submit local \ + --obr mvn:dev.galasa/dev.galasa.simbank.obr/${TEST_OBR_VERSION}/obr \ + --obr mvn:dev.galasa/dev.galasa.uber.obr/${TEST_OBR_VERSION}/obr \ + --class dev.galasa.simbank.tests/dev.galasa.simbank.tests.ProvisionedAccountCreditTests \ + --log ${BASEDIR}/temp/simbank-test-log.txt" + + info "Command is ${cmd}" + + $cmd + rc=$? + if [[ "${rc}" != "0" ]]; then + error "Command to run tests failed. rc=${rc}. Log is at ${BASEDIR}/temp/log.txt" + exit 1 + fi + + success "Ran ProvisionedAccountCreditTests test OK" +} + + #----------------------------------------------------------------------------------------- # Main logic. #----------------------------------------------------------------------------------------- @@ -103,24 +186,23 @@ SIMBANK_VERSION="0.42.0" h1 "Running Simbank application tests" checkGalasaCtlAvailable +checkSimBankTestAreBuilt +checkSimBankAppIsBuilt + +# Start the Simbank back-end server application in a background process... +h1 "Running Simbank back-end server application (version ${SIMBANK_VERSION}) ..." + +java -jar ~/.m2/repository/dev/galasa/galasa-simplatform/${SIMBANK_VERSION}/galasa-simplatform-${SIMBANK_VERSION}.jar > ${BASEDIR}/temp/simbank-app-log.txt 2>&1 & + +success "Simbank application started OK." TEST_OBR_VERSION="0.42.0" mkdir -p ${BASEDIR}/temp cd ${BASEDIR}/temp -cmd="galasactl runs submit local \ ---obr mvn:dev.galasa/dev.galasa.simbank.obr/${TEST_OBR_VERSION}/obr \ ---class dev.galasa.simbank.tests/dev.galasa.simbank.tests.SIMBANKIVT \ ---log ${BASEDIR}/temp/log.txt" - -info "Command is ${cmd}" - -$cmd -rc=$? -if [[ "${rc}" != "0" ]]; then - error "Command to run tests failed. rc=${rc}. Log is at ${BASEDIR}/temp/log.txt" - exit 1 -fi +runSimBankIVT +runBasicAccountCreditTest +runProvisionedAccountCreditTests -success "Ran Simbank test OK" \ No newline at end of file +success "All SimBank tests Passed." \ No newline at end of file From be535742ca276d8a5a005d389c377c68227aab0a Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 10:55:10 +0100 Subject: [PATCH 02/18] Fix path to build.properties file in the 'galasa' repo Signed-off-by: Jade Carino --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fb948c8c..a174dfe2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,7 +32,7 @@ jobs: - name: Get Galasa Version from build.properties file id: get-galasa-version run: | - cat build.properties | grep "=" >> $GITHUB_OUTPUT + cat ${{ github.workspace }}/galasa/build.properties | grep "=" >> $GITHUB_OUTPUT outputs: galasa-version: ${{ steps.get-galasa-version.outputs.GALASA_VERSION }} From 4a59c3ca17fb076a66cb056550c66e72d3f9dca8 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 11:25:03 +0100 Subject: [PATCH 03/18] Allow maven build of Simplatform app and tests to draw from the development maven repo Signed-off-by: Jade Carino --- .secrets.baseline | 2 +- build-locally.sh | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index 33cc808c..ff61cf9f 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -81,7 +81,7 @@ "hashed_secret": "b60d121b438a380c343d5ec3c2037564b82ffef3", "is_secret": false, "is_verified": false, - "line_number": 74, + "line_number": 76, "type": "Secret Keyword", "verified_result": null } diff --git a/build-locally.sh b/build-locally.sh index 2e210712..3c31a6e3 100755 --- a/build-locally.sh +++ b/build-locally.sh @@ -9,6 +9,9 @@ # # Objectives: Build this repository code locally. # +# Environment variable overrides: +# SOURCE_MAVEN - Optional. Where a maven repository is from which the build will draw artifacts. +# #----------------------------------------------------------------------------------------- # Where is this script executing from ? @@ -99,11 +102,11 @@ project=$(basename ${BASEDIR}) h1 "Building ${project}" -# Over-rode SOURCE_MAVEN if you want to build from a different maven repo... +# Override SOURCE_MAVEN if you want to build from a different maven repo... if [[ -z ${SOURCE_MAVEN} ]]; then export SOURCE_MAVEN=https://development.galasa.dev/main/maven-repo/obr/ info "SOURCE_MAVEN repo defaulting to ${SOURCE_MAVEN}." - info "Set this environment variable if you want to over-ride this value." + info "Set this environment variable if you want to override this value." else info "SOURCE_MAVEN set to ${SOURCE_MAVEN} by caller." fi @@ -169,7 +172,7 @@ function check_secrets { function build_application_code { h1 "Building simplatform application using maven" cd ${BASEDIR}/galasa-simplatform-application - mvn clean install + mvn clean install -Dgalasa.source.repo=${SOURCE_MAVEN} rc=$? if [[ "${rc}" != "0" ]]; then error "make clean install failed. rc=${rc}" @@ -181,7 +184,7 @@ function build_application_code { function build_test_code { h1 "Building simbank tests using maven" cd ${BASEDIR}/galasa-simbank-tests - mvn clean install + mvn clean install -Dgalasa.source.repo=${SOURCE_MAVEN} rc=$? if [[ "${rc}" != "0" ]]; then error "make clean install failed. rc=${rc}" From c42210cad6b4e19b4f1323cae0edb9aa66172ffa Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 11:26:17 +0100 Subject: [PATCH 04/18] Update .secrets.baseline file Signed-off-by: Jade Carino --- .secrets.baseline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.secrets.baseline b/.secrets.baseline index ff61cf9f..33cc808c 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -81,7 +81,7 @@ "hashed_secret": "b60d121b438a380c343d5ec3c2037564b82ffef3", "is_secret": false, "is_verified": false, - "line_number": 76, + "line_number": 74, "type": "Secret Keyword", "verified_result": null } From 4d06995b43a372545f4dca78db2454dad358b9b9 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 11:45:47 +0100 Subject: [PATCH 05/18] Pass the simplatform settings.xml file into the maven build of the Simplatform app and tests Signed-off-by: Jade Carino --- .github/workflows/test.yaml | 2 +- build-locally.sh | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a174dfe2..67192285 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -57,7 +57,7 @@ jobs: path: ${{ github.workspace }}/simplatform - - name: Build Simplatform application + - name: Build Simplatform working-directory: ${{ github.workspace }}/simplatform run: | ./build-locally.sh diff --git a/build-locally.sh b/build-locally.sh index 3c31a6e3..b85e94ef 100755 --- a/build-locally.sh +++ b/build-locally.sh @@ -172,7 +172,10 @@ function check_secrets { function build_application_code { h1 "Building simplatform application using maven" cd ${BASEDIR}/galasa-simplatform-application - mvn clean install -Dgalasa.source.repo=${SOURCE_MAVEN} + mvn clean install \ + -Dgalasa.source.repo=${SOURCE_MAVEN} \ + -Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \ + --settings ${BASEDIR}/settings.xml rc=$? if [[ "${rc}" != "0" ]]; then error "make clean install failed. rc=${rc}" @@ -184,7 +187,10 @@ function build_application_code { function build_test_code { h1 "Building simbank tests using maven" cd ${BASEDIR}/galasa-simbank-tests - mvn clean install -Dgalasa.source.repo=${SOURCE_MAVEN} + mvn clean install \ + -Dgalasa.source.repo=${SOURCE_MAVEN} \ + -Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \ + --settings ${BASEDIR}/settings.xml rc=$? if [[ "${rc}" != "0" ]]; then error "make clean install failed. rc=${rc}" From cd9f2207ae00a3a9d27b9c9e68ad6319c1494cd1 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 13:38:37 +0100 Subject: [PATCH 06/18] Optionally skip docker build and detect secrets steps in build-locally.sh Signed-off-by: Jade Carino --- build-locally.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/build-locally.sh b/build-locally.sh index b85e94ef..bb357685 100755 --- a/build-locally.sh +++ b/build-locally.sh @@ -80,14 +80,22 @@ EOF #----------------------------------------------------------------------------------------- export build_type="" +SKIP_DOCKER=false +SKIP_SECRETS=false + while [ "$1" != "" ]; do case $1 in + --skip-docker ) SKIP_DOCKER=true + ;; + --skip-secrets ) SKIP_SECRETS=true + ;; -h | --help ) usage exit ;; * ) error "Unexpected argument $1" usage exit 1 + ;; esac shift done @@ -213,5 +221,11 @@ function build_docker_image { build_application_code build_test_code -build_docker_image -check_secrets \ No newline at end of file + +if [ "$SKIP_DOCKER" = false ]; then + build_docker_image +fi + +if [ "$SKIP_SECRETS" = false ]; then + check_secrets +fi \ No newline at end of file From edc8a5458ac0f6933ee36c5599414d3edd145d87 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 13:39:03 +0100 Subject: [PATCH 07/18] Do not run docker build and detect secrets steps in build-locally.sh when running it from the Test Simbank workflow Signed-off-by: Jade Carino --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 67192285..7154e276 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -60,7 +60,7 @@ jobs: - name: Build Simplatform working-directory: ${{ github.workspace }}/simplatform run: | - ./build-locally.sh + ./build-locally.sh --skip-docker --skip-secrets #---------------------------------------------------------------------------------- # Set up Galasa environment From 996acd491d3349a8c443744c0970af4dfeb0f932 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 13:59:59 +0100 Subject: [PATCH 08/18] Update Test Simbank workflow to download or build depending on the calling event Signed-off-by: Jade Carino --- .github/workflows/test.yaml | 79 +++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7154e276..6d257c84 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -6,6 +6,7 @@ name: Test SimBank on: + workflow_call: workflow_dispatch: push: branches: [main] @@ -18,7 +19,7 @@ jobs: name: Get Galasa Version # Use the build.properties file in the galasa repo to source the galasa-version output variable. # This variable can be referenced by other jobs in this flow using ${{ needs.get-galasa-version.outputs.galasa-version }} - runs-on: ubuntu-latest + runs-on: macos-latest steps: - name: Checkout 'galasa' repository @@ -37,33 +38,39 @@ jobs: outputs: galasa-version: ${{ steps.get-galasa-version.outputs.GALASA_VERSION }} - run-simbank-tests: - name: Run SimBank Tests - runs-on: ubuntu-latest + build-and-run-simbank-tests: + name: Build and Run SimBank Tests + runs-on: macos-latest - needs: get-galasa-version + needs: [get-galasa-version] env: GALASA_HOME: ${{ github.workspace }}/.galasa steps: - #---------------------------------------------------------------------------------- - # Build the Simplatform application that the tests connect to - - name: Checkout the Simplatform repository - uses: actions/checkout@v4 + # Set up pre-requesite technology (Java, Gradle and galasactl) + - name: Setup JDK + uses: actions/setup-java@v4 with: - repository: ${{ env.NAMESPACE }}/simplatform - path: ${{ github.workspace }}/simplatform - + java-version: '17' + distribution: 'semeru' - - name: Build Simplatform - working-directory: ${{ github.workspace }}/simplatform - run: | - ./build-locally.sh --skip-docker --skip-secrets + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-version: '8.9' + - name: Install galasactl with Homebrew + run: | + brew tap galasa-dev/tap + brew install --no-quarantine galasactl #---------------------------------------------------------------------------------- # Set up Galasa environment + - name: Make Galasa home directory + run: | + mkdir ${{ env.GALASA_HOME }} + - name: Create credentials.properties file working-directory: ${{ env.GALASA_HOME }} run: | @@ -78,6 +85,28 @@ jobs: run: | galasactl local init --log - + #---------------------------------------------------------------------------------- + # Download or build the Simplatform application that the tests connect to + - name: Download SimBank from Main Build + if: ${{ github.event.name == 'workflow_call' }} + uses: actions/download-artifact@v4 + with: + name: simplatform + path: /home/runner/.m2/repository + + - name: Checkout the Simplatform repository + if: ${{ github.event.name == 'workflow_dispatch' || github.event.name == 'push' }} + uses: actions/checkout@v4 + with: + repository: ${{ env.NAMESPACE }}/simplatform + path: ${{ github.workspace }}/simplatform + + - name: Build SimBank using local build script + if: ${{ github.event.name == 'workflow_dispatch' || github.event.name == 'push' }} + working-directory: ${{ github.workspace }}/simplatform + run: | + ./build-locally.sh --skip-docker --skip-secrets + #---------------------------------------------------------------------------------- # Run the Simplatform application - name: Start the Simplatform application @@ -89,26 +118,8 @@ jobs: #---------------------------------------------------------------------------------- # Run the Simbank tests - # - name: Ensure permissions for mounted /galasa directory - # run: | - # sudo mkdir -p ${{ github.workspace }}/galasa - # sudo chown -R 999:999 ${{ github.workspace }}/galasa - - # - name: Clean /galasa workspace in CLI image - # run: | - # docker run --rm \ - # --user galasa:galasa \ - # -v ${{ github.workspace }}/galasa:/galasa \ - # ghcr.io/${{ env.NAMESPACE }}/galasactl-x86_64:main \ - # rm -rf /galasa/* - - name: Run the SimBankIVT run: | - docker run --rm \ - --env GALASA_HOME=${{ env.GALASA_HOME }} \ - --user galasa:galasa \ - -v ${{ github.workspace }}/galasa:/galasa:rw \ - ghcr.io/${{ env.NAMESPACE }}/galasactl-x86_64:main \ galasactl runs submit local \ --obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \ --obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \ From 5e9093b99499f9d910fe74ac19ea6109002ba6c2 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 14:12:19 +0100 Subject: [PATCH 09/18] Fix incorrect if statements to check the workflow trigger event Signed-off-by: Jade Carino --- .github/workflows/build.yaml | 12 ++++++++++++ .github/workflows/test.yaml | 12 +++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1c8a78a4..f244aedc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -83,6 +83,12 @@ jobs: path: galasa-simbank-tests-build.log retention-days: 7 + - name: Upload Simplatform + uses: actions/upload-artifact@v4 + with: + name: simplatform + path: /home/runner/.m2/repository + - name: Login to Github Container Registry uses: docker/login-action@v3 with: @@ -142,6 +148,12 @@ jobs: run: | docker run --env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/argocdcli:main app wait ${{ env.BRANCH }}-simplatform --resource apps:Deployment:simplatform-${{ env.BRANCH }} --health --server argocd.galasa.dev + # run-simbank-tests: + # name: Run the SimBank Tests + # needs: [build-simplatform] + # uses: ./.github/workflows/test.yaml + # secrets: inherit + report-failure: # Skip this job for forks if: ${{ failure() && github.repository_owner == 'galasa-dev' }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6d257c84..b16b5a92 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -6,10 +6,12 @@ name: Test SimBank on: + # This workflow_call is used after the Main Build of Simplatform. workflow_call: + # This workflow_dispatch allows this workflow to be called by a + # scheduled regression run in the Automation repository. It also + # allows this workflow to be called by pressing 'Run Workflow'. workflow_dispatch: - push: - branches: [main] env: NAMESPACE: ${{ github.repository_owner }} @@ -88,21 +90,21 @@ jobs: #---------------------------------------------------------------------------------- # Download or build the Simplatform application that the tests connect to - name: Download SimBank from Main Build - if: ${{ github.event.name == 'workflow_call' }} + if: ${{ github.event_name == 'workflow_call' }} uses: actions/download-artifact@v4 with: name: simplatform path: /home/runner/.m2/repository - name: Checkout the Simplatform repository - if: ${{ github.event.name == 'workflow_dispatch' || github.event.name == 'push' }} + if: ${{ github.event_name == 'workflow_dispatch' }} uses: actions/checkout@v4 with: repository: ${{ env.NAMESPACE }}/simplatform path: ${{ github.workspace }}/simplatform - name: Build SimBank using local build script - if: ${{ github.event.name == 'workflow_dispatch' || github.event.name == 'push' }} + if: ${{ github.event_name == 'workflow_dispatch' }} working-directory: ${{ github.workspace }}/simplatform run: | ./build-locally.sh --skip-docker --skip-secrets From 9be63e26f62d22dd1db8909c5b7563f98130f567 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 14:17:30 +0100 Subject: [PATCH 10/18] Pass in the GALASA_VERSION output to use in the galasactl runs submit local command Signed-off-by: Jade Carino --- .github/workflows/test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b16b5a92..d3867549 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -121,6 +121,8 @@ jobs: #---------------------------------------------------------------------------------- # Run the Simbank tests - name: Run the SimBankIVT + env: + GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }} run: | galasactl runs submit local \ --obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \ From 16aa877287e698f0ffdd0abf9c66c3e2ab7121e4 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 14:24:49 +0100 Subject: [PATCH 11/18] Add a --remoteMaven location to the galasactl runs submit local command so it can find the Uber OBR in the dev maven repo Signed-off-by: Jade Carino --- .github/workflows/test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d3867549..7043af2b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -128,6 +128,7 @@ jobs: --obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \ --obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \ --class dev.galasa.simbank.tests/dev.galasa.simbank.tests.SimBankIVT \ + --remoteMaven https://development.galasa.dev/main/maven-repo/obr \ --log - # - name: Report results into Slack channel From a047acff0370da0a412466f99b9faa656bfbc887 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 14:42:02 +0100 Subject: [PATCH 12/18] Add .galasa directory with cps.properties file for the local tests to use Signed-off-by: Jade Carino --- .galasa/cps.properties | 14 ++++++++++++++ .github/workflows/test.yaml | 26 ++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 .galasa/cps.properties diff --git a/.galasa/cps.properties b/.galasa/cps.properties new file mode 100644 index 00000000..40ad95bd --- /dev/null +++ b/.galasa/cps.properties @@ -0,0 +1,14 @@ +# +# File: cps.properties +# +# Purpose: +# To provide properties to the Galasa runtime when not using a +# Galasa ecosystem. ie: When running locally with a JVM. +# + +zos.dse.tag.SIMBANK.imageid=SIMBANK +zos.image.SIMBANK.ipv4.hostname=127.0.0.1 +zos.image.SIMBANK.telnet.tls=false +zos.image.SIMBANK.telnet.port=2023 +zos.image.SIMBANK.webnet.port=2080 +zos.image.SIMBANK.credentials=SIMBANK \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7043af2b..1fd18de3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -69,10 +69,6 @@ jobs: brew install --no-quarantine galasactl #---------------------------------------------------------------------------------- # Set up Galasa environment - - name: Make Galasa home directory - run: | - mkdir ${{ env.GALASA_HOME }} - - name: Create credentials.properties file working-directory: ${{ env.GALASA_HOME }} run: | @@ -131,6 +127,28 @@ jobs: --remoteMaven https://development.galasa.dev/main/maven-repo/obr \ --log - + - name: Run the BasicAccountCreditTest + env: + GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }} + run: | + galasactl runs submit local \ + --obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \ + --obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \ + --class dev.galasa.simbank.tests/dev.galasa.simbank.tests.BasicAccountCreditTest \ + --remoteMaven https://development.galasa.dev/main/maven-repo/obr \ + --log - + + - name: Run the ProvisionedAccountCreditTests + env: + GALASA_VERSION: ${{ needs.get-galasa-version.outputs.galasa-version }} + run: | + galasactl runs submit local \ + --obr mvn:dev.galasa/dev.galasa.simbank.obr/${GALASA_VERSION}/obr \ + --obr mvn:dev.galasa/dev.galasa.uber.obr/${GALASA_VERSION}/obr \ + --class dev.galasa.simbank.tests/dev.galasa.simbank.tests.ProvisionedAccountCreditTests \ + --remoteMaven https://development.galasa.dev/main/maven-repo/obr \ + --log - + # - name: Report results into Slack channel # env: # SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} From da69a55cc84675665ca5eb6d244701900a70f9c1 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 14:53:37 +0100 Subject: [PATCH 13/18] Checkout Simplatform repo at very start of Test Simbank workflow and fix working directories Signed-off-by: Jade Carino --- .github/workflows/test.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1fd18de3..bb99adb2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -50,6 +50,12 @@ jobs: GALASA_HOME: ${{ github.workspace }}/.galasa steps: + #---------------------------------------------------------------------------------- + - name: Checkout the Simplatform repository + uses: actions/checkout@v4 + with: + repository: ${{ env.NAMESPACE }}/simplatform + #---------------------------------------------------------------------------------- # Set up pre-requesite technology (Java, Gradle and galasactl) - name: Setup JDK @@ -91,17 +97,9 @@ jobs: with: name: simplatform path: /home/runner/.m2/repository - - - name: Checkout the Simplatform repository - if: ${{ github.event_name == 'workflow_dispatch' }} - uses: actions/checkout@v4 - with: - repository: ${{ env.NAMESPACE }}/simplatform - path: ${{ github.workspace }}/simplatform - name: Build SimBank using local build script if: ${{ github.event_name == 'workflow_dispatch' }} - working-directory: ${{ github.workspace }}/simplatform run: | ./build-locally.sh --skip-docker --skip-secrets From ffbd8d6ed17855d3006952216439c3f5a6e695bd Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 14:59:26 +0100 Subject: [PATCH 14/18] Fix incorrect credentials ID in comment in Test Simbank workflow Signed-off-by: Jade Carino --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bb99adb2..4468e1ed 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -81,8 +81,8 @@ jobs: echo "${{ secrets.SIMBANK_CREDENTIALS }}" >> credentials.properties # The credentials.properties file should look something like this: - # secure.credentials.MYSIMBANKUSER.username=XXX - # secure.credentials.MYSIMBANKUSER.password=XXX + # secure.credentials.SIMBANK.username=XXX + # secure.credentials.SIMBANK.password=XXX # Needs to be created dynamically as they cannot be checked into GitHub and exposed. - name: Initialise local Galasa environment to create remaining files and folders From 9e77a9d54976baac315e178b099541769ed0c21d Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 15:14:18 +0100 Subject: [PATCH 15/18] Add missing CPS properties needed for the Simbank manager Signed-off-by: Jade Carino --- .galasa/cps.properties | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.galasa/cps.properties b/.galasa/cps.properties index 40ad95bd..775fa1f9 100644 --- a/.galasa/cps.properties +++ b/.galasa/cps.properties @@ -6,6 +6,10 @@ # Galasa ecosystem. ie: When running locally with a JVM. # +simbank.dse.instance.name=SIMBANK +simbank.instance.SIMBANK.zos.image=SIMBANK +simbank.instance.SIMBANK.credentials.id=SIMBANK + zos.dse.tag.SIMBANK.imageid=SIMBANK zos.image.SIMBANK.ipv4.hostname=127.0.0.1 zos.image.SIMBANK.telnet.tls=false From 19ea9c9adbdc138f11e4ffa15252485aa882739b Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 15:37:59 +0100 Subject: [PATCH 16/18] Update comment in cps.properties file Signed-off-by: Jade Carino --- .galasa/cps.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.galasa/cps.properties b/.galasa/cps.properties index 775fa1f9..9ba7722b 100644 --- a/.galasa/cps.properties +++ b/.galasa/cps.properties @@ -2,8 +2,8 @@ # File: cps.properties # # Purpose: -# To provide properties to the Galasa runtime when not using a -# Galasa ecosystem. ie: When running locally with a JVM. +# To provide properties to the Galasa runtime when running tests in a local JVM. +# These properties are used in the test.yaml Github Actions workflow. # simbank.dse.instance.name=SIMBANK From b46749e6e679a998e8e8bd8f85db0ff2fc845b52 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 15:38:17 +0100 Subject: [PATCH 17/18] Call the Test Simbank workflow at the end of a Main Build Signed-off-by: Jade Carino --- .github/workflows/build.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f244aedc..80219e4f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -148,11 +148,11 @@ jobs: run: | docker run --env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/argocdcli:main app wait ${{ env.BRANCH }}-simplatform --resource apps:Deployment:simplatform-${{ env.BRANCH }} --health --server argocd.galasa.dev - # run-simbank-tests: - # name: Run the SimBank Tests - # needs: [build-simplatform] - # uses: ./.github/workflows/test.yaml - # secrets: inherit + run-simbank-tests: + name: Run the SimBank Tests + needs: [build-simplatform] + uses: ./.github/workflows/test.yaml + secrets: inherit report-failure: # Skip this job for forks From 459804b24f14462d1fbf88c6a1a9c190d1dfa852 Mon Sep 17 00:00:00 2001 From: Jade Carino Date: Fri, 23 May 2025 15:38:29 +0100 Subject: [PATCH 18/18] Update the .secrets.baseline Signed-off-by: Jade Carino --- .secrets.baseline | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.secrets.baseline b/.secrets.baseline index 33cc808c..ddf4bad7 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -76,12 +76,22 @@ } ], "results": { + ".galasa/cps.properties": [ + { + "hashed_secret": "877704f69026efee10f08e8f95568749f2682203", + "is_secret": false, + "is_verified": false, + "line_number": 18, + "type": "Secret Keyword", + "verified_result": null + } + ], ".github/workflows/test.yaml": [ { "hashed_secret": "b60d121b438a380c343d5ec3c2037564b82ffef3", "is_secret": false, "is_verified": false, - "line_number": 74, + "line_number": 85, "type": "Secret Keyword", "verified_result": null }