Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DACCESS-357- switch credential to new jenkins server #2154

Open
wants to merge 28 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ebd55ea
DACCESS-345 - switch credential to new jenkins server
jgreidy Aug 12, 2024
8c0b955
DACCESS-345 - try a copilot trick
jgreidy Aug 12, 2024
4e6f1da
DACCESS-345 - label it
jgreidy Aug 12, 2024
be74cf2
DACCESS-345 - more labeled node
jgreidy Aug 12, 2024
e3f9e57
DACCESS-345 - try label Built-In-Node from Jenkins
jgreidy Aug 12, 2024
7fc9369
DACCESS-345 - use controller label
jgreidy Aug 12, 2024
1feb750
DACCESS-345 - use cul-util/****** (cul-util Github personal access to…
jgreidy Aug 12, 2024
0487b16
DACCESS-345 - try Bearer instead of token
jgreidy Aug 12, 2024
9b57d82
DACCESS-345 - try simple greetings step
jgreidy Aug 12, 2024
7abdaff
DACCESS-345 - superstitious tweaks
jgreidy Aug 12, 2024
3e56fb6
DACCESS-345 - remove the node () {} stuff
jgreidy Aug 12, 2024
280df0f
DACCESS-345 - node label for agent success failure
jgreidy Aug 12, 2024
5a757cb
DACCESS-345 - controller as label
jgreidy Aug 12, 2024
7d78dbf
DACCESS-345 - try Github personal access token as cul-util
jgreidy Aug 12, 2024
e4765d8
DACCESS-345 - remove breaking code
jgreidy Aug 13, 2024
14222d6
DACCESS-357 - any agent, no report
jgreidy Aug 13, 2024
6aee49d
DACCESS-357 - remove node ('controller')
jgreidy Aug 13, 2024
8fdf26f
DACCESS-357 - save wip jenkinsfile
jgreidy Aug 13, 2024
8008fa4
Merge branch 'dev' into DIGCOLL-357
jgreidy Aug 13, 2024
bde6790
DACCESS-357 - switch back to old jenkins credentials
jgreidy Aug 13, 2024
82f2dd8
DACCESS-357 - show jenkins version
jgreidy Aug 13, 2024
bbe3494
DACCESS-357 - calculate jenkins version
jgreidy Aug 13, 2024
be58101
DACCESS-357 - try to find jenkins version
jgreidy Aug 13, 2024
c0e920f
DACCESS-357 - switch to new jenkins credentials
jgreidy Aug 13, 2024
7614c80
DACCESS-357 - roll my own credentials
jgreidy Aug 13, 2024
ae652a6
DACCESS-357 - use jgr25_jenkins_personal_access_token
jgreidy Aug 13, 2024
0889cd7
DACCESS-357 - set token back to 8adf6139-b5f5-408a-99c5-135aa578cfdf …
jgreidy Aug 13, 2024
3542854
DACCESS-357 - cosmetic change to trigger PR
jgreidy Aug 14, 2024
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
35 changes: 19 additions & 16 deletions jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -17,11 +17,25 @@ pipeline {
OKAPI_PW = credentials('OKAPI_PW')
}
stages {
stage('Set up and run bundler') {
stage('Greetings') {
steps {
echo 'Setting up bundler'
echo 'Hello, New 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
echo 'Workspace: ' + WORKSPACE
script {
def jenkinsVersion = sh(script: 'curl -sI http://localhost:8080 | grep "X-Jenkins:" | awk \'{print $2}\'', returnStdout: true).trim()
echo "Jenkins Version: ${jenkinsVersion}"
}
}
}

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>)"
Expand All @@ -42,17 +56,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 {
Expand Down Expand Up @@ -85,7 +88,7 @@ pipeline {
post {
success {
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>)"
Expand All @@ -94,7 +97,7 @@ pipeline {
}
unsuccessful {
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>)"
Expand Down
119 changes: 119 additions & 0 deletions jenkins/Jenkinsfile.original
Original file line number Diff line number Diff line change
@@ -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}"
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion jenkins/report-status-to-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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\"}"