-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
56 lines (51 loc) · 1.49 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!groovy
node {
final isMaster = 'master' == env.BRANCH_NAME
def dockerfile
// Checkout the proper revision into the workspace.
stage('checkout') {
checkout scm
}
docker.withRegistry('https://registry.gitlab.com/', 'gitlab-deploy-token_nocom-frontend') {
stage('build') {
wrap([$class: 'AnsiColorBuildWrapper']) {
dockerfile = docker.build('nerdsinc/nocom-frontend', '--no-cache --rm --pull .')
}
}
stage('publish') {
if (isMaster) {
wrap([$class: 'AnsiColorBuildWrapper']) {
dockerfile.push()
}
} else {
echo "Not publishing $env.BRANCH_NAME"
}
}
}
// stage('deploy') {
// if (isMaster) {
// wrap([$class: 'AnsiColorBuildWrapper']) {
// dir('deployment') {
// sh 'ansible-galaxy install -r roles.yml'
//
// withCredentials([
// string(credentialsId: 'sudo-password_nocomvm-deployer', variable: 'ANSIBLE_SUDO_PASS'),
// usernamePassword(
// credentialsId: 'gitlab-deploy-token_nocom-frontend',
// usernameVariable: 'GITLAB_DEPLOY_TOKEN_USERNAME',
// passwordVariable: 'GITLAB_DEPLOY_TOKEN_PASSWORD'
// )
// ]) {
// ansiblePlaybook(
// playbook: 'playbook.yml',
// credentialsId: 'ssh-private-key_nocomvm',
// colorized: true
// )
// }
// }
// }
// } else {
// echo "Not deploying $env.BRANCH_NAME"
// }
// }
}