forked from kubesphere/devops-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
32 lines (30 loc) · 782 Bytes
/
Jenkinsfile
File metadata and controls
32 lines (30 loc) · 782 Bytes
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
pipeline {
agent {
node {
label 'base'
}
}
stages {
stage('build and tag image') {
steps {
container('base') {
sh '''docker build -t kubespheredev/builder-python .
docker tag kubespheredev/builder-python kubespheredev/builder-python:2.1.0'''
}
}
}
stage('docker push') {
when{
branch 'master'
}
steps {
container('base') {
withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : 'dockerhub-id' ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin'
}
sh 'docker push kubespheredev/builder-python'
}
}
}
}
}