Skip to content

Commit e3647ee

Browse files
Create JenkinsPipeline
1 parent 26c4437 commit e3647ee

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

JenkinsPipeline

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
pipeline {
2+
agent any
3+
4+
environment {
5+
DOCKERHUB_CREDENTIALS=credentials('docker-key')
6+
}
7+
parameters {
8+
string(name: 'dockerUser', defaultValue: 'None', description: 'Enter Docker user name ')
9+
}
10+
stages {
11+
stage('Clone') {
12+
steps {
13+
git branch: 'main', url: 'https://github.com/rajpalsinghsaini/pythoncode.git'
14+
}
15+
}
16+
stage('Build') {
17+
steps {
18+
sh 'docker ps'
19+
sh "echo $DOCKERHUB_CREDENTIALS_PSW | docker login --username ${dockerUser} --password-stdin"
20+
21+
}
22+
}
23+
stage('Test') {
24+
steps {
25+
sh 'docker build /var/lib/jenkins/workspace/${JOB_NAME} -t ${dockerUser}/pythoncode'
26+
27+
}
28+
}
29+
stage('Deploy') {
30+
steps {
31+
sh 'docker ps'
32+
}
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)