Skip to content

Commit

Permalink
feat: add Jenkinsfile (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemeurherve authored May 6, 2024
1 parent 408aa1a commit 9457920
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 2 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 18.17.0
75 changes: 75 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
pipeline {
options {
timeout(time: 60, unit: 'MINUTES')
ansiColor('xterm')
disableConcurrentBuilds(abortPrevious: true)
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '5', numToKeepStr: '5')
}

agent {
label 'linux-arm64 || arm64linux'
}

stages {
stage('Check for typos') {
steps {
sh '''
curl -qsL https://github.com/crate-ci/typos/releases/download/v1.5.0/typos-v1.5.0-x86_64-unknown-linux-musl.tar.gz | tar xvzf - ./typos
curl -qsL https://github.com/halkeye/typos-json-to-checkstyle/releases/download/v0.1.1/typos-checkstyle-v0.1.1-x86_64 > typos-checkstyle && chmod 0755 typos-checkstyle
./typos --format json | ./typos-checkstyle - > checkstyle.xml || true
'''
}
post {
always {
recordIssues(tools: [checkStyle(id: 'typos', name: 'Typos', pattern: 'checkstyle.xml')])
}
}
}

stage('Install dependencies') {
environment {
NODE_ENV = 'development'
}
steps {
sh '''
asdf install
npm install
npm run install-subfolders
'''
}
}

stage('Build') {
steps {
sh '''
npm run build-ui
npm run build-antora
'''
}
}

stage('Deploy PR to preview site') {
when {
allOf{
changeRequest target: 'main'
// Only deploy from infra.ci.jenkins.io
expression { infra.isInfra() }
}
}
environment {
NETLIFY_AUTH_TOKEN = credentials('netlify-auth-token')
}
steps {
sh 'netlify-deploy --draft=true --siteName "docs-jenkins-io" --title "Preview deploy for ${CHANGE_ID}" --alias "deploy-preview-${CHANGE_ID}" -d ./playbook/build/site'
}
post {
success {
recordDeployment('jenkins-infra', 'docs.jenkins.io', pullRequest.head, 'success', "https://deploy-preview-${CHANGE_ID}--docs-jenkins-io.netlify.app")
}
failure {
recordDeployment('jenkins-infra', 'docs.jenkins.io', pullRequest.head, 'failure', "https://deploy-preview-${CHANGE_ID}--docs-jenkins-io.netlify.app")
}
}
}
}
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "yamllint antora.yml"
"lint": "yamllint antora.yml",
"install-subfolders": "cd ui && npm install && cd ../playbook && npm install",
"build-ui": "cd ui && npm install && npx gulp bundle",
"build-antora": "cd playbook && npm install && npx antora --fetch local-antora-playbook.yml",
"clean": "rm -rf ui/build && rm -rf playbook/build"
},
"keywords": [
"Antora",
Expand Down
1 change: 0 additions & 1 deletion ui/.nvmrc

This file was deleted.

0 comments on commit 9457920

Please sign in to comment.