Jenkins pipeline for investigator. Doesn't serve as an actual Jenkinsfile, just a working basis.
Created
May 5, 2018 03:25
-
-
Save fluggo/ed7d9764c6056f2ced01d928b6a5ac28 to your computer and use it in GitHub Desktop.
Investigator Jenkins file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
parameters { | |
string(name: 'COMMIT_ID', defaultValue: 'd732187cb9c46f7ddb0459f177e4465769e8d2d2', description: 'Who should I say hello to?') | |
} | |
stages { | |
stage('Test build') { | |
steps { | |
githubNotify status: 'PENDING', | |
description: 'Test description', | |
account: 'fluggo', | |
context: 'ci/jenkins', | |
credentialsId: 'fluggo-github-token', | |
repo: 'investigator', | |
sha: params.COMMIT_ID, | |
targetUrl: 'http://www.fluggo.com/' | |
// Fire up Elasticsearch | |
script { | |
docker.image('docker.elastic.co/elasticsearch/elasticsearch:5.2.2') | |
.withRun('-e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" -e "xpack.security.enabled=false" --network investigator --name es-test') { | |
docker.image('node:9.8.0').inside('--network investigator') { | |
// While ES is getting started, set up our environment | |
git url: 'https://github.com/fluggo/investigator.git' | |
sh "git checkout ${params.COMMIT_ID}" | |
sh 'npm install' | |
// I don't know why, but this seems to exist now | |
sh 'mkdir -vp server/user-scripts' | |
// Ensure ES is up | |
sh 'while ! curl -s --head http://es-test:9200 > /dev/null; do sleep 1; done' | |
sh 'npm test' | |
} | |
} | |
} | |
} | |
post { | |
unstable { | |
githubNotify status: 'ERROR', | |
description: 'Tests failed to complete', | |
account: 'fluggo', | |
context: 'ci/jenkins', | |
credentialsId: 'fluggo-github-token', | |
repo: 'investigator', | |
sha: params.COMMIT_ID, | |
targetUrl: 'http://www.fluggo.com/' | |
} | |
failure { | |
githubNotify status: 'FAILURE', | |
description: 'Tests failed', | |
account: 'fluggo', | |
context: 'ci/jenkins', | |
credentialsId: 'fluggo-github-token', | |
repo: 'investigator', | |
sha: params.COMMIT_ID, | |
targetUrl: 'http://www.fluggo.com/' | |
} | |
success { | |
githubNotify status: 'SUCCESS', | |
description: 'Tests succeeded', | |
account: 'fluggo', | |
context: 'ci/jenkins', | |
credentialsId: 'fluggo-github-token', | |
repo: 'investigator', | |
sha: params.COMMIT_ID, | |
targetUrl: 'http://www.fluggo.com/' | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment