From 11baf913236e06b6415c8e5f2a2699548e73116e Mon Sep 17 00:00:00 2001 From: Matt Nayler Date: Thu, 8 Dec 2022 11:00:18 +0000 Subject: [PATCH 1/8] Enable cleanup of helm release on success --- Jenkinsfile_CNP | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index 37e675cf..8c847130 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -94,6 +94,8 @@ withPipeline(type, product, component) { env.TEST_URL="https://ccd-data-store-api-ccd-next-hearing-date-updater-pr-${CHANGE_ID}.service.core-compute-preview.internal" // This is really not needed but here as a hack around TLS url env.CCD_DATA_STORE_API_BASE_URL = "https://ccd-data-store-api-ccd-next-hearing-date-updater-pr-${CHANGE_ID}.service.core-compute-preview.internal" env.DEFINITION_STORE_URL_BASE = "https://ccd-definition-store-ccd-next-hearing-date-updater-pr-${CHANGE_ID}.service.core-compute-preview.internal" + + enableCleanupOfHelmReleaseOnSuccess() } onNonPR { env.ENV='aat' From 951d3cf67a8de343110015a9b4df6d0d2b551899 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 19:09:54 +0000 Subject: [PATCH 2/8] Bump uk.gov.hmcts.java from 0.12.34 to 0.12.39 Bumps uk.gov.hmcts.java from 0.12.34 to 0.12.39. --- updated-dependencies: - dependency-name: uk.gov.hmcts.java dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a2c7e2f5..a25f72ff 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { id 'org.springframework.boot' version '2.7.5' id 'com.github.ben-manes.versions' version '0.42.0' id 'org.sonarqube' version '3.3' - id 'uk.gov.hmcts.java' version '0.12.34' + id 'uk.gov.hmcts.java' version '0.12.39' id 'com.github.hmcts.rse-cft-lib' version '0.19.496' id 'com.github.spacialcircumstances.gradle-cucumber-reporting' version '0.1.23' } From 0a4401dfdf4cacbfdbb0f15954a9659eb36143f8 Mon Sep 17 00:00:00 2001 From: Matt Nayler Date: Tue, 31 Jan 2023 12:26:11 +0000 Subject: [PATCH 3/8] HMAN-493 add `keep-helm` label check to jenkins [HMAN-493](https://tools.hmcts.net/jira/browse/HMAN-493) Add `keep-helm` label check to jenkins. --- Jenkinsfile_CNP | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index c18f0d9a..ad690bf0 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -1,5 +1,6 @@ #!groovy import uk.gov.hmcts.contino.AppPipelineDsl +import uk.gov.hmcts.contino.GithubAPI import uk.gov.hmcts.contino.GradleBuilder import uk.gov.hmcts.contino.HealthChecker @@ -96,7 +97,10 @@ withPipeline(type, product, component) { env.DEFINITION_STORE_URL_BASE = "https://ccd-definition-store-ccd-next-hearing-date-updater-pr-${CHANGE_ID}.service.core-compute-preview.internal" env.TEST_STUB_SERVICE_BASE_URL = "http://ccd-next-hearing-date-updater-pr-${CHANGE_ID}-ccd-test-stubs-service" // NB : when def file is imported this will lead to data-store.preview -> test-stub.preview. - enableCleanupOfHelmReleaseOnSuccess() + def githubApi = new GithubAPI(this) + if (!githubApi.getLabelsbyPattern(env.BRANCH_NAME, "keep-helm")) { + enableCleanupOfHelmReleaseAlways() + } } onNonPR { env.ENV='aat' From 69e9a78872798f8604c98ae775303f5d4dfea073 Mon Sep 17 00:00:00 2001 From: Matt Nayler Date: Tue, 31 Jan 2023 16:18:26 +0000 Subject: [PATCH 4/8] HMAN-514 test updates to cnp-jenkins-library [HMAN-514](https://tools.hmcts.net/jira/browse/HMAN-514) Test against hmcts/cnp-jenkins-library#987. --- Jenkinsfile_CNP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index ad690bf0..dcb90b88 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -16,7 +16,7 @@ properties([ disableConcurrentBuilds() ]) -@Library("Infrastructure") +@Library("Infrastructure@HMAN-514_functionalTest_nonServiceApp") def type = "java" def product = "ccd" From 307d0ce90b0a21eb25751df3b54d2252390b7fd7 Mon Sep 17 00:00:00 2001 From: Matt Nayler Date: Tue, 31 Jan 2023 16:51:05 +0000 Subject: [PATCH 5/8] HMAN-514 TEST_URL no longer required for FTAs [HMAN-514](https://tools.hmcts.net/jira/browse/HMAN-514) Remove TEST_URL as it will no longer be required for Functional tests. --- Jenkinsfile_CNP | 2 -- Jenkinsfile_nightly | 1 - build.gradle | 4 ++-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index dcb90b88..77e03151 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -92,7 +92,6 @@ withPipeline(type, product, component) { onPR { enableSlackNotifications('#ccd-pr-builds') env.ENV='preview' - env.TEST_URL="https://ccd-data-store-api-ccd-next-hearing-date-updater-pr-${CHANGE_ID}.service.core-compute-preview.internal" // This is really not needed but here as a hack around TLS url env.CCD_DATA_STORE_API_BASE_URL = "https://ccd-data-store-api-ccd-next-hearing-date-updater-pr-${CHANGE_ID}.service.core-compute-preview.internal" env.DEFINITION_STORE_URL_BASE = "https://ccd-definition-store-ccd-next-hearing-date-updater-pr-${CHANGE_ID}.service.core-compute-preview.internal" env.TEST_STUB_SERVICE_BASE_URL = "http://ccd-next-hearing-date-updater-pr-${CHANGE_ID}-ccd-test-stubs-service" // NB : when def file is imported this will lead to data-store.preview -> test-stub.preview. @@ -104,7 +103,6 @@ withPipeline(type, product, component) { } onNonPR { env.ENV='aat' - env.TEST_URL="http://ccd-data-store-api-aat.service.core-compute-aat.internal" env.CCD_DATA_STORE_API_BASE_URL = "http://ccd-data-store-api-aat.service.core-compute-aat.internal" env.DEFINITION_STORE_URL_BASE = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal" } diff --git a/Jenkinsfile_nightly b/Jenkinsfile_nightly index f0578e23..f15eff2c 100644 --- a/Jenkinsfile_nightly +++ b/Jenkinsfile_nightly @@ -78,7 +78,6 @@ withNightlyPipeline(type, product, component) { // apply standard `onNonPR` env variables for nightly env.ENV='aat' - env.TEST_URL="http://ccd-data-store-api-aat.service.core-compute-aat.internal" env.CCD_DATA_STORE_API_BASE_URL = "http://ccd-data-store-api-aat.service.core-compute-aat.internal" env.DEFINITION_STORE_URL_BASE = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal" diff --git a/build.gradle b/build.gradle index a25f72ff..4d3c9027 100644 --- a/build.gradle +++ b/build.gradle @@ -335,8 +335,8 @@ dependencies { functionalTestImplementation group: 'io.vavr', name: 'vavr', version: '0.10.4' functionalTestImplementation group: 'io.rest-assured', name: 'rest-assured', version: '4.4.0' - functionalTestImplementation group: 'com.github.hmcts', name: 'befta-fw', version: '8.7.6' - functionalTestImplementation group: 'com.github.hmcts', name: 'ccd-test-definitions', version: '7.19.5' + functionalTestImplementation group: 'com.github.hmcts', name: 'befta-fw', version: '8.7.10' + functionalTestImplementation group: 'com.github.hmcts', name: 'ccd-test-definitions', version: '7.19.12' } From b382d6a95f58bcbbf24787307865aabc1db04827 Mon Sep 17 00:00:00 2001 From: Matt Nayler Date: Tue, 31 Jan 2023 17:44:24 +0000 Subject: [PATCH 6/8] HMAN-514 enable FunctionalTest stage in jenkins [HMAN-514](https://tools.hmcts.net/jira/browse/HMAN-514) Enable the FunctionalTest stage in jenkins config. --- Jenkinsfile_CNP | 63 ++++++++++++++++++++++++++++----------------- Jenkinsfile_nightly | 48 ++++++++++++---------------------- 2 files changed, 56 insertions(+), 55 deletions(-) diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index 77e03151..ed2c2bbf 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -2,7 +2,6 @@ import uk.gov.hmcts.contino.AppPipelineDsl import uk.gov.hmcts.contino.GithubAPI import uk.gov.hmcts.contino.GradleBuilder -import uk.gov.hmcts.contino.HealthChecker properties([ [ @@ -91,11 +90,14 @@ withPipeline(type, product, component) { } onPR { enableSlackNotifications('#ccd-pr-builds') + env.ENV='preview' env.CCD_DATA_STORE_API_BASE_URL = "https://ccd-data-store-api-ccd-next-hearing-date-updater-pr-${CHANGE_ID}.service.core-compute-preview.internal" env.DEFINITION_STORE_URL_BASE = "https://ccd-definition-store-ccd-next-hearing-date-updater-pr-${CHANGE_ID}.service.core-compute-preview.internal" env.TEST_STUB_SERVICE_BASE_URL = "http://ccd-next-hearing-date-updater-pr-${CHANGE_ID}-ccd-test-stubs-service" // NB : when def file is imported this will lead to data-store.preview -> test-stub.preview. + enableFullFunctionalTestNonServiceApp(env.CCD_DATA_STORE_API_BASE_URL) + def githubApi = new GithubAPI(this) if (!githubApi.getLabelsbyPattern(env.BRANCH_NAME, "keep-helm")) { enableCleanupOfHelmReleaseAlways() @@ -105,6 +107,8 @@ withPipeline(type, product, component) { env.ENV='aat' env.CCD_DATA_STORE_API_BASE_URL = "http://ccd-data-store-api-aat.service.core-compute-aat.internal" env.DEFINITION_STORE_URL_BASE = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal" + + enableFullFunctionalTestNonServiceApp(env.CCD_DATA_STORE_API_BASE_URL) } enableAksStagingDeployment() @@ -139,32 +143,43 @@ withPipeline(type, product, component) { junit '**/test-results/test/*.xml' } - afterAlways('akschartsinstall') { + before('functionalTest:preview') { + // NB: override IDAM_API_URL late so its value does not corrupt config used in integration tests + env.IDAM_API_URL = env.IDAM_API_URL_BASE - // check data-store instance is up - def healthChecker = new HealthChecker(this) - healthChecker.check("$CCD_DATA_STORE_API_BASE_URL/health", 10, 40) - - try { - // NB: override IDAM_API_URL late so its value does not corrupt config used in integration tests - env.IDAM_API_URL = env.IDAM_API_URL_BASE + // suppress SSL warnings as we are crossing boundary jenkins -> preview `feign.httpclient.disable-ssl-validation: true` + env.FEIGN_HTTPCLIENT_DISABLE_SSL_VALIDATION = true + } - // suppress SSL warnings as we are crossing boundary jenkins -> preview `feign.httpclient.disable-ssl-validation: true` - env.FEIGN_HTTPCLIENT_DISABLE_SSL_VALIDATION = true + before('functionalTest:aat') { + // NB: override IDAM_API_URL late so its value does not corrupt config used in integration tests + env.IDAM_API_URL = env.IDAM_API_URL_BASE + } - builder.functionalTest() - } finally { + afterAlways('functionalTest:preview') { + publishHTML target: [ + allowMissing : true, + alwaysLinkToLastBuild: true, + keepAll : true, + reportDir : "build/reports/tests/functional", + reportFiles : "overview-features.html,overview-failures.html,", + reportTitles : "Features,Failures", + reportName : "Next Hearing Date Updater Functional Test Report" + ] + junit '**/test-results/functional/*.xml' + } - publishHTML target: [ - allowMissing : true, - alwaysLinkToLastBuild: true, - keepAll : true, - reportDir : "build/reports/tests/functional", - reportFiles : "overview-features.html,overview-failures.html,", - reportTitles : "Features,Failures", - reportName : "Next Hearing Date Updater Functional Test Report" - ] - junit '**/test-results/functional/*.xml' - } + afterAlways('functionalTest:aat') { + publishHTML target: [ + allowMissing : true, + alwaysLinkToLastBuild: true, + keepAll : true, + reportDir : "build/reports/tests/functional", + reportFiles : "overview-features.html,overview-failures.html,", + reportTitles : "Features,Failures", + reportName : "Next Hearing Date Updater Functional Test Report" + ] + junit '**/test-results/functional/*.xml' } + } diff --git a/Jenkinsfile_nightly b/Jenkinsfile_nightly index f15eff2c..d08acf94 100644 --- a/Jenkinsfile_nightly +++ b/Jenkinsfile_nightly @@ -82,43 +82,29 @@ withNightlyPipeline(type, product, component) { env.DEFINITION_STORE_URL_BASE = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal" - enableAksStagingDeployment() disableLegacyDeployment() loadVaultSecrets(secrets) nonServiceApp() enableMutationTest() - enableFullFunctionalTest() - afterAlways('fortify-scan') { - steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Fortify Scan/**/*' - } + enableFullFunctionalTestNonServiceApp(env.CCD_DATA_STORE_API_BASE_URL) before('fullFunctionalTest') { - echo "Loading the secrets" - loadVaultSecrets(secrets) - - - // Execute functional tests - echo "Just waiting a while to ensure that the pod has run the job" - sh "sleep 30s" - echo "Verifying that functional test run correctly" - try { - // NB: override IDAM_API_URL late as per `Jenkinsfile_CNP` tests - env.IDAM_API_URL = env.IDAM_API_URL_BASE - - builder.functionalTest() - } finally { - - publishHTML target: [ - allowMissing : true, - alwaysLinkToLastBuild: true, - keepAll : true, - reportDir : "build/reports/tests/functional", - reportFiles : "overview-features.html,overview-failures.html,", - reportTitles : "Features,Failures", - reportName : "Next Hearing Date Updater Functional Test Report" - ] - junit '**/test-results/functional/*.xml' - } + // NB: override IDAM_API_URL late as per `Jenkinsfile_CNP` tests + env.IDAM_API_URL = env.IDAM_API_URL_BASE + } + + afterAlways('fullFunctionalTest') { + publishHTML target: [ + allowMissing : true, + alwaysLinkToLastBuild: true, + keepAll : true, + reportDir : "build/reports/tests/functional", + reportFiles : "overview-features.html,overview-failures.html,", + reportTitles : "Features,Failures", + reportName : "Next Hearing Date Updater Functional Test Report" + ] + junit '**/test-results/functional/*.xml' } + } From 27ac460b1b74344d8d5a4eaf92d082c098dae115 Mon Sep 17 00:00:00 2001 From: Matt Nayler Date: Fri, 10 Feb 2023 14:42:33 +0000 Subject: [PATCH 7/8] HMAN-514 Developer review updates [HMAN-514](https://tools.hmcts.net/jira/browse/HMAN-514) Developer review updates: * move `enableFullFunctionalTestNonServiceApp(...)` call. --- Jenkinsfile_CNP | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index ed2c2bbf..4a2f960d 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -96,8 +96,6 @@ withPipeline(type, product, component) { env.DEFINITION_STORE_URL_BASE = "https://ccd-definition-store-ccd-next-hearing-date-updater-pr-${CHANGE_ID}.service.core-compute-preview.internal" env.TEST_STUB_SERVICE_BASE_URL = "http://ccd-next-hearing-date-updater-pr-${CHANGE_ID}-ccd-test-stubs-service" // NB : when def file is imported this will lead to data-store.preview -> test-stub.preview. - enableFullFunctionalTestNonServiceApp(env.CCD_DATA_STORE_API_BASE_URL) - def githubApi = new GithubAPI(this) if (!githubApi.getLabelsbyPattern(env.BRANCH_NAME, "keep-helm")) { enableCleanupOfHelmReleaseAlways() @@ -107,8 +105,6 @@ withPipeline(type, product, component) { env.ENV='aat' env.CCD_DATA_STORE_API_BASE_URL = "http://ccd-data-store-api-aat.service.core-compute-aat.internal" env.DEFINITION_STORE_URL_BASE = "http://ccd-definition-store-api-aat.service.core-compute-aat.internal" - - enableFullFunctionalTestNonServiceApp(env.CCD_DATA_STORE_API_BASE_URL) } enableAksStagingDeployment() @@ -117,6 +113,8 @@ withPipeline(type, product, component) { nonServiceApp() syncBranchesWithMaster(branchesToSync) + enableFullFunctionalTestNonServiceApp(env.CCD_DATA_STORE_API_BASE_URL) + afterAlways('test') { // hmcts/cnp-jenkins-library may fail to copy artifacts after checkstyle error so repeat command (see /src/uk/gov/hmcts/contino/GradleBuilder.groovy) steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/reports/checkstyle/*.html' From 8797421da845562d5edc6cba8488a30eaf76fc78 Mon Sep 17 00:00:00 2001 From: Matt Nayler Date: Tue, 14 Feb 2023 12:40:40 +0000 Subject: [PATCH 8/8] Update Helm release job to 0.7.10 --- charts/ccd-next-hearing-date-updater/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/ccd-next-hearing-date-updater/Chart.yaml b/charts/ccd-next-hearing-date-updater/Chart.yaml index 481c7e1a..5e97d221 100644 --- a/charts/ccd-next-hearing-date-updater/Chart.yaml +++ b/charts/ccd-next-hearing-date-updater/Chart.yaml @@ -8,7 +8,7 @@ maintainers: - name: HMCTS CCD Team dependencies: - name: job - version: ~0.7.9 + version: ~0.7.10 repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/' - name: elasticsearch version: 7.8.2