From 87b7d8a1d0ea7fe1772dfeae1297273f97dc8bef Mon Sep 17 00:00:00 2001 From: Trevor Dolby Date: Tue, 19 Oct 2021 19:13:51 +0100 Subject: [PATCH 01/13] Add gradle files Signed-off-by: Trevor Dolby --- .gitignore | 5 +++++ build.gradle | 46 ++++++++++++++++++++++++++++++++++++++++++++++ settings.gradle | 1 + 3 files changed, 52 insertions(+) create mode 100644 build.gradle create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore index 6dba2b0..bfd3dbd 100644 --- a/.gitignore +++ b/.gitignore @@ -19,5 +19,10 @@ TeaSharedLibrary/TeaSharedLibraryJava.jar **/maven-archiver/* **/*-maven.jar +TeaRESTApplication_UnitTest/TeaRESTApplication_UnitTest.jar + # This shouldn't be needed! TeaRESTApplication_UnitTest/resources + + +.gradle diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..10c3159 --- /dev/null +++ b/build.gradle @@ -0,0 +1,46 @@ +// +// Gradle build file for the ACE demo pipeline +// +// Usage: +// +// gradle -PCLASSPATH=$CLASSPATH [-Pinstall.work.directory=] +// +// + +def baseFilePath = System.getenv("MQSI_BASE_FILEPATH") +def fileSep = System.getProperty("file.separator") +def installWorkDir = "/home/aceuser/ace-server" + +if ( project.hasProperty("install.work.directory") ) { + installWorkDir = project.getProperty("install.work.directory") +} + +task deleteTestWorkDirectory(type: Delete) { + delete '/tmp/gradle-test-work-dir' +} + +task createTestWorkDirectory(type: Exec) { + commandLine baseFilePath + fileSep + 'server' + fileSep + 'bin/mqsicreateworkdir', '/tmp/gradle-test-work-dir' +} + +task buildWithUnitTests(type: Exec) { + commandLine baseFilePath + fileSep + 'server' + fileSep + 'bin/ibmint', 'deploy', '--input-path', "$projectDir", '--output-work-directory', '/tmp/gradle-test-work-dir', '--project', 'TeaSharedLibraryJava', '--project', 'TeaSharedLibrary', '--project', 'TeaRESTApplication', '--project', 'TeaRESTApplication_UnitTest' +} + +task runUnitTests(type: Exec) { + // Gradle throws away the CLASSPATH setting we need :( + // + // Without this setting, errors of the form occur: + // + // 2021-10-19 15:32:51.428952: BIP9320E: Message Flow 'gen.TeaRESTApplication', 'gen.TeaRESTApplication' encountered a failure and could not start. + // 2021-10-19 15:32:51.429000: BIP3944E: Failed to generate the map for mapping routine '{default}:oldToNew_Mapping', with the following details: Location: '' Internal Error Number: 'NoClassDefFoundError' Error Message: 'com.fasterxml.jackson.core.JsonProcessingException'. + // 2021-10-19 15:32:51.429016: BIP3946E: Failed to generate mapping routine 'com.fasterxml.jackson.core.JsonProcessingException + // ', with the following details: '{1}'. + + environment CLASSPATH: project.getProperty("CLASSPATH") + + + commandLine baseFilePath + fileSep + 'server' + fileSep + 'bin/IntegrationServer', '-w', '/tmp/gradle-test-work-dir', '--test-project', 'TeaRESTApplication_UnitTest' +} + +defaultTasks 'deleteTestWorkDirectory', 'createTestWorkDirectory', 'buildWithUnitTests', 'runUnitTests' diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..07d21de --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'ace-demo-pipeline' From 352d77842a2a366d76a7ddef5ec2ed37fe04d0e5 Mon Sep 17 00:00:00 2001 From: Trevor Dolby Date: Tue, 19 Oct 2021 19:15:26 +0100 Subject: [PATCH 02/13] Modify github action Signed-off-by: Trevor Dolby --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a47848f..c9880b0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: ######################################################################## # # Download ace-minimal image; could use ace-minimal-build but in our - # case we already have Maven and the various utilities contained in + # case we already have Gradle and the various utilities contained in # the build image, so we download the base image because it's smaller. # ######################################################################## @@ -65,12 +65,12 @@ jobs: . ace-minimal-image-unzip/opt/ibm/ace-12/server/bin/mqsiprofile # Using ace-minimal without WXS support export MQSI_NO_CACHE_SUPPORT=1 - # Make sure Maven and others can find the correct javac + # Make sure Gradle and others can find the correct javac export PATH=$PWD/ace-minimal-image-unzip/opt/ibm/ace-12/common/jdk/bin:$PATH ######################################################################## # - # Run the Maven build and unit test phases + # Run the Gradle build and unit test phases # ######################################################################## - echo "Running Maven install to $PWD/ace-server . . ." - mvn --no-transfer-progress verify + echo "Running Gradle build and unit test" + gradle -PCLASSPATH=$CLASSPATH From 78515cdce71dc4411c74486df7b6f5a7e6e633cf Mon Sep 17 00:00:00 2001 From: Trevor Dolby <32941192+tdolby-at-uk-ibm-com@users.noreply.github.com> Date: Tue, 19 Oct 2021 19:22:35 +0100 Subject: [PATCH 03/13] Change PATH --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c9880b0..3fa4654 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,7 +66,7 @@ jobs: # Using ace-minimal without WXS support export MQSI_NO_CACHE_SUPPORT=1 # Make sure Gradle and others can find the correct javac - export PATH=$PWD/ace-minimal-image-unzip/opt/ibm/ace-12/common/jdk/bin:$PATH + # export PATH=$PWD/ace-minimal-image-unzip/opt/ibm/ace-12/common/jdk/bin:$PATH ######################################################################## # # Run the Gradle build and unit test phases From ee4ac37db271f439b1bde891114070da9b39ac7e Mon Sep 17 00:00:00 2001 From: Trevor Dolby <32941192+tdolby-at-uk-ibm-com@users.noreply.github.com> Date: Tue, 19 Oct 2021 19:32:36 +0100 Subject: [PATCH 04/13] Try ibmint --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3fa4654..4d58a46 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -72,5 +72,8 @@ jobs: # Run the Gradle build and unit test phases # ######################################################################## + mqsicreateworkdir /tmp/eXp2021WorkDir + echo "Running ibmint by itself" + ibmint deploy --input-path $PWD --output-work-directory /tmp/eXp2021WorkDir --project TeaSharedLibraryJava --project TeaSharedLibrary --project TeaRESTApplication --project TeaRESTApplication_UnitTest echo "Running Gradle build and unit test" gradle -PCLASSPATH=$CLASSPATH From 07f4d643f815d3333a3839b26eac36278a6463f8 Mon Sep 17 00:00:00 2001 From: Trevor Dolby <32941192+tdolby-at-uk-ibm-com@users.noreply.github.com> Date: Wed, 20 Oct 2021 15:23:34 +0100 Subject: [PATCH 05/13] Examine directories --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4d58a46..c62a203 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,7 +73,8 @@ jobs: # ######################################################################## mqsicreateworkdir /tmp/eXp2021WorkDir - echo "Running ibmint by itself" + df -k + echo "Running ibmint by itself in directory $PWD" ibmint deploy --input-path $PWD --output-work-directory /tmp/eXp2021WorkDir --project TeaSharedLibraryJava --project TeaSharedLibrary --project TeaRESTApplication --project TeaRESTApplication_UnitTest echo "Running Gradle build and unit test" gradle -PCLASSPATH=$CLASSPATH From 1f982a8816fcdd9ed533acd7ba80161319352850 Mon Sep 17 00:00:00 2001 From: Trevor Dolby <32941192+tdolby-at-uk-ibm-com@users.noreply.github.com> Date: Wed, 20 Oct 2021 15:33:12 +0100 Subject: [PATCH 06/13] Shift product install up one level --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c62a203..14f2992 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,6 +35,7 @@ jobs: # the build image, so we download the base image because it's smaller. # ######################################################################## + cd .. curl -so moby-download-frozen-image-v2.sh https://raw.githubusercontent.com/moby/moby/master/contrib/download-frozen-image-v2.sh mkdir ace-minimal-download bash moby-download-frozen-image-v2.sh ace-minimal-download tdolby/experimental:ace-minimal-12.0.2.0-alpine @@ -74,6 +75,7 @@ jobs: ######################################################################## mqsicreateworkdir /tmp/eXp2021WorkDir df -k + cd ace-demo-pipeline echo "Running ibmint by itself in directory $PWD" ibmint deploy --input-path $PWD --output-work-directory /tmp/eXp2021WorkDir --project TeaSharedLibraryJava --project TeaSharedLibrary --project TeaRESTApplication --project TeaRESTApplication_UnitTest echo "Running Gradle build and unit test" From 2425f95652827f802ddb8370baea1e8e5a298577 Mon Sep 17 00:00:00 2001 From: Trevor Dolby <32941192+tdolby-at-uk-ibm-com@users.noreply.github.com> Date: Wed, 20 Oct 2021 15:36:22 +0100 Subject: [PATCH 07/13] Fix cwd issue --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 14f2992..af15852 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -62,6 +62,7 @@ jobs: # ######################################################################## export LICENSE=accept + cd .. export MQSI_WORKPATH=$PWD/ace-minimal-image-unzip/var/mqsi . ace-minimal-image-unzip/opt/ibm/ace-12/server/bin/mqsiprofile # Using ace-minimal without WXS support From 4ba7667e1f8f8f5d51bd8992691073052efdc3bd Mon Sep 17 00:00:00 2001 From: Trevor Dolby <32941192+tdolby-at-uk-ibm-com@users.noreply.github.com> Date: Wed, 20 Oct 2021 15:46:25 +0100 Subject: [PATCH 08/13] Move code not install --- .github/workflows/main.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index af15852..73b9473 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,6 +28,8 @@ jobs: # Runs a set of commands using the runners shell - name: Download ACE image run: | + mkdir build + mv * build ######################################################################## # # Download ace-minimal image; could use ace-minimal-build but in our @@ -35,7 +37,6 @@ jobs: # the build image, so we download the base image because it's smaller. # ######################################################################## - cd .. curl -so moby-download-frozen-image-v2.sh https://raw.githubusercontent.com/moby/moby/master/contrib/download-frozen-image-v2.sh mkdir ace-minimal-download bash moby-download-frozen-image-v2.sh ace-minimal-download tdolby/experimental:ace-minimal-12.0.2.0-alpine @@ -62,7 +63,6 @@ jobs: # ######################################################################## export LICENSE=accept - cd .. export MQSI_WORKPATH=$PWD/ace-minimal-image-unzip/var/mqsi . ace-minimal-image-unzip/opt/ibm/ace-12/server/bin/mqsiprofile # Using ace-minimal without WXS support @@ -75,8 +75,7 @@ jobs: # ######################################################################## mqsicreateworkdir /tmp/eXp2021WorkDir - df -k - cd ace-demo-pipeline + cd build echo "Running ibmint by itself in directory $PWD" ibmint deploy --input-path $PWD --output-work-directory /tmp/eXp2021WorkDir --project TeaSharedLibraryJava --project TeaSharedLibrary --project TeaRESTApplication --project TeaRESTApplication_UnitTest echo "Running Gradle build and unit test" From 7376bee21b0c58c41535d53eb9949f87a662f2c1 Mon Sep 17 00:00:00 2001 From: Trevor Dolby <32941192+tdolby-at-uk-ibm-com@users.noreply.github.com> Date: Wed, 20 Oct 2021 15:47:52 +0100 Subject: [PATCH 09/13] Fix mv issue --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 73b9473..e9c410f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,7 @@ jobs: - name: Download ACE image run: | mkdir build - mv * build + mv * build || /bin/true ######################################################################## # # Download ace-minimal image; could use ace-minimal-build but in our From e1d41dd971ea79771fdf0b7c3f454770d36fe472 Mon Sep 17 00:00:00 2001 From: Trevor Dolby Date: Wed, 20 Oct 2021 17:32:32 +0100 Subject: [PATCH 10/13] Update gradle build to avoid node.js blowup Signed-off-by: Trevor Dolby --- .github/workflows/main.yml | 18 +++++++++++++----- build.gradle | 4 ++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9c410f..7b01b97 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,8 +28,17 @@ jobs: # Runs a set of commands using the runners shell - name: Download ACE image run: | + ######################################################################## + # + # We move the source to the build directory to make sure it is not in + # the same directory as the downloaded install image. If the source + # stays where it is, then ibmint tries to scan it for projects! + # + ######################################################################## + echo "Moving source to the build directory" mkdir build mv * build || /bin/true + ######################################################################## # # Download ace-minimal image; could use ace-minimal-build but in our @@ -42,8 +51,10 @@ jobs: bash moby-download-frozen-image-v2.sh ace-minimal-download tdolby/experimental:ace-minimal-12.0.2.0-alpine mkdir ace-minimal-image-unzip cd ace-minimal-download && grep layer.tar manifest.json | tr -d '"' | tr -d ',' | xargs -n 1 tar -C ../ace-minimal-image-unzip -xf && cd - && rm -rf ace-minimal-download + # Not actually running on Alpine, so we undo a hack sed -i 's/\/bin\/mksh/\/bin\/bash/g' ace-minimal-image-unzip/opt/ibm/ace-12/ace ace-minimal-image-unzip/opt/ibm/ace-12/server/bin/mqsicreateworkdir ace-minimal-image-unzip/opt/ibm/ace-12/server/bin/mqsipackagebar + ######################################################################## # # Set up ACE environment and ensure downloaded image works @@ -65,18 +76,15 @@ jobs: export LICENSE=accept export MQSI_WORKPATH=$PWD/ace-minimal-image-unzip/var/mqsi . ace-minimal-image-unzip/opt/ibm/ace-12/server/bin/mqsiprofile + # Using ace-minimal without WXS support export MQSI_NO_CACHE_SUPPORT=1 - # Make sure Gradle and others can find the correct javac - # export PATH=$PWD/ace-minimal-image-unzip/opt/ibm/ace-12/common/jdk/bin:$PATH + ######################################################################## # # Run the Gradle build and unit test phases # ######################################################################## - mqsicreateworkdir /tmp/eXp2021WorkDir cd build - echo "Running ibmint by itself in directory $PWD" - ibmint deploy --input-path $PWD --output-work-directory /tmp/eXp2021WorkDir --project TeaSharedLibraryJava --project TeaSharedLibrary --project TeaRESTApplication --project TeaRESTApplication_UnitTest echo "Running Gradle build and unit test" gradle -PCLASSPATH=$CLASSPATH diff --git a/build.gradle b/build.gradle index 10c3159..48d970f 100644 --- a/build.gradle +++ b/build.gradle @@ -39,8 +39,8 @@ task runUnitTests(type: Exec) { environment CLASSPATH: project.getProperty("CLASSPATH") - - commandLine baseFilePath + fileSep + 'server' + fileSep + 'bin/IntegrationServer', '-w', '/tmp/gradle-test-work-dir', '--test-project', 'TeaRESTApplication_UnitTest' + // Exclude node.js for ace-minimal build + commandLine baseFilePath + fileSep + 'server' + fileSep + 'bin/IntegrationServer', '-w', '/tmp/gradle-test-work-dir', '--test-project', 'TeaRESTApplication_UnitTest', '--admin-rest-api', '-1', '--no-nodejs' } defaultTasks 'deleteTestWorkDirectory', 'createTestWorkDirectory', 'buildWithUnitTests', 'runUnitTests' From 0260a3da3644459d723e8bbbdd11de804b11462d Mon Sep 17 00:00:00 2001 From: Trevor Dolby Date: Wed, 20 Oct 2021 17:33:35 +0100 Subject: [PATCH 11/13] Fix tabs Signed-off-by: Trevor Dolby --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b01b97..14a4ef3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,10 +35,10 @@ jobs: # stays where it is, then ibmint tries to scan it for projects! # ######################################################################## - echo "Moving source to the build directory" + echo "Moving source to the build directory" mkdir build mv * build || /bin/true - + ######################################################################## # # Download ace-minimal image; could use ace-minimal-build but in our From eec8d85119048f524faa52ad0af1d87576d640bf Mon Sep 17 00:00:00 2001 From: Trevor Dolby Date: Wed, 20 Oct 2021 17:35:58 +0100 Subject: [PATCH 12/13] Break unit test to make sure CI build fails Signed-off-by: Trevor Dolby --- .../demo/tea/TeaRESTApplication_LogAuditData_Tests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TeaRESTApplication_UnitTest/src/main/java/com/ibm/ot4i/ace/pipeline/demo/tea/TeaRESTApplication_LogAuditData_Tests.java b/TeaRESTApplication_UnitTest/src/main/java/com/ibm/ot4i/ace/pipeline/demo/tea/TeaRESTApplication_LogAuditData_Tests.java index b3ecba2..95174ca 100644 --- a/TeaRESTApplication_UnitTest/src/main/java/com/ibm/ot4i/ace/pipeline/demo/tea/TeaRESTApplication_LogAuditData_Tests.java +++ b/TeaRESTApplication_UnitTest/src/main/java/com/ibm/ot4i/ace/pipeline/demo/tea/TeaRESTApplication_LogAuditData_Tests.java @@ -87,7 +87,7 @@ public void TeaRESTApplication_LogAuditData_RemoveXML_Test() throws TestExceptio TestMessageAssembly actualMessageAssembly = nodeSpy.propagatedMessageAssembly("out", 1); // Make sure the JSON still exists - assertEquals("Earl Grey", actualMessageAssembly.messagePath("JSON.Data.name").getStringValue()); + assertEquals("EarlGrey", actualMessageAssembly.messagePath("JSON.Data.name").getStringValue()); // And that XMLNSC does not Exception exception = assertThrows(TestException.class, () -> { actualMessageAssembly.messagePath("XMLNSC.logData.info.name").getValueAsString(); From 57f6687993b5c5ca703b1f2f59e69e44a17344fc Mon Sep 17 00:00:00 2001 From: Trevor Dolby Date: Wed, 20 Oct 2021 17:38:16 +0100 Subject: [PATCH 13/13] Unbreak unit tests Signed-off-by: Trevor Dolby --- .../demo/tea/TeaRESTApplication_LogAuditData_Tests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TeaRESTApplication_UnitTest/src/main/java/com/ibm/ot4i/ace/pipeline/demo/tea/TeaRESTApplication_LogAuditData_Tests.java b/TeaRESTApplication_UnitTest/src/main/java/com/ibm/ot4i/ace/pipeline/demo/tea/TeaRESTApplication_LogAuditData_Tests.java index 95174ca..b3ecba2 100644 --- a/TeaRESTApplication_UnitTest/src/main/java/com/ibm/ot4i/ace/pipeline/demo/tea/TeaRESTApplication_LogAuditData_Tests.java +++ b/TeaRESTApplication_UnitTest/src/main/java/com/ibm/ot4i/ace/pipeline/demo/tea/TeaRESTApplication_LogAuditData_Tests.java @@ -87,7 +87,7 @@ public void TeaRESTApplication_LogAuditData_RemoveXML_Test() throws TestExceptio TestMessageAssembly actualMessageAssembly = nodeSpy.propagatedMessageAssembly("out", 1); // Make sure the JSON still exists - assertEquals("EarlGrey", actualMessageAssembly.messagePath("JSON.Data.name").getStringValue()); + assertEquals("Earl Grey", actualMessageAssembly.messagePath("JSON.Data.name").getStringValue()); // And that XMLNSC does not Exception exception = assertThrows(TestException.class, () -> { actualMessageAssembly.messagePath("XMLNSC.logData.info.name").getValueAsString();