Bring CI in line with develop branch

This commit is contained in:
Jamie Curnow 2024-05-17 08:56:57 +10:00
parent 70cfbfb1b0
commit 52bd7b1d8f
No known key found for this signature in database
GPG Key ID: FFBB624C43388E9E

49
Jenkinsfile vendored
View File

@ -28,13 +28,11 @@ pipeline {
BUILD_VERSION = getVersion()
BUILD_COMMIT = getCommit()
MAJOR_VERSION = '3'
BRANCH_LOWER = "${BRANCH_NAME.toLowerCase().replaceAll('/', '-')}"
BRANCH_LOWER = "${BRANCH_NAME.toLowerCase().replaceAll('\\\\', '-').replaceAll('/', '-').replaceAll('\\.', '-')}"
COMPOSE_PROJECT_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}"
COMPOSE_FILE = 'docker/docker-compose.ci.yml'
COMPOSE_INTERACTIVE_NO_CLI = 1
BUILDX_NAME = "${COMPOSE_PROJECT_NAME}"
DOCS_BUCKET = 'jc21-npm-site-next' // TODO: change to prod when official
DOCS_CDN = 'E2Z0128EHS0Q23' // TODO: same
}
stages {
stage('Environment') {
@ -68,6 +66,8 @@ pipeline {
}
}
stage('Build') {
parallel {
stage('Project') {
steps {
sh './scripts/ci/build-frontend'
sh './scripts/ci/test-backend'
@ -99,6 +99,16 @@ pipeline {
}
}
}
stage('Docs') {
steps {
dir(path: 'docs') {
sh 'yarn install'
sh 'yarn build'
}
}
}
}
}
stage('Test Sqlite') {
environment {
COMPOSE_PROJECT_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}_sqlite"
@ -185,27 +195,6 @@ pipeline {
}
}
}
stage('Docs') {
when {
not {
equals expected: 'UNSTABLE', actual: currentBuild.result
}
}
steps {
dir(path: 'docs') {
sh 'yarn install'
sh 'yarn build'
}
// API Docs:
sh 'mkdir -p "docs/.vuepress/dist/api"'
sh 'mv docs/api-schema.json docs/.vuepress/dist/api/'
dir(path: 'docs/.vuepress/dist') {
sh 'tar -czf ../../docs.tgz *'
}
}
}
stage('MultiArch Build') {
when {
not {
@ -220,17 +209,19 @@ pipeline {
}
}
}
stage('Docs Deploy') {
stage('Docs / Comment') {
parallel {
stage('Docs Job') {
when {
allOf {
branch 'v3' // TODO: change to master when ready
branch pattern: "^(develop|master|v3)\$", comparator: "REGEXP"
not {
equals expected: 'UNSTABLE', actual: currentBuild.result
}
}
}
steps {
npmDocsRelease("$DOCS_BUCKET", "$DOCS_CDN")
build wait: false, job: 'nginx-proxy-manager-docs', parameters: [string(name: 'docs_branch', value: "$BRANCH_NAME")]
}
}
stage('PR Comment') {
@ -244,7 +235,9 @@ pipeline {
}
steps {
script {
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)
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)
}
}
}
}
}