-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
57 lines (54 loc) · 2.88 KB
/
Jenkinsfile
File metadata and controls
57 lines (54 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
pipeline {
agent any
stages{
stage('Build') {
steps {
updateGitlabCommitStatus name: "Building", state: "running"
sh "docker build -t docker.nexus.archi-lab.io/archilab/grafana-custom -f monitoring/dockerfile.grafana.yaml ."
sh "docker tag docker.nexus.archi-lab.io/archilab/grafana-custom docker.nexus.archi-lab.io/archilab/grafana-custom:${env.BUILD_ID}"
script {
docker.withRegistry('https://docker.nexus.archi-lab.io//', 'archilab-nexus-jenkins-user') {
sh "docker push docker.nexus.archi-lab.io/archilab/grafana-custom"
}
}
sh "docker build -t docker.nexus.archi-lab.io/archilab/prometheus-custom -f monitoring/dockerfile.prometheus.yaml ."
sh "docker tag docker.nexus.archi-lab.io/archilab/prometheus-custom docker.nexus.archi-lab.io/archilab/prometheus-custom:${env.BUILD_ID}"
script {
docker.withRegistry('https://docker.nexus.archi-lab.io//', 'archilab-nexus-jenkins-user') {
sh "docker push docker.nexus.archi-lab.io/archilab/prometheus-custom"
}
}
}
post {
success {
updateGitlabCommitStatus name: "Building", state: "success"
}
failure {
updateGitlabCommitStatus name: "Building", state: "failed"
}
unstable {
updateGitlabCommitStatus name: "Building", state: "success"
}
}
}
stage('Startup Infrastructure'){
steps {
script {
docker.withServer('tcp://10.10.10.25:2376', 'CoalbaseVM') {
sh 'docker stack deploy -c logging/docker-compose.yml logging'
docker.withRegistry('https://docker.nexus.archi-lab.io//', 'archilab-nexus-jenkins-user') {
withCredentials([usernamePassword(credentialsId: 'GrafanaCredentials', usernameVariable: 'GF_SECURITY_ADMIN_USER', passwordVariable: 'GF_SECURITY_ADMIN_PASSWORD')]){
sh 'docker stack deploy --with-registry-auth -c monitoring/docker-compose.yaml monitoring'
}
}
}
}
}
}
}
post {
failure {
discordSend description: 'Jenkins Pipeline Build', footer: 'CoalBase-Infrastructure', link: env.BUILD_URL, result: currentBuild.currentResult, title: JOB_NAME, webhookURL: 'https://discordapp.com/api/webhooks/537602034015272960/9qa_bwMs5ZVuntNCg3BmHXYSDgo9gPZjHrgxsPJG8xya3hesFpm2aiAu8VcO3yNG9r59'
}
}
}