diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..e166aa6 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,129 @@ +name: Main build + +on: + workflow_dispatch: + push: + branches: [main] + +env: + REGISTRY: ghcr.io + NAMESPACE: galasa-dev + BRANCH: ${{ github.ref_name }} + +jobs: + log-github-ref: + name: Log the GitHub ref this workflow is running on (Branch or tag that received dispatch) + runs-on: ubuntu-latest + steps: + - name: Log GitHub ref of workflow + run: | + echo "This workflow is running on GitHub ref ${{ env.BRANCH }}" + + build-simplatform: + name: Building Simplatform web application and tests + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'semeru' + + - name: Print Githash + run: | + echo $GITHUB_SHA > ./simplatform.githash + + - name: Building galasa-simplatform-application using maven + run: | + set -o pipefail + mvn -f galasa-simplatform-application/pom.xml deploy -X \ + -Dgalasa.source.repo=https://development.galasa.dev/${{ env.BRANCH }}/maven-repo/obr \ + -Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \ + -Dgalasa.release.repo=file:${{ github.workspace }}/repo \ + --batch-mode --errors --fail-at-end \ + --settings ${{ github.workspace }}/settings.xml 2>&1 | tee galasa-simplatform-application-build.log + + - name: Upload galasa-simplatform-application Maven Build Log + if: failure() + uses: actions/upload-artifact@v4 + with: + name: galasa-simplatform-application-build-log + path: galasa-simplatform-application-build.log + retention-days: 7 + + - name: Building galasa-simbank-tests using maven + run: | + set -o pipefail + mvn -f galasa-simbank-tests/pom.xml deploy -X \ + -Dgalasa.source.repo=https://development.galasa.dev/${{ env.BRANCH }}/maven-repo/obr \ + -Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \ + -Dgalasa.release.repo=file:${{ github.workspace }}/repo \ + --batch-mode --errors --fail-at-end \ + --settings ${{ github.workspace }}/settings.xml 2>&1 | tee galasa-simbank-tests-build.log + + - name: Upload galasa-simbank-tests Maven Build Log + if: failure() + uses: actions/upload-artifact@v4 + with: + name: galasa-simbank-tests-build-log + path: galasa-simbank-tests-build.log + retention-days: 7 + + - name: Login to Github Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for Simplatform maven artefacts image + id: metadata-simplatform + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/simplatform-maven-artefacts + + - name: Build Simplatform image for development Maven registry + id: build-simplatform + uses: docker/build-push-action@v5 + with: + context: . + file: dockerfiles/dockerfile.simplatform + push: true + tags: ${{ steps.metadata-simplatform.outputs.tags }} + labels: ${{ steps.metadata-simplatform.outputs.labels }} + build-args: | + baseVersion=latest + dockerRepository=ghcr.io + branch=${{ env.BRANCH }} + + - name: Extract metadata for Simplatform jar image + id: metadata-simplatform-jar + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/simplatform-jar + + - name: Build simplatform jar image + id: build-simplatform-jar + uses: docker/build-push-action@v5 + with: + context: . + file: dockerfiles/dockerfile.simplatform-amd64 + push: true + tags: ${{ steps.metadata-simplatform-jar.outputs.tags }} + labels: ${{ steps.metadata-simplatform-jar.outputs.labels }} + + - name: Recycle application in ArgoCD + env: + ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_TOKEN }} + run: | + docker run --env ARGOCD_AUTH_TOKEN=${{ env.ARGOCD_AUTH_TOKEN }} --rm -v ${{ github.workspace }}:/var/workspace ghcr.io/galasa-dev/argocdcli:main app actions run gh-simplatform restart --kind Deployment --resource-name simplatform-gh --server argocd.galasa.dev + + - name: Wait for app health in ArgoCD + env: + ARGOCD_AUTH_TOKEN: ${{ secrets.ARGOCD_TOKEN }} + 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 gh-simplatform --resource apps:Deployment:simplatform-gh --health --server argocd.galasa.dev \ No newline at end of file diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml new file mode 100644 index 0000000..4360aff --- /dev/null +++ b/.github/workflows/pr-build.yaml @@ -0,0 +1,82 @@ +name: PR build + +on: + pull_request: + branches: [main] + +jobs: + build-simplatform: + name: Build Simplatform web application and tests + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'semeru' + + - name: Print Githash + run: | + echo $GITHUB_SHA > ./simplatform.githash + + - name: Building galasa-simplatform-application using maven + run: | + set -o pipefail + mvn -f galasa-simplatform-application/pom.xml deploy -X \ + -Dgpg.skip=true \ + -Dgalasa.source.repo=https://development.galasa.dev/main/maven-repo/obr \ + -Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \ + -Dgalasa.release.repo=file:${{ github.workspace }}/repo \ + --batch-mode --errors --fail-at-end \ + --settings ${{ github.workspace }}/settings.xml 2>&1 | tee galasa-simplatform-application-build.log + + - name: Upload galasa-simplatform-application Maven Build Log + if: failure() + uses: actions/upload-artifact@v4 + with: + name: galasa-simplatform-application-build-log + path: galasa-simplatform-application-build.log + retention-days: 7 + + - name: Building galasa-simbank-tests using maven + run: | + set -o pipefail + mvn -f galasa-simbank-tests/pom.xml deploy -X \ + -Dgpg.skip=true \ + -Dgalasa.source.repo=https://development.galasa.dev/main/maven-repo/obr \ + -Dgalasa.central.repo=https://repo.maven.apache.org/maven2/ \ + -Dgalasa.release.repo=file:${{ github.workspace }}/repo \ + --batch-mode --errors --fail-at-end \ + --settings ${{ github.workspace }}/settings.xml 2>&1 | tee galasa-simbank-tests-build.log + + - name: Upload galasa-simbank-tests Maven Build Log + if: failure() + uses: actions/upload-artifact@v4 + with: + name: galasa-simbank-tests-build-log + path: galasa-simbank-tests-build.log + retention-days: 7 + + - name: Build Simplatform image for testing + uses: docker/build-push-action@v5 + with: + context: . + file: dockerfiles/dockerfile.simplatform + load: true + tags: simplatform-maven-artefacts:test + build-args: | + baseVersion=latest + dockerRepository=ghcr.io + branch=main + + - name: Build Simplatform jar image for testing + uses: docker/build-push-action@v5 + with: + context: . + file: dockerfiles/dockerfile.simplatform-amd64 + load: true + tags: simplatform-jar:test \ No newline at end of file diff --git a/dockerfiles/dockerfile.simplatform b/dockerfiles/dockerfile.simplatform new file mode 100644 index 0000000..f6d2143 --- /dev/null +++ b/dockerfiles/dockerfile.simplatform @@ -0,0 +1,11 @@ +ARG baseVersion +ARG dockerRepository +FROM ${dockerRepository}/galasa-dev/base-image:${baseVersion} + +ARG branch + +RUN sed -i "s/--branchname--/${branch}/" /usr/local/apache2/conf/httpd.conf +RUN sed -i 's/--repositoryname--/simplatform/' /usr/local/apache2/conf/httpd.conf + +COPY repo/ /usr/local/apache2/htdocs/ +COPY simplatform.githash /usr/local/apache2/htdocs/simplatform.githash \ No newline at end of file diff --git a/dockerfiles/dockerfile.simplatform-amd64 b/dockerfiles/dockerfile.simplatform-amd64 new file mode 100644 index 0000000..707aba3 --- /dev/null +++ b/dockerfiles/dockerfile.simplatform-amd64 @@ -0,0 +1,20 @@ +FROM harbor.galasa.dev/docker_proxy_cache/library/openjdk:11-jdk + +RUN mkdir /galasa + +RUN useradd -u 1000 -d /galasa galasa && \ + chown -R galasa:galasa /galasa + +WORKDIR /galasa + +USER galasa + +COPY galasa-simplatform-application/galasa-simplatform-3270/target/galasa-simplatform-0.38.0.jar /galasa/simplatform.jar + +VOLUME /galasa/.galasa +VOLUME /galasa/load + +EXPOSE 2080/tcp +EXPOSE 2023/tcp +EXPOSE 2027/tcp +EXPOSE 2040/tcp \ No newline at end of file diff --git a/galasa-simbank-tests/dev.galasa.simbank.gherkin.tests/pom.xml b/galasa-simbank-tests/dev.galasa.simbank.gherkin.tests/pom.xml index f284cd8..b4e0212 100644 --- a/galasa-simbank-tests/dev.galasa.simbank.gherkin.tests/pom.xml +++ b/galasa-simbank-tests/dev.galasa.simbank.gherkin.tests/pom.xml @@ -4,7 +4,7 @@ dev.galasa galasa-simbanktests-parent - 0.25.0 + 0.38.0 dev.galasa.simbank.gherkin.tests diff --git a/galasa-simbank-tests/dev.galasa.simbank.manager/pom-example.xml b/galasa-simbank-tests/dev.galasa.simbank.manager/pom-example.xml index b53891f..f92a367 100644 --- a/galasa-simbank-tests/dev.galasa.simbank.manager/pom-example.xml +++ b/galasa-simbank-tests/dev.galasa.simbank.manager/pom-example.xml @@ -23,7 +23,7 @@ dev.galasa galasa-bom - 0.25.0 + 0.38.0 pom import diff --git a/galasa-simbank-tests/dev.galasa.simbank.manager/pom.xml b/galasa-simbank-tests/dev.galasa.simbank.manager/pom.xml index 55c8f77..39b980a 100644 --- a/galasa-simbank-tests/dev.galasa.simbank.manager/pom.xml +++ b/galasa-simbank-tests/dev.galasa.simbank.manager/pom.xml @@ -4,14 +4,14 @@ dev.galasa galasa-simbanktests-parent - 0.25.0 + 0.38.0 Galasa SimBank Manager dev.galasa.simbank.manager 0.25.0 - + bundle diff --git a/galasa-simbank-tests/dev.galasa.simbank.obr/pom.xml b/galasa-simbank-tests/dev.galasa.simbank.obr/pom.xml index 3c6a3d5..ad11279 100644 --- a/galasa-simbank-tests/dev.galasa.simbank.obr/pom.xml +++ b/galasa-simbank-tests/dev.galasa.simbank.obr/pom.xml @@ -6,14 +6,13 @@ dev.galasa galasa-simbanktests-parent - 0.25.0 + 0.38.0 Galasa SimBank OBR dev.galasa.simbank.obr - 0.25.0 - + 0.38.0 galasa-obr @@ -25,7 +24,7 @@ dev.galasa dev.galasa.simbank.tests - 0.25.0 + 0.38.0 compile diff --git a/galasa-simbank-tests/dev.galasa.simbank.tests/pom-example.xml b/galasa-simbank-tests/dev.galasa.simbank.tests/pom-example.xml index 5cf4bb4..c83bef7 100644 --- a/galasa-simbank-tests/dev.galasa.simbank.tests/pom-example.xml +++ b/galasa-simbank-tests/dev.galasa.simbank.tests/pom-example.xml @@ -23,7 +23,7 @@ dev.galasa galasa-bom - 0.25.0 + 0.38.0 pom import diff --git a/galasa-simbank-tests/dev.galasa.simbank.tests/pom.xml b/galasa-simbank-tests/dev.galasa.simbank.tests/pom.xml index 2664649..b23bd28 100644 --- a/galasa-simbank-tests/dev.galasa.simbank.tests/pom.xml +++ b/galasa-simbank-tests/dev.galasa.simbank.tests/pom.xml @@ -4,14 +4,14 @@ dev.galasa galasa-simbanktests-parent - 0.25.0 + 0.38.0 Galasa SimBank Example Tests dev.galasa.simbank.tests - 0.25.0 - + 0.38.0 + bundle diff --git a/galasa-simbank-tests/dev.galasa.simbank.tests/src/main/java/dev/galasa/simbank/tests/SimBankIVT.java b/galasa-simbank-tests/dev.galasa.simbank.tests/src/main/java/dev/galasa/simbank/tests/SimBankIVT.java index bde8cc0..a101f95 100644 --- a/galasa-simbank-tests/dev.galasa.simbank.tests/src/main/java/dev/galasa/simbank/tests/SimBankIVT.java +++ b/galasa-simbank-tests/dev.galasa.simbank.tests/src/main/java/dev/galasa/simbank/tests/SimBankIVT.java @@ -8,15 +8,10 @@ import static org.assertj.core.api.Assertions.assertThat; import dev.galasa.Test; -import dev.galasa.artifact.BundleResources; -import dev.galasa.artifact.IBundleResources; import dev.galasa.core.manager.CoreManager; import dev.galasa.core.manager.ICoreManager; -import dev.galasa.http.HttpClient; -import dev.galasa.http.IHttpClient; import dev.galasa.zos.IZosImage; import dev.galasa.zos.ZosImage; -import dev.galasa.zos.ZosManagerException; import dev.galasa.zos3270.ITerminal; import dev.galasa.zos3270.Zos3270Terminal; @@ -29,12 +24,6 @@ public class SimBankIVT { @Zos3270Terminal(imageTag = "SIMBANK") public ITerminal terminal; - @BundleResources - public IBundleResources resources; - - @HttpClient - public IHttpClient client; - @CoreManager public ICoreManager coreManager; @@ -50,7 +39,7 @@ public class SimBankIVT { * @throws Exception */ @Test - public void checkBankIsAvailable() throws Exception{ + public void checkBankIsAvailable() throws Exception { // Register the password to the confidential text filtering service coreManager.registerConfidentialText("SYS1", "IBMUSER password"); diff --git a/galasa-simbank-tests/pom.xml b/galasa-simbank-tests/pom.xml index f59d2a3..83623b9 100644 --- a/galasa-simbank-tests/pom.xml +++ b/galasa-simbank-tests/pom.xml @@ -3,8 +3,7 @@ dev.galasa galasa-simbanktests-parent - 0.25.0 - + 0.38.0 pom Galasa Sample SimBank Tests @@ -76,7 +75,7 @@ dev.galasa galasa-bom - 0.25.0 + 0.38.0 pom import @@ -184,7 +183,7 @@ dev.galasa galasa-maven-plugin - 0.29.0 + 0.34.0 org.eclipse.m2e diff --git a/galasa-simplatform-application/galasa-simplatform-3270/pom.xml b/galasa-simplatform-application/galasa-simplatform-3270/pom.xml index 605dce3..a7cc9f5 100644 --- a/galasa-simplatform-application/galasa-simplatform-3270/pom.xml +++ b/galasa-simplatform-application/galasa-simplatform-3270/pom.xml @@ -4,12 +4,13 @@ dev.galasa galasa-simplatform-parent - 0.24.0 + 0.38.0 dev.galasa galasa-simplatform - 0.24.0 + 0.38.0 + jar @@ -21,7 +22,7 @@ dev.galasa dev.galasa.zos.manager - 0.31.0 + 0.34.0 diff --git a/galasa-simplatform-application/galasa-simplatform-webapp/pom.xml b/galasa-simplatform-application/galasa-simplatform-webapp/pom.xml index e1e2ee6..2b82a6c 100644 --- a/galasa-simplatform-application/galasa-simplatform-webapp/pom.xml +++ b/galasa-simplatform-application/galasa-simplatform-webapp/pom.xml @@ -6,12 +6,12 @@ dev.galasa galasa-simplatform-parent - 0.24.0 + 0.38.0 dev.galasa galasa-simplatform-webapp - 0.24.0 + 0.38.0 war galasa-simplatform-webapp Maven Webapp @@ -47,5 +47,12 @@ galasa-simplatform-webapp + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + diff --git a/galasa-simplatform-application/pom.xml b/galasa-simplatform-application/pom.xml index f7c1db8..d5ec04c 100644 --- a/galasa-simplatform-application/pom.xml +++ b/galasa-simplatform-application/pom.xml @@ -3,7 +3,7 @@ dev.galasa galasa-simplatform-parent - 0.24.0 + 0.38.0 pom Galasa SimPlatform @@ -70,7 +70,7 @@ dev.galasa dev.galasa.zos3270.manager - 0.31.0 + 0.36.0 diff --git a/run-locally.sh b/run-locally.sh index 2a3ce4e..0858c96 100755 --- a/run-locally.sh +++ b/run-locally.sh @@ -121,7 +121,7 @@ fi # Main logic. #----------------------------------------------------------------------------------------- -SIMBANK_VERSION="0.24.0" +SIMBANK_VERSION="0.38.0" function run_server { h1 "Running Simbank back-end server application (version ${SIMBANK_VERSION}) ..." diff --git a/test-locally.sh b/test-locally.sh index ac37a52..ac4a4fd 100755 --- a/test-locally.sh +++ b/test-locally.sh @@ -114,7 +114,7 @@ h1 "Running Simbank application tests" checkGalasaCtlAvailable -TEST_OBR_VERSION="0.25.0" +TEST_OBR_VERSION="0.38.0" mkdir -p ${BASEDIR}/temp cd ${BASEDIR}/temp