-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
42 lines (42 loc) · 1.47 KB
/
Jenkinsfile
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
pipeline {
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '5'))
}
post { always { deleteDir() } }
agent any
environment {
REGISTRY_HOST = "registry-jj.demo-rademade.com"
PORTAINER_HOST = "portainer.demo-rademade.com"
COMPOSE_YML = "docker-cloud.yml"
PROJECT_NAME = "twork"
}
stages {
stage('Build') {
steps {
build job: 'CreateImages', parameters: [
string(name: 'SOURCE_DIRECTORY', value: "${WORKSPACE}"),
string(name: 'REGISTRY_HOST', value: "${REGISTRY_HOST}"),
string(name: 'PORTAINER_HOST', value: "${PORTAINER_HOST}"),
string(name: 'BRANCH', value: "${BRANCH_NAME}"),
string(name: 'PROJECT_NAME', value: "${PROJECT_NAME}")
]
}
}
stage('Deploy') {
steps {
withCredentials([usernameColonPassword(credentialsId: 'portainer', variable: 'PORTAINER_CREDS')]) {
build job: 'DeployImages', parameters: [
string(name: 'SOURCE_DIRECTORY', value: "${WORKSPACE}"),
string(name: 'REGISTRY_HOST', value: "${REGISTRY_HOST}"),
string(name: 'PORTAINER_HOST', value: "${PORTAINER_HOST}"),
string(name: 'BRANCH', value: "${BRANCH_NAME}"),
string(name: 'PROJECT_NAME', value: "${PROJECT_NAME}"),
string(name: 'COMPOSE_YML', value: "${COMPOSE_YML}"),
string(name: 'PORTAINER_CREDS', value: "${PORTAINER_CREDS}")
]
}
}
}
}
}