This repository has been archived by the owner on Sep 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
138 lines (137 loc) · 4.65 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
@Library("centreon-shared-library") _
pipeline {
agent { label 'ec2-fleet' }
stages {
stage('AS400 BUILD AND PACKAGING') {
parallel {
stage('Building AS400') {
agent { label 'ec2-fleet' }
steps {
echo "BUILD AS400"
sh 'docker run -i --entrypoint /src/ci/as400-build.sh -v "$PWD:/src" registry.centreon.com/as400:centos7'
}
}
stage('Testing AS400') {
agent { label 'ec2-fleet' }
steps {
echo "TEST AS400"
sh 'docker run -i --entrypoint /src/ci/as400-test.sh -v "$PWD:/src" registry.centreon.com/as400:centos7'
}
}
stage('Packaging AS400 for centos7') {
environment {
BUILD_NUMBER = "${env.BUILD_NUMBER}"
}
agent { label 'ec2-fleet' }
steps {
echo "Packaging AS400 CENTOS7"
sh '''docker run -i --entrypoint /src/ci/as400-packaging.sh -v "$PWD:/src" -e RELEASE=$BUILD_NUMBER registry.centreon.com/as400:centos7'''
sh 'sudo rpmsign --addsign noarch/*.rpm'
stash name: 'el7-rpms', includes: 'noarch/*.rpm'
archiveArtifacts artifacts: "noarch/*.rpm"
sh 'sudo rm -rf noarch'
}
}
stage('Packaging AS400 for Debian Bullseye') {
environment {
BUILD_NUMBER = "${env.BUILD_NUMBER}"
}
agent { label 'ec2-fleet' }
steps {
echo "Packaging AS400 DEBIAN BULLSEYE"
sh '''docker run -i --entrypoint /src/ci/as400-debian-pkg.sh -w="/src" -v "$PWD:/src" -e DISTRIB=bullseye -e RELEASE=$BUILD_NUMBER registry.centreon.com/centreon-debian11-dependencies:22.10'''
stash name: 'Debian11', includes: '*.deb'
archiveArtifacts artifacts: "*.deb"
}
}
stage('Packaging AS400 for centos8') {
environment {
BUILD_NUMBER = "${env.BUILD_NUMBER}"
}
agent { label 'ec2-fleet' }
steps {
echo "Packaging AS400 CENTOS8"
sh '''docker run -i --entrypoint /src/ci/as400-packaging.sh -v $PWD:/src -e RELEASE=$BUILD_NUMBER registry.centreon.com/as400:centos8'''
sh 'sudo rpmsign --addsign noarch/*.rpm'
stash name: 'el8-rpms', includes: 'noarch/*.rpm'
archiveArtifacts artifacts: "noarch/*.rpm"
sh 'sudo rm -rf noarch'
}
}
}
}
stage('RPM Delivery to testing repos') {
environment {
BUILD_NUMBER = "${env.BUILD_NUMBER}"
}
agent { label 'ec2-fleet' }
steps {
echo "Deliver RPMs AS400"
unstash 'el7-rpms'
unstash 'el8-rpms'
loadCommonScripts()
sh 'ci/as400-delivery.sh testing'
}
}
stage('RPM Delivery') {
when { branch 'master' }
environment {
BUILD_NUMBER = "${env.BUILD_NUMBER}"
}
agent { label 'ec2-fleet' }
steps {
echo "Deliver RPMs AS400"
unstash 'el7-rpms'
unstash 'el8-rpms'
loadCommonScripts()
sh 'ci/as400-delivery.sh stable'
}
}
stage('DEB Delivery') {
environment {
BUILD_NUMBER = "${env.BUILD_NUMBER}"
REPO = "unstable"
}
agent { label 'ec2-fleet' }
steps {
echo "Deliver DEBS AS400"
unstash 'Debian11'
withCredentials([usernamePassword(credentialsId: 'nexus-credentials', passwordVariable: 'NEXUS_PASSWORD', usernameVariable: 'NEXUS_USERNAME')]) {
checkout scm
unstash "Debian11"
sh '''for i in $(echo *.deb)
do
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD -H "Content-Type: multipart/form-data" --data-binary "@./$i" https://apt.centreon.com/repository/22.04-$REPO/
done
'''
}
}
}
stage('DEB Delivery to production') {
when { branch 'master' }
environment {
BUILD_NUMBER = "${env.BUILD_NUMBER}"
REPO = "testing"
}
agent { label 'ec2-fleet' }
steps {
echo "Deliver DEBs AS400"
unstash 'Debian11'
withCredentials([usernamePassword(credentialsId: 'nexus-credentials', passwordVariable: 'NEXUS_PASSWORD', usernameVariable: 'NEXUS_USERNAME')]) {
checkout scm
unstash "Debian11"
sh '''for i in $(echo *.deb)
do
curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD -H "Content-Type: multipart/form-data" --data-binary "@./$i" https://apt.centreon.com/repository/22.04-$REPO/
done
'''
}
}
}
}
post {
always {
cleanWs()
}
}
}