From ebd55eab985c2475b9a65b82514774f479086263 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 14:15:41 -0400 Subject: [PATCH 01/27] DACCESS-345 - switch credential to new jenkins server --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index d231d0665..79308df65 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - GIT_ACCESS_TOKEN = credentials('f3b46a8a-a247-4703-baf7-c27c69656aaa') + GIT_ACCESS_TOKEN = credentials('be6a5f7e-d674-4265-bdf9-f20267b9cee3') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" SOLR_URL = credentials('FOLIO_FEW_solr_url') STORAGE_URL = "http://digcoll.internal.library.cornell.edu:8080/fcrepo/rest" From 8c0b955193ea85fae8252e40bf5a1992b499935c Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 14:22:01 -0400 Subject: [PATCH 02/27] DACCESS-345 - try a copilot trick --- jenkins/Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 79308df65..913783338 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -31,7 +31,9 @@ pipeline { } } echo 'Run prelude.sh' - sh 'jenkins/prelude.sh' + node { + sh 'jenkins/prelude.sh' + } } } From 4e6f1da918b82cb4ca8fcf41879b204d686d66b1 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 14:25:23 -0400 Subject: [PATCH 03/27] DACCESS-345 - label it --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 913783338..53c6e21a0 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -31,7 +31,7 @@ pipeline { } } echo 'Run prelude.sh' - node { + node('run-prelude') { sh 'jenkins/prelude.sh' } } From be74cf2832bacd918ea11001c5894262caee60cf Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 14:34:34 -0400 Subject: [PATCH 04/27] DACCESS-345 - more labeled node --- jenkins/Jenkinsfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 53c6e21a0..bb0fa64cb 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -40,7 +40,9 @@ pipeline { stage("Rspec tests") { steps { echo "Running Rspec tests" - sh 'jenkins/rspec.sh' + node('run-rspec-tests') { + sh 'jenkins/rspec.sh' + } } } @@ -87,7 +89,9 @@ pipeline { post { success { echo "The thrill of victory" - sh 'jenkins/report-status-to-github.sh success' + node('report-success-to-github') { + sh 'jenkins/report-status-to-github.sh success' + } script { if (BRANCH_NAME ==~ /PR-.+/) { slackSend channel: "#discovery-and-access", color: "#00ff00", message: "Build Successful - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" @@ -96,7 +100,9 @@ pipeline { } unsuccessful { echo "The agony of defeat" - sh 'jenkins/report-status-to-github.sh failure' + node('report-failure-to-github') { + sh 'jenkins/report-status-to-github.sh failure' + } script { if (BRANCH_NAME ==~ /PR-.+/) { // slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" From e3f9e57807c56a0fa2be3ded5a51824d1ea2d82e Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 14:48:25 -0400 Subject: [PATCH 05/27] DACCESS-345 - try label Built-In-Node from Jenkins --- jenkins/Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index bb0fa64cb..bdbae9f99 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -31,7 +31,7 @@ pipeline { } } echo 'Run prelude.sh' - node('run-prelude') { + node('Built-In-Node') { sh 'jenkins/prelude.sh' } } @@ -40,7 +40,7 @@ pipeline { stage("Rspec tests") { steps { echo "Running Rspec tests" - node('run-rspec-tests') { + node('Built-In-Node') { sh 'jenkins/rspec.sh' } } @@ -89,7 +89,7 @@ pipeline { post { success { echo "The thrill of victory" - node('report-success-to-github') { + node('Built-In-Node') { sh 'jenkins/report-status-to-github.sh success' } script { @@ -100,7 +100,7 @@ pipeline { } unsuccessful { echo "The agony of defeat" - node('report-failure-to-github') { + node('Built-In-Node') { sh 'jenkins/report-status-to-github.sh failure' } script { From 7fc9369faa4398e0fd0c85778530154d223056df Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 15:10:25 -0400 Subject: [PATCH 06/27] DACCESS-345 - use controller label --- jenkins/Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index bdbae9f99..bc4c9a4ef 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -31,7 +31,7 @@ pipeline { } } echo 'Run prelude.sh' - node('Built-In-Node') { + node('controller') { sh 'jenkins/prelude.sh' } } @@ -40,7 +40,7 @@ pipeline { stage("Rspec tests") { steps { echo "Running Rspec tests" - node('Built-In-Node') { + node('controller') { sh 'jenkins/rspec.sh' } } @@ -89,7 +89,7 @@ pipeline { post { success { echo "The thrill of victory" - node('Built-In-Node') { + node('controller') { sh 'jenkins/report-status-to-github.sh success' } script { @@ -100,7 +100,7 @@ pipeline { } unsuccessful { echo "The agony of defeat" - node('Built-In-Node') { + node('controller') { sh 'jenkins/report-status-to-github.sh failure' } script { From 1feb750171d57f6baf09abfa76d484dea238892d Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 15:17:30 -0400 Subject: [PATCH 07/27] DACCESS-345 - use cul-util/****** (cul-util Github personal access token as user/pass) --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index bc4c9a4ef..474d4c624 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - GIT_ACCESS_TOKEN = credentials('be6a5f7e-d674-4265-bdf9-f20267b9cee3') + GIT_ACCESS_TOKEN = credentials('8adf6139-b5f5-408a-99c5-135aa578cfdf') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" SOLR_URL = credentials('FOLIO_FEW_solr_url') STORAGE_URL = "http://digcoll.internal.library.cornell.edu:8080/fcrepo/rest" From 0487b16fb018b3fa1482447073b803463b574d72 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 15:41:18 -0400 Subject: [PATCH 08/27] DACCESS-345 - try Bearer instead of token --- jenkins/report-status-to-github.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/report-status-to-github.sh b/jenkins/report-status-to-github.sh index 510c8c3e2..526402561 100755 --- a/jenkins/report-status-to-github.sh +++ b/jenkins/report-status-to-github.sh @@ -3,6 +3,6 @@ STATUS="$1" curl "https://api.GitHub.com/repos/cul-it/blacklight-cornell/statuses/$GIT_COMMIT" \ -H "Content-Type: application/json" \ - -H "Authorization: token $GIT_ACCESS_TOKEN" \ + -H "Authorization: Bearer $GIT_ACCESS_TOKEN" \ -X POST \ -d "{\"state\": \"$STATUS\",\"context\": \"DISCOVERYACCESS/continuous-integration/jenkins\", \"description\": \"Jenkins\", \"target_url\": \"https://awsjenkins.library.cornell.edu/job/$JENKINS_PROJECT/$BUILD_NUMBER/console\"}" From 9b57d82812be11d8b462a9ff1835c874cb86226f Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 15:59:18 -0400 Subject: [PATCH 09/27] DACCESS-345 - try simple greetings step --- jenkins/Jenkinsfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 474d4c624..937267a24 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -17,11 +17,16 @@ pipeline { OKAPI_PW = credentials('OKAPI_PW') } stages { - stage('Set up and run bundler') { + stage('Greetings') { steps { - echo 'Setting up bundler' + echo 'Hello, Jenkins!' echo 'Branch: ' + BRANCH_NAME echo 'Git Branch: ' + GIT_BRANCH + } + } + stage('Set up and run bundler') { + steps { + echo 'Setting up bundler' script { if (BRANCH_NAME ==~ /PR-.+/) { // slackSend channel: "#discovery-and-access", color: "#439FE0", message: "Pull Request Started - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" From 7abdaff222b0e5e1c842b5c59650c1e2bf76e201 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 16:14:25 -0400 Subject: [PATCH 10/27] DACCESS-345 - superstitious tweaks --- jenkins/Jenkinsfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 937267a24..ec2fc69e8 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,5 +1,5 @@ pipeline { - agent any + agent { label 'controller' } environment { GIT_ACCESS_TOKEN = credentials('8adf6139-b5f5-408a-99c5-135aa578cfdf') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" @@ -22,8 +22,12 @@ pipeline { echo 'Hello, Jenkins!' echo 'Branch: ' + BRANCH_NAME echo 'Git Branch: ' + GIT_BRANCH + echo 'Git Commit: ' + GIT_COMMIT + echo 'Jenkins Project: ' + JENKINS_PROJECT + echo 'Build Number: ' + BUILD_NUMBER } } + stage('Set up and run bundler') { steps { echo 'Setting up bundler' From 3e56fb6ede6cac39a3528819a02b65c706ae79b8 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 16:33:25 -0400 Subject: [PATCH 11/27] DACCESS-345 - remove the node () {} stuff --- jenkins/Jenkinsfile | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index ec2fc69e8..b69cc3052 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,5 +1,5 @@ pipeline { - agent { label 'controller' } + agent any environment { GIT_ACCESS_TOKEN = credentials('8adf6139-b5f5-408a-99c5-135aa578cfdf') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" @@ -40,18 +40,14 @@ pipeline { } } echo 'Run prelude.sh' - node('controller') { - sh 'jenkins/prelude.sh' - } + sh 'jenkins/prelude.sh' } } stage("Rspec tests") { steps { echo "Running Rspec tests" - node('controller') { - sh 'jenkins/rspec.sh' - } + sh 'jenkins/rspec.sh' } } @@ -98,9 +94,7 @@ pipeline { post { success { echo "The thrill of victory" - node('controller') { - sh 'jenkins/report-status-to-github.sh success' - } + sh 'jenkins/report-status-to-github.sh success' script { if (BRANCH_NAME ==~ /PR-.+/) { slackSend channel: "#discovery-and-access", color: "#00ff00", message: "Build Successful - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" @@ -109,9 +103,7 @@ pipeline { } unsuccessful { echo "The agony of defeat" - node('controller') { - sh 'jenkins/report-status-to-github.sh failure' - } + sh 'jenkins/report-status-to-github.sh failure' script { if (BRANCH_NAME ==~ /PR-.+/) { // slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" From 280df0f6fa26c73a8d461a150a447dcabd5d31c8 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 16:41:02 -0400 Subject: [PATCH 12/27] DACCESS-345 - node label for agent success failure --- jenkins/Jenkinsfile | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index b69cc3052..7cfe2b386 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,5 +1,5 @@ pipeline { - agent any + agent { label 'my-node-label' } environment { GIT_ACCESS_TOKEN = credentials('8adf6139-b5f5-408a-99c5-135aa578cfdf') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" @@ -93,21 +93,25 @@ pipeline { } post { success { - echo "The thrill of victory" - sh 'jenkins/report-status-to-github.sh success' - script { - if (BRANCH_NAME ==~ /PR-.+/) { - slackSend channel: "#discovery-and-access", color: "#00ff00", message: "Build Successful - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" + node('my-node-label') { + echo "The thrill of victory" + sh 'jenkins/report-status-to-github.sh success' + script { + if (BRANCH_NAME ==~ /PR-.+/) { + slackSend channel: "#discovery-and-access", color: "#00ff00", message: "Build Successful - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" + } } } } unsuccessful { - echo "The agony of defeat" - sh 'jenkins/report-status-to-github.sh failure' - script { - if (BRANCH_NAME ==~ /PR-.+/) { - // slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" - slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed ${CHANGE_BRANCH} --> ${CHANGE_TARGET}" + node('my-node-label') { + echo "The agony of defeat" + sh 'jenkins/report-status-to-github.sh failure' + script { + if (BRANCH_NAME ==~ /PR-.+/) { + // slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" + slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed ${CHANGE_BRANCH} --> ${CHANGE_TARGET}" + } } } } From 5a757cb069acaa9833b1b31601d403f7d320dfd8 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 16:43:00 -0400 Subject: [PATCH 13/27] DACCESS-345 - controller as label --- jenkins/Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 7cfe2b386..49e00df6c 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,5 +1,5 @@ pipeline { - agent { label 'my-node-label' } + agent { label 'controller' } environment { GIT_ACCESS_TOKEN = credentials('8adf6139-b5f5-408a-99c5-135aa578cfdf') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" @@ -93,7 +93,7 @@ pipeline { } post { success { - node('my-node-label') { + node('controller') { echo "The thrill of victory" sh 'jenkins/report-status-to-github.sh success' script { @@ -104,7 +104,7 @@ pipeline { } } unsuccessful { - node('my-node-label') { + node('controller') { echo "The agony of defeat" sh 'jenkins/report-status-to-github.sh failure' script { From 7d78dbf1dc743fbeb24d70e9a1b08089bcbb2ee4 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Mon, 12 Aug 2024 16:47:51 -0400 Subject: [PATCH 14/27] DACCESS-345 - try Github personal access token as cul-util --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 49e00df6c..3a0b8cfd9 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent { label 'controller' } environment { - GIT_ACCESS_TOKEN = credentials('8adf6139-b5f5-408a-99c5-135aa578cfdf') + GIT_ACCESS_TOKEN = credentials('be6a5f7e-d674-4265-bdf9-f20267b9cee3') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" SOLR_URL = credentials('FOLIO_FEW_solr_url') STORAGE_URL = "http://digcoll.internal.library.cornell.edu:8080/fcrepo/rest" From e4765d8c21d6be6b27b66b48893ad0cb3bed23f7 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 08:35:35 -0400 Subject: [PATCH 15/27] DACCESS-345 - remove breaking code --- jenkins/Jenkinsfile | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 3a0b8cfd9..ea5a4fe59 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -51,17 +51,6 @@ pipeline { } } - // use this version for quick turnaround while testing pull request validation - // stage("cucumber all tests") { - // steps { - // timeout(60) { - // wrap([$class: 'Xvfb', additionalOptions: '', assignedLabels: '', autoDisplayName: true, debug: true, displayNameOffset: 0, installationName: 'default', parallelBuild: true, screen: '1024x758x24', timeout: 25]) { - // sh 'jenkins/cucumber-features.sh features/catalog_search/book_bags.feature:8' - // } - // } - // } - // } - // use this version for normal situations stage("cucumber all tests") { steps { From 14222d69cd109ea7d971185aee8fbbb29e57c1e2 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 08:42:15 -0400 Subject: [PATCH 16/27] DACCESS-357 - any agent, no report --- jenkins/Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index ea5a4fe59..aafb54a6f 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,5 +1,5 @@ pipeline { - agent { label 'controller' } + agent any environment { GIT_ACCESS_TOKEN = credentials('be6a5f7e-d674-4265-bdf9-f20267b9cee3') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" @@ -84,7 +84,7 @@ pipeline { success { node('controller') { echo "The thrill of victory" - sh 'jenkins/report-status-to-github.sh success' + // sh 'jenkins/report-status-to-github.sh success' script { if (BRANCH_NAME ==~ /PR-.+/) { slackSend channel: "#discovery-and-access", color: "#00ff00", message: "Build Successful - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" @@ -95,7 +95,7 @@ pipeline { unsuccessful { node('controller') { echo "The agony of defeat" - sh 'jenkins/report-status-to-github.sh failure' + // sh 'jenkins/report-status-to-github.sh failure' script { if (BRANCH_NAME ==~ /PR-.+/) { // slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" From 6aee49db00559eac5810554f8f985a310dd67ac6 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 08:45:49 -0400 Subject: [PATCH 17/27] DACCESS-357 - remove node ('controller') --- jenkins/Jenkinsfile | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index aafb54a6f..77854c5be 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -82,25 +82,21 @@ pipeline { } post { success { - node('controller') { - echo "The thrill of victory" - // sh 'jenkins/report-status-to-github.sh success' - script { - if (BRANCH_NAME ==~ /PR-.+/) { - slackSend channel: "#discovery-and-access", color: "#00ff00", message: "Build Successful - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" - } + echo "The thrill of victory" + // sh 'jenkins/report-status-to-github.sh success' + script { + if (BRANCH_NAME ==~ /PR-.+/) { + slackSend channel: "#discovery-and-access", color: "#00ff00", message: "Build Successful - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" } } } unsuccessful { - node('controller') { - echo "The agony of defeat" - // sh 'jenkins/report-status-to-github.sh failure' - script { - if (BRANCH_NAME ==~ /PR-.+/) { - // slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" - slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed ${CHANGE_BRANCH} --> ${CHANGE_TARGET}" - } + echo "The agony of defeat" + // sh 'jenkins/report-status-to-github.sh failure' + script { + if (BRANCH_NAME ==~ /PR-.+/) { + // slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" + slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed ${CHANGE_BRANCH} --> ${CHANGE_TARGET}" } } } From 8fdf26ffea05604f8579478bb000862668101a9a Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 08:49:12 -0400 Subject: [PATCH 18/27] DACCESS-357 - save wip jenkinsfile --- jenkins/Jenkinsfile.original | 119 +++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 jenkins/Jenkinsfile.original diff --git a/jenkins/Jenkinsfile.original b/jenkins/Jenkinsfile.original new file mode 100644 index 000000000..3a0b8cfd9 --- /dev/null +++ b/jenkins/Jenkinsfile.original @@ -0,0 +1,119 @@ +pipeline { + agent { label 'controller' } + environment { + GIT_ACCESS_TOKEN = credentials('be6a5f7e-d674-4265-bdf9-f20267b9cee3') + JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" + SOLR_URL = credentials('FOLIO_FEW_solr_url') + STORAGE_URL = "http://digcoll.internal.library.cornell.edu:8080/fcrepo/rest" + COLLECTIONS = "development" + CATALOG = "http://da-prod-solr.library.cornell.edu/solr/blacklight" + IR_SOLR_URL = "http://aws-108-118.internal.library.cornell.edu:8983/solr/repositories" + IR_SOLR_USER = credentials('622231e0-352f-431f-9847-a109f3795d97') + IR_SOLR_PAW = credentials('f6e43070-a7b0-44ef-9a72-8767cc8ee968') + SAML_IDP_TARGET_URL = credentials('SAML_IDP_TARGET_URL') + OKAPI_URL = credentials('OKAPI_URL') + OKAPI_TENANT = credentials('OKAPI_TENANT') + OKAPI_USER = credentials('OKAPI_USER') + OKAPI_PW = credentials('OKAPI_PW') + } + stages { + stage('Greetings') { + steps { + echo 'Hello, Jenkins!' + echo 'Branch: ' + BRANCH_NAME + echo 'Git Branch: ' + GIT_BRANCH + echo 'Git Commit: ' + GIT_COMMIT + echo 'Jenkins Project: ' + JENKINS_PROJECT + echo 'Build Number: ' + BUILD_NUMBER + } + } + + stage('Set up and run bundler') { + steps { + echo 'Setting up bundler' + script { + if (BRANCH_NAME ==~ /PR-.+/) { + // slackSend channel: "#discovery-and-access", color: "#439FE0", message: "Pull Request Started - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" + slackSend channel: "#discovery-and-access", color: "#439FE0", message: "Pull Request Started ${CHANGE_BRANCH} --> ${CHANGE_TARGET}" + } else { + echo "Skipping the slack messages unless it is a Pull Request." + } + } + echo 'Run prelude.sh' + sh 'jenkins/prelude.sh' + } + } + + stage("Rspec tests") { + steps { + echo "Running Rspec tests" + sh 'jenkins/rspec.sh' + } + } + + // use this version for quick turnaround while testing pull request validation + // stage("cucumber all tests") { + // steps { + // timeout(60) { + // wrap([$class: 'Xvfb', additionalOptions: '', assignedLabels: '', autoDisplayName: true, debug: true, displayNameOffset: 0, installationName: 'default', parallelBuild: true, screen: '1024x758x24', timeout: 25]) { + // sh 'jenkins/cucumber-features.sh features/catalog_search/book_bags.feature:8' + // } + // } + // } + // } + + // use this version for normal situations + stage("cucumber all tests") { + steps { + echo "Running cucumber tests" + timeout(90) { + wrap([$class: 'Xvfb', additionalOptions: '', assignedLabels: '', autoDisplayName: true, debug: true, displayNameOffset: 0, installationName: 'default', parallelBuild: true, screen: '1024x758x24', timeout: 25]) { + sh 'jenkins/cucumber-features.sh' + } + } + } + } + + stage('Publish Coverage') { + steps { + echo "Publishing coverage" + sh 'mkdir -p coverage' + sh 'chmod g+w coverage' + sh 'echo "dummy file to prevent copy error when there are no other files" > coverage/dummy-file.txt' + publishHTML(target: [ + allowMissing: false, + alwaysLinkToLastBuild: true, + keepAll: true, + reportDir: "${WORKSPACE}/blacklight-cornell/coverage/rcov", + reportFiles: 'index.html', + reportName: 'Code Coverage Report', + reportTitles: 'Discovery and Access Team Code Coverage']) + } + } + } + post { + success { + node('controller') { + echo "The thrill of victory" + sh 'jenkins/report-status-to-github.sh success' + script { + if (BRANCH_NAME ==~ /PR-.+/) { + slackSend channel: "#discovery-and-access", color: "#00ff00", message: "Build Successful - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" + } + } + } + } + unsuccessful { + node('controller') { + echo "The agony of defeat" + sh 'jenkins/report-status-to-github.sh failure' + script { + if (BRANCH_NAME ==~ /PR-.+/) { + // slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed - ${env.JOB_NAME} ${env.BUILD_NUMBER} ${CHANGE_BRANCH} --> ${CHANGE_TARGET} (<${env.BUILD_URL}|Open>)" + slackSend channel: "#discovery-and-access", color: "#ff0000", message: "Build Failed ${CHANGE_BRANCH} --> ${CHANGE_TARGET}" + } + } + } + } + } +} \ No newline at end of file From bde6790e5bcd957b10acef1db64664d0910688cc Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 09:00:15 -0400 Subject: [PATCH 19/27] DACCESS-357 - switch back to old jenkins credentials --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 77854c5be..1a831becc 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - GIT_ACCESS_TOKEN = credentials('be6a5f7e-d674-4265-bdf9-f20267b9cee3') + GIT_ACCESS_TOKEN = credentials('f3b46a8a-a247-4703-baf7-c27c69656aaa') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" SOLR_URL = credentials('FOLIO_FEW_solr_url') STORAGE_URL = "http://digcoll.internal.library.cornell.edu:8080/fcrepo/rest" From 82f2dd84ec78a35625cd8a52ddcd77ef865aeaa2 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 09:00:34 -0400 Subject: [PATCH 20/27] DACCESS-357 - show jenkins version --- jenkins/Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 1a831becc..9dee91d87 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -25,6 +25,8 @@ pipeline { echo 'Git Commit: ' + GIT_COMMIT echo 'Jenkins Project: ' + JENKINS_PROJECT echo 'Build Number: ' + BUILD_NUMBER + echo 'Jenkins Version: ' + JENKINS_VERSION + echo 'Workspace: ' + WORKSPACE } } From bbe3494c6f0292bedbc8b597fff313bb3050c385 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 11:56:48 -0400 Subject: [PATCH 21/27] DACCESS-357 - calculate jenkins version --- jenkins/Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 9dee91d87..c1199b2b9 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -25,8 +25,11 @@ pipeline { echo 'Git Commit: ' + GIT_COMMIT echo 'Jenkins Project: ' + JENKINS_PROJECT echo 'Build Number: ' + BUILD_NUMBER - echo 'Jenkins Version: ' + JENKINS_VERSION echo 'Workspace: ' + WORKSPACE + script { + def jenkinsVersion = sh(script: 'jenkins --version', returnStdout: true).trim() + echo "Jenkins Version: ${jenkinsVersion}" + } } } From be58101b1044347f3c91622518ce6b3b07e64ef9 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 12:02:43 -0400 Subject: [PATCH 22/27] DACCESS-357 - try to find jenkins version --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index c1199b2b9..aa0917e26 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -27,7 +27,7 @@ pipeline { echo 'Build Number: ' + BUILD_NUMBER echo 'Workspace: ' + WORKSPACE script { - def jenkinsVersion = sh(script: 'jenkins --version', returnStdout: true).trim() + def jenkinsVersion = sh(script: 'curl -sI http://localhost:8080 | grep "X-Jenkins:" | awk \'{print $2}\'', returnStdout: true).trim() echo "Jenkins Version: ${jenkinsVersion}" } } From c0e920fcfe3a33d02f7a204054295aa42959daff Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 12:12:16 -0400 Subject: [PATCH 23/27] DACCESS-357 - switch to new jenkins credentials --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index aa0917e26..14a431f78 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - GIT_ACCESS_TOKEN = credentials('f3b46a8a-a247-4703-baf7-c27c69656aaa') + GIT_ACCESS_TOKEN = credentials('8adf6139-b5f5-408a-99c5-135aa578cfdf') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" SOLR_URL = credentials('FOLIO_FEW_solr_url') STORAGE_URL = "http://digcoll.internal.library.cornell.edu:8080/fcrepo/rest" From 7614c80ad8e9643e83e8b4ae3e4f6e6e3b71e6c3 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 15:52:14 -0400 Subject: [PATCH 24/27] DACCESS-357 - roll my own credentials --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 14a431f78..2fdc2f1bd 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - GIT_ACCESS_TOKEN = credentials('8adf6139-b5f5-408a-99c5-135aa578cfdf') + GIT_ACCESS_TOKEN = credentials('GitHub_Access_as_jgr25') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" SOLR_URL = credentials('FOLIO_FEW_solr_url') STORAGE_URL = "http://digcoll.internal.library.cornell.edu:8080/fcrepo/rest" From ae652a6aa278346d37354618dab34f526d403c6c Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 16:06:47 -0400 Subject: [PATCH 25/27] DACCESS-357 - use jgr25_jenkins_personal_access_token --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 2fdc2f1bd..32836bb5e 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - GIT_ACCESS_TOKEN = credentials('GitHub_Access_as_jgr25') + GIT_ACCESS_TOKEN = credentials('jgr25_jenkins_personal_access_token') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" SOLR_URL = credentials('FOLIO_FEW_solr_url') STORAGE_URL = "http://digcoll.internal.library.cornell.edu:8080/fcrepo/rest" From 0889cd7eabec5e4fd1843c07727a569f6716533d Mon Sep 17 00:00:00 2001 From: James Reidy Date: Tue, 13 Aug 2024 16:14:40 -0400 Subject: [PATCH 26/27] DACCESS-357 - set token back to 8adf6139-b5f5-408a-99c5-135aa578cfdf for cul-util/****** (cul-util Github personal access token as user/pass) --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 32836bb5e..14a431f78 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - GIT_ACCESS_TOKEN = credentials('jgr25_jenkins_personal_access_token') + GIT_ACCESS_TOKEN = credentials('8adf6139-b5f5-408a-99c5-135aa578cfdf') JENKINS_PROJECT = "blacklight-cornell-validate-pull-request" SOLR_URL = credentials('FOLIO_FEW_solr_url') STORAGE_URL = "http://digcoll.internal.library.cornell.edu:8080/fcrepo/rest" From 354285445f71a500cdfb55f31b40bfe8e0eb42a0 Mon Sep 17 00:00:00 2001 From: James Reidy Date: Wed, 14 Aug 2024 08:35:34 -0400 Subject: [PATCH 27/27] DACCESS-357 - cosmetic change to trigger PR --- jenkins/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 14a431f78..e366a0954 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -19,7 +19,7 @@ pipeline { stages { stage('Greetings') { steps { - echo 'Hello, Jenkins!' + echo 'Hello, New Jenkins!' echo 'Branch: ' + BRANCH_NAME echo 'Git Branch: ' + GIT_BRANCH echo 'Git Commit: ' + GIT_COMMIT