Skip to content

Commit 52bd7b1

Browse files
committed
Bring CI in line with develop branch
1 parent 70cfbfb commit 52bd7b1

File tree

1 file changed

+67
-74
lines changed

1 file changed

+67
-74
lines changed

Jenkinsfile

Lines changed: 67 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ pipeline {
2828
BUILD_VERSION = getVersion()
2929
BUILD_COMMIT = getCommit()
3030
MAJOR_VERSION = '3'
31-
BRANCH_LOWER = "${BRANCH_NAME.toLowerCase().replaceAll('/', '-')}"
31+
BRANCH_LOWER = "${BRANCH_NAME.toLowerCase().replaceAll('\\\\', '-').replaceAll('/', '-').replaceAll('\\.', '-')}"
3232
COMPOSE_PROJECT_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}"
3333
COMPOSE_FILE = 'docker/docker-compose.ci.yml'
3434
COMPOSE_INTERACTIVE_NO_CLI = 1
3535
BUILDX_NAME = "${COMPOSE_PROJECT_NAME}"
36-
DOCS_BUCKET = 'jc21-npm-site-next' // TODO: change to prod when official
37-
DOCS_CDN = 'E2Z0128EHS0Q23' // TODO: same
3836
}
3937
stages {
4038
stage('Environment') {
@@ -68,34 +66,46 @@ pipeline {
6866
}
6967
}
7068
stage('Build') {
71-
steps {
72-
sh './scripts/ci/build-frontend'
73-
sh './scripts/ci/test-backend'
74-
// Temporarily disable building backend binaries
75-
// sh './scripts/ci/build-backend'
76-
// Build the docker image used for testing below
77-
sh '''docker build --pull --no-cache \\
78-
-t "${IMAGE}:${BRANCH_LOWER}-ci-${BUILD_NUMBER}" \\
79-
-f docker/Dockerfile \\
80-
--build-arg BUILD_COMMIT="${BUILD_COMMIT}" \\
81-
--build-arg BUILD_DATE="$(date '+%Y-%m-%d %T %Z')" \\
82-
--build-arg BUILD_VERSION="${BUILD_VERSION}" \\
83-
.
84-
'''
85-
}
86-
post {
87-
success {
88-
junit 'test/results/junit/*'
89-
// archiveArtifacts allowEmptyArchive: false, artifacts: 'bin/*'
90-
publishHTML([
91-
allowMissing: false,
92-
alwaysLinkToLastBuild: false,
93-
keepAll: false,
94-
reportDir: 'test/results/html-reports',
95-
reportFiles: 'backend-coverage.html',
96-
reportName: 'HTML Reports',
97-
useWrapperFileDirectly: true
98-
])
69+
parallel {
70+
stage('Project') {
71+
steps {
72+
sh './scripts/ci/build-frontend'
73+
sh './scripts/ci/test-backend'
74+
// Temporarily disable building backend binaries
75+
// sh './scripts/ci/build-backend'
76+
// Build the docker image used for testing below
77+
sh '''docker build --pull --no-cache \\
78+
-t "${IMAGE}:${BRANCH_LOWER}-ci-${BUILD_NUMBER}" \\
79+
-f docker/Dockerfile \\
80+
--build-arg BUILD_COMMIT="${BUILD_COMMIT}" \\
81+
--build-arg BUILD_DATE="$(date '+%Y-%m-%d %T %Z')" \\
82+
--build-arg BUILD_VERSION="${BUILD_VERSION}" \\
83+
.
84+
'''
85+
}
86+
post {
87+
success {
88+
junit 'test/results/junit/*'
89+
// archiveArtifacts allowEmptyArchive: false, artifacts: 'bin/*'
90+
publishHTML([
91+
allowMissing: false,
92+
alwaysLinkToLastBuild: false,
93+
keepAll: false,
94+
reportDir: 'test/results/html-reports',
95+
reportFiles: 'backend-coverage.html',
96+
reportName: 'HTML Reports',
97+
useWrapperFileDirectly: true
98+
])
99+
}
100+
}
101+
}
102+
stage('Docs') {
103+
steps {
104+
dir(path: 'docs') {
105+
sh 'yarn install'
106+
sh 'yarn build'
107+
}
108+
}
99109
}
100110
}
101111
}
@@ -185,27 +195,6 @@ pipeline {
185195
}
186196
}
187197
}
188-
stage('Docs') {
189-
when {
190-
not {
191-
equals expected: 'UNSTABLE', actual: currentBuild.result
192-
}
193-
}
194-
steps {
195-
dir(path: 'docs') {
196-
sh 'yarn install'
197-
sh 'yarn build'
198-
}
199-
200-
// API Docs:
201-
sh 'mkdir -p "docs/.vuepress/dist/api"'
202-
sh 'mv docs/api-schema.json docs/.vuepress/dist/api/'
203-
204-
dir(path: 'docs/.vuepress/dist') {
205-
sh 'tar -czf ../../docs.tgz *'
206-
}
207-
}
208-
}
209198
stage('MultiArch Build') {
210199
when {
211200
not {
@@ -220,31 +209,35 @@ pipeline {
220209
}
221210
}
222211
}
223-
stage('Docs Deploy') {
224-
when {
225-
allOf {
226-
branch 'v3' // TODO: change to master when ready
227-
not {
228-
equals expected: 'UNSTABLE', actual: currentBuild.result
212+
stage('Docs / Comment') {
213+
parallel {
214+
stage('Docs Job') {
215+
when {
216+
allOf {
217+
branch pattern: "^(develop|master|v3)\$", comparator: "REGEXP"
218+
not {
219+
equals expected: 'UNSTABLE', actual: currentBuild.result
220+
}
221+
}
229222
}
230-
}
231-
}
232-
steps {
233-
npmDocsRelease("$DOCS_BUCKET", "$DOCS_CDN")
234-
}
235-
}
236-
stage('PR Comment') {
237-
when {
238-
allOf {
239-
changeRequest()
240-
not {
241-
equals expected: 'UNSTABLE', actual: currentBuild.result
223+
steps {
224+
build wait: false, job: 'nginx-proxy-manager-docs', parameters: [string(name: 'docs_branch', value: "$BRANCH_NAME")]
242225
}
243226
}
244-
}
245-
steps {
246-
script {
247-
npmGithubPrComment("Docker Image for build ${BUILD_NUMBER} is available on [DockerHub](https://cloud.docker.com/repository/docker/${DOCKER_ORG}/${IMAGE}) as `${DOCKER_ORG}/${IMAGE}:github-${BRANCH_LOWER}`\n\n**Note:** ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.", true)
227+
stage('PR Comment') {
228+
when {
229+
allOf {
230+
changeRequest()
231+
not {
232+
equals expected: 'UNSTABLE', actual: currentBuild.result
233+
}
234+
}
235+
}
236+
steps {
237+
script {
238+
npmGithubPrComment("Docker Image for build ${BUILD_NUMBER} is available on [DockerHub](https://cloud.docker.com/repository/docker/jc21/${IMAGE}) as `jc21/${IMAGE}:github-${BRANCH_LOWER}`\n\n**Note:** ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.", true)
239+
}
240+
}
248241
}
249242
}
250243
}

0 commit comments

Comments
 (0)