Skip to content

Commit 607c2fd

Browse files
committed
ci/cd 9
1 parent 92a5228 commit 607c2fd

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

app/Jenkinsfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,23 @@ pipeline {
77
}
88

99
triggers {
10-
pollSCM('H/5 * * * *')
10+
githubPush()
1111
}
1212

1313
stages {
1414
stage('Checkout') {
15+
when {
16+
branch 'main'
17+
}
1518
steps {
1619
checkout scm
1720
}
1821
}
1922

2023
stage('Build image on host Docker') {
24+
when {
25+
branch 'main'
26+
}
2127
steps {
2228
sh """
2329
cd app
@@ -27,6 +33,9 @@ pipeline {
2733
}
2834

2935
stage('Stop and remove old container') {
36+
when {
37+
branch 'main'
38+
}
3039
steps {
3140
sh """
3241
docker stop ${CONTAINER_NAME} || true
@@ -36,6 +45,9 @@ pipeline {
3645
}
3746

3847
stage('Start new container') {
48+
when {
49+
branch 'main'
50+
}
3951
steps {
4052
sh """
4153
docker run -d \

0 commit comments

Comments
 (0)