-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
195 lines (188 loc) · 7.23 KB
/
Jenkinsfile
File metadata and controls
195 lines (188 loc) · 7.23 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
pipeline {
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
metadata:
name: qlack-typescript
namespace: jenkins
spec:
tolerations:
- key: "jenkins"
operator: "Equal"
value: "agent"
effect: "NoSchedule"
nodeSelector:
jenkins-agent: "true"
priorityClassName: jenkins-low-priority
securityContext:
runAsUser: 0
runAsGroup: 0
fsGroup: 0
containers:
- name: qlack-typescript-builder
image: eddevopsd2/ubuntu-dind:dind-mvn3.8.5-jdk17-node18.16-go1.20-buildx-helm-pip
volumeMounts:
- name: docker
mountPath: /root/.docker
tty: true
securityContext:
privileged: true
runAsUser: 0
imagePullSecrets:
- name: regcred
volumes:
- name: docker
persistentVolumeClaim:
claimName: docker-nfs-pvc
'''
workspaceVolume persistentVolumeClaimWorkspaceVolume(claimName: 'workspace-nfs-pvc', readOnly: false)
}
}
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '10'))
timeout(time: 3, unit: 'HOURS')
}
environment {
NPM_TOKEN = credentials('qlack-npm-auth-token')
}
stages {
stage ('NPM Publish Form-Validation') {
steps {
container (name: 'qlack-typescript-builder') {
script {
env.publishFormValidation = input(message: 'Do you want to publish an npm package for the project "form-validation"?',
parameters: [booleanParam(name: 'PUBLISH NPM FORM-VALIDATION', defaultValue: false, description: '')])
}
}
}
}
stage ('NPM Publish Forms') {
steps {
container (name: 'qlack-typescript-builder') {
script {
env.publishForms = input(message: 'Do you want to publish an npm package for the project "forms"?',
parameters: [booleanParam(name: 'PUBLISH NPM FORMS', defaultValue: false, description: '')])
}
}
}
}
stage ('NPM Publish Qng-Pubsub') {
steps {
container (name: 'qlack-typescript-builder') {
script {
env.publishQngPubsub = input(message: 'Do you want to publish an npm package for the project "qng-pubsub"?',
parameters: [booleanParam(name: 'PUBLISH NPM QNG-PUBSUB', defaultValue: false, description: '')])
}
}
}
}
stage ('Install-Qlack-Dependencies') {
steps {
container (name: 'qlack-typescript-builder') {
script {
sh 'npm install'
if(env.publishFormValidation == 'true'){
dir('projects/qlack/form-validation') {
sh 'echo "install dependencies for qlack form-validation"'
sh 'npm install'
}
}
if(env.publishForms == 'true'){
dir('projects/qlack/forms') {
sh 'echo "install dependencies for qlack forms"'
sh 'npm install'
}
}
if(env.publishQngPubsub == 'true'){
dir('projects/qlack/qng-pubsub') {
sh 'echo "install dependencies for qlack qng-pubsub"'
sh 'npm install'
}
}
}
}
}
}
stage ('Build-Qlack') {
steps {
container (name: 'qlack-typescript-builder') {
script {
// install angular cli
sh 'npm install -g @angular/cli'
if(env.publishFormValidation == 'true'){
dir('projects/qlack/form-validation') {
sh 'echo "build qlack form-validation"'
sh 'npx ng build --project @qlack/form-validation'
}
}
if(env.publishForms == 'true'){
dir('projects/qlack/forms') {
sh 'echo "build qlack forms"'
sh 'npx ng build --project @qlack/forms'
}
}
if(env.publishQngPubsub == 'true'){
dir('projects/qlack/qng-pubsub') {
sh 'echo "build qlack qng-pubsub"'
sh 'npx ng build --project @qlack/qng-pubsub'
}
}
}
}
}
}
stage ('NPM-Login') {
steps {
container (name: 'qlack-typescript-builder') {
script {
// Login to npm registry
if (env.NPM_TOKEN) {
sh 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
} else {
error 'NPM_TOKEN is not available. Exiting...'
}
}
}
}
}
stage ('Publish-Qlack-Form-Validation') {
when {
expression { env.publishFormValidation == 'true' }
}
steps {
container (name: 'qlack-typescript-builder') {
dir('dist/qlack/form-validation') {
sh 'npm publish'
}
}
}
}
stage ('Build-Qlack-Forms') {
when {
expression { env.publishForms == 'true' }
}
steps {
container (name: 'qlack-typescript-builder') {
dir('dist/qlack/forms') {
sh 'npm publish'
}
}
}
}
stage ('Build-Qlack-Form-Qng-Pubsub') {
when {
expression { env.publishQngPubsub == 'true' }
}
steps {
container (name: 'qlack-typescript-builder') {
dir('dist/qlack/qng-pubsub') {
sh 'npm publish'
}
}
}
}
}
}