Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
224d3a9
Bash script for running the Simbank app and all IVTs locally, GH work…
jadecarino May 23, 2025
be53574
Fix path to build.properties file in the 'galasa' repo
jadecarino May 23, 2025
4a59c3c
Allow maven build of Simplatform app and tests to draw from the devel…
jadecarino May 23, 2025
c42210c
Update .secrets.baseline file
jadecarino May 23, 2025
4d06995
Pass the simplatform settings.xml file into the maven build of the Si…
jadecarino May 23, 2025
cd9f220
Optionally skip docker build and detect secrets steps in build-locall…
jadecarino May 23, 2025
edc8a54
Do not run docker build and detect secrets steps in build-locally.sh …
jadecarino May 23, 2025
996acd4
Update Test Simbank workflow to download or build depending on the ca…
jadecarino May 23, 2025
5e9093b
Fix incorrect if statements to check the workflow trigger event
jadecarino May 23, 2025
9be63e2
Pass in the GALASA_VERSION output to use in the galasactl runs submit…
jadecarino May 23, 2025
16aa877
Add a --remoteMaven location to the galasactl runs submit local comma…
jadecarino May 23, 2025
a047acf
Add .galasa directory with cps.properties file for the local tests to…
jadecarino May 23, 2025
da69a55
Checkout Simplatform repo at very start of Test Simbank workflow and …
jadecarino May 23, 2025
ffbd8d6
Fix incorrect credentials ID in comment in Test Simbank workflow
jadecarino May 23, 2025
9e77a9d
Add missing CPS properties needed for the Simbank manager
jadecarino May 23, 2025
19ea9c9
Update comment in cps.properties file
jadecarino May 23, 2025
b46749e
Call the Test Simbank workflow at the end of a Main Build
jadecarino May 23, 2025
459804b
Update the .secrets.baseline
jadecarino May 23, 2025
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
18 changes: 18 additions & 0 deletions .galasa/cps.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# File: cps.properties
#
# Purpose:
# 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
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
zos.image.SIMBANK.telnet.port=2023
zos.image.SIMBANK.webnet.port=2080
zos.image.SIMBANK.credentials=SIMBANK
12 changes: 12 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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' }}
Expand Down
162 changes: 162 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
#
# Copyright contributors to the Galasa project
#
# SPDX-License-Identifier: EPL-2.0
#
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:

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: macos-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 ${{ github.workspace }}/galasa/build.properties | grep "=" >> $GITHUB_OUTPUT

outputs:
galasa-version: ${{ steps.get-galasa-version.outputs.GALASA_VERSION }}

build-and-run-simbank-tests:
name: Build and Run SimBank Tests
runs-on: macos-latest

needs: [get-galasa-version]

env:
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
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'semeru'

- 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: 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.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
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: Build SimBank using local build script
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
./build-locally.sh --skip-docker --skip-secrets

#----------------------------------------------------------------------------------
# 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: 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 \
--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: 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 }}
# 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 }}
23 changes: 22 additions & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,28 @@
"name": "TwilioKeyDetector"
}
],
"results": {},
"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": 85,
"type": "Secret Keyword",
"verified_result": null
}
]
},
"version": "0.13.1+ibm.62.dss",
"word_list": {
"file": null,
Expand Down
35 changes: 29 additions & 6 deletions build-locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?
Expand Down Expand Up @@ -77,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
Expand All @@ -99,11 +110,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
Expand Down Expand Up @@ -169,7 +180,10 @@ 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} \
-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}"
Expand All @@ -181,7 +195,10 @@ 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} \
-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}"
Expand All @@ -204,5 +221,11 @@ function build_docker_image {

build_application_code
build_test_code
build_docker_image
check_secrets

if [ "$SKIP_DOCKER" = false ]; then
build_docker_image
fi

if [ "$SKIP_SECRETS" = false ]; then
check_secrets
fi
Loading