forked from yankils/hello-world
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
61 lines (60 loc) · 1.79 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
57
58
59
60
61
pipeline{
agent any
// tools {
// maven 'maven'
// }
stages{
stage("Clean up"){
steps{
// sh '''
// echo "PATH = ${PATH}"
// echo "M2_HOME = ${M2_HOME}"
// mvn -version
// '''
deleteDir()
}
}
stage("clone repo"){
steps{
sh "git clone https://github.com/zhuw726/cicd.git"
}
}
// stage("build"){
// steps{
// dir("cicd"){
// sh "mvn clean install"
// }
// }
// }
// stage("test"){
// steps{
// dir("cicd"){
// sh "mvn test"
// }
// }
// }
stage("build & push docker hub"){
// environment {
// HOME = "${env.WORKSPACE}"
// }
steps{
// script {
// def dockerHome = tool 'docker'
// env.PATH = "${dockerHome}/bin:${env.PATH}"
// }
dir("cicd"){
// sh " def dockerHome = tool 'docker'"
// sh " env.PATH = '${dockerHome}/bin:${env.PATH}'"
sh "which docker"
// sh "ls -al /var/jenkins_home/tools/org.jenkinsci.plugins.docker.commons.tools.DockerTool/docker/bin/docker"
// sh "ls -al /usr/local/bin/docker"
sh "cat Dockerfile"
sh "ls -al"
sh "docker build . -t sample:latest"
sh "docker tag sample:latest zhuwj726/tc:latest"
sh "docker push zhuwj726/tc:latest"
}
}
}
}
}