Skip to content

Commit b10cfb7

Browse files
PBM-1652. Create PBM nightly build
1 parent 7c77b68 commit b10cfb7

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

pbm/pbm-docker-nightly.groovy

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ library changelog: false, identifier: "lib@master", retriever: modernSCM([
55

66
pipeline {
77
agent {
8-
label 'docker-32gb'
8+
label params.CLOUD == 'Hetzner' ? 'docker-x64' : 'docker-32gb'
99
}
1010
environment {
1111
PATH = '/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ec2-user/.local/bin'
1212
}
1313
parameters {
14-
string(name: 'PBM_REPO_CH', defaultValue: 'experimental', description: 'Percona-release repo')
15-
string(name: 'PBM_VERSION', defaultValue: '2.0.2-1', description: 'PBM version')
16-
string(name: 'TARGET_REPO', defaultValue: 'PerconaLab', description: 'Target repo for docker image, use DockerHub for release only')
14+
choice(name: 'CLOUD', choices: [ 'Hetzner','AWS' ], description: 'Cloud infra for build')
15+
string(name: 'PBM_BRANCH_OR_COMMIT', defaultValue: 'dev', description: 'PBM branch or commit to build from')
16+
}
17+
triggers {
18+
cron('0 0 * * *')
1719
}
1820
options {
1921
disableConcurrentBuilds()
@@ -22,7 +24,7 @@ pipeline {
2224
stage('Set build name'){
2325
steps {
2426
script {
25-
currentBuild.displayName = "${params.PBM_REPO_CH}-nightly"
27+
currentBuild.displayName = "${params.PBM_BRANCH_OR_COMMIT}-nightly"
2628
}
2729
}
2830
}
@@ -31,7 +33,7 @@ pipeline {
3133
sh """
3234
git clone https://github.com/percona/percona-docker
3335
cd percona-docker/percona-backup-mongodb
34-
docker build . -t percona-backup-mongodb
36+
docker build . -f Dockerfile.nightly --build-arg PBM_BRANCH_OR_COMMIT="${params.PBM_BRANCH_OR_COMMIT}" -t percona-backup-mongodb
3537
"""
3638
}
3739
}
@@ -43,9 +45,9 @@ pipeline {
4345
sudo tar zxvf trivy_\${TRIVY_VERSION}_Linux-64bit.tar.gz -C /usr/local/bin/
4446
wget https://raw.githubusercontent.com/aquasecurity/trivy/v\${TRIVY_VERSION}/contrib/junit.tpl
4547
curl https://raw.githubusercontent.com/Percona-QA/psmdb-testing/main/docker/trivyignore -o ".trivyignore"
46-
/usr/local/bin/trivy -q image --format template --template @junit.tpl -o trivy-hight-junit.xml \
48+
/usr/local/bin/trivy -q image --format template --template @junit.tpl -o trivy-high-junit.xml \
4749
--timeout 10m0s --ignore-unfixed --exit-code 0 --severity HIGH,CRITICAL percona-backup-mongodb
48-
"""
50+
"""
4951
}
5052
post {
5153
always {
@@ -54,9 +56,6 @@ pipeline {
5456
}
5557
}
5658
stage ('Push images to perconalab') {
57-
when {
58-
environment name: 'TARGET_REPO', value: 'PerconaLab'
59-
}
6059
steps {
6160
withCredentials([usernamePassword(credentialsId: 'hub.docker.com', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
6261
sh """
@@ -77,13 +76,13 @@ pipeline {
7776
deleteDir()
7877
}
7978
success {
80-
slackNotify("#mongodb_autofeed", "#00FF00", "[${JOB_NAME}]: Building of PBM nightly repo ${PBM_REPO_CH} succeed")
79+
slackNotify("#mongodb_autofeed", "#00FF00", "[${JOB_NAME}]: Building of PBM nightly branch/commit ${params.PBM_BRANCH_OR_COMMIT} succeeded")
8180
}
8281
unstable {
83-
slackNotify("#mongodb_autofeed", "#F6F930", "[${JOB_NAME}]: Building of PBM nightly repo ${PBM_REPO_CH} unstable - [${BUILD_URL}testReport/]")
82+
slackNotify("#mongodb_autofeed", "#F6F930", "[${JOB_NAME}]: Building of PBM nightly branch/commit ${params.PBM_BRANCH_OR_COMMIT} unstable - [${BUILD_URL}testReport/]")
8483
}
8584
failure {
86-
slackNotify("#mongodb_autofeed", "#FF0000", "[${JOB_NAME}]: Building of PBM nightly repo ${PBM_REPO_CH} failed - [${BUILD_URL}]")
85+
slackNotify("#mongodb_autofeed", "#FF0000", "[${JOB_NAME}]: Building of PBM nightly branch/commit ${params.PBM_BRANCH_OR_COMMIT} failed - [${BUILD_URL}]")
8786
}
8887
}
8988
}

pbm/pbm-docker_nightly.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
- git:
99
url: https://github.com/Percona-Lab/jenkins-pipelines.git
1010
branches:
11-
- 'master'
11+
- 'hetzner'
1212
wipe-workspace: false
1313
lightweight-checkout: true
14-
script-path: pbm/pbm-docker-nightly.groovy
15-
triggers:
16-
- timed: "0 0 * * *"
14+
script-path: pbm/pbm-docker-nightly.groovy

0 commit comments

Comments
 (0)