switch jenkins to BlueOcean builds and add healthcheck and Jenkinsfile.

not sure we can actually complete a pipeline deployment successfully, because of restart
This commit is contained in:
2018-10-28 22:22:27 -04:00
parent 21bd5e1a42
commit d8c685ccad
2 changed files with 46 additions and 2 deletions

View File

@@ -0,0 +1,32 @@
node('docker') {
def app_name = 'jenkins'
def app_port = '8080'
def workdir = 'dockerfiles/services/jenkins'
stage('prepare') {
git credentialsId: 'f1f58215-c789-44a2-9b72-50e4425cb061', url: 'ssh://git@git.xai-corp.net:10022/xai-corp.net/provisioning.git'
sh 'ls'
}
stage('build') {
dir(workdir) {
sh "DOCKER_HOST=dkhost:2376 docker-compose -f docker-compose.yml pull"
}
}
stage('deploy') {
dir(workdir) {
sh """
docker stack deploy -c docker-compose.yml jenkins
docker service update jenkins_app
"""
}
}
stage('smoke tests') {
dir(workdir) {
sleep 60
sh "curl -If http://dkhost:8080/metrics/ejkxeVI-iKLy968ji9AnfYmOHGIh1kYd3gA500JqrRxzTeenT06ynR5Dqo0CQplO/healthcheck"
}
}
}

View File

@@ -10,7 +10,8 @@ services:
app: app:
# restart: always # restart: always
# privileged: true # privileged: true
image: "jenkins/jenkins:lts" # image: "jenkins/jenkins:lts"
image: "jenkinsci/blueocean"
volumes: volumes:
- jenkins_home:/var/jenkins_home - jenkins_home:/var/jenkins_home
@@ -25,12 +26,23 @@ services:
restart_policy: restart_policy:
condition: any condition: any
delay: "5s" delay: "5s"
max_attempts: 1 max_attempts: 3
update_config:
parallelism: 1
delay: 2s
order: start-first
resources: resources:
limits: limits:
cpus: '2' cpus: '2'
memory: 1536M memory: 1536M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/metrics/ejkxeVI-iKLy968ji9AnfYmOHGIh1kYd3gA500JqrRxzTeenT06ynR5Dqo0CQplO/ping"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 3m
logging: logging:
driver: fluentd driver: fluentd
options: options: