Skip to content

Commit

Permalink
build(cicd): move builds to DigitalOcean cloud (#363)
Browse files Browse the repository at this point in the history
* move builds to DigitalOcean cloud

* add logging to troubleshoot missing deps

* add additional logging

* use nodejs plugin

* add cli build
  • Loading branch information
aaron-plahn committed May 23, 2023
1 parent a8baae6 commit 6d5dd90
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
def nodeInstallationName = 'NodeJS 18.12.0'

/* groovylint-disable DuplicateStringLiteral */
/* groovylint-disable-next-line CompileStatic */
pipeline {
Expand All @@ -9,11 +11,9 @@ pipeline {
stages {
stage('ci') {
agent {
docker {
image 'node:18-alpine'
args '-u root'
}
label 'jenkins-build-agent'
}
tools { nodejs nodeInstallationName }
environment {
NODE_ENV = 'test'
NODE_PORT = 3131
Expand All @@ -38,6 +38,10 @@ pipeline {
targetLocation: 'apps/coscrad-frontend/src/auth_config.json')]) {
echo 'PR opened or updated...'
echo "NODE ENV: ${NODE_ENV}"
echo 'node version:'
sh 'node -v'
echo 'npm version'
sh 'npm -v'
echo 'Installing dependencies'
sh 'npm ci --legacy-peer-deps'

Expand Down Expand Up @@ -78,11 +82,9 @@ pipeline {
}
stage('deploy to staging') {
agent {
docker {
image 'node:18-alpine'
args '-u root'
}
label 'jenkins-build-agent'
}
tools { nodejs nodeInstallationName }
environment {
NODE_ENV = 'staging'
NODE_PORT = 3131
Expand Down Expand Up @@ -123,6 +125,8 @@ pipeline {
sh 'cp apps/coscrad-frontend/src/configurable-front-matter/data/content.config.SAMPLE.ts apps/coscrad-frontend/src/configurable-front-matter/data/content.config.ts'

sh 'npm run build:coscrad:prod'

sh 'npx nx run api:build:cli'
}
}
post {
Expand All @@ -137,6 +141,6 @@ pipeline {
publishers: [sshPublisherDesc(configName: '[email protected]', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'rm -rf archive ; mv build archive; touch archive/dist/apps/api/staging.env; PATH=$PATH://home/coscradmin/.nvm/versions/node/v18.16.0/bin pm2 restart main; echo API restarted', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: 'build', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'dist/**, node_modules/**')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
}
}
}
}
}
}

0 comments on commit 6d5dd90

Please sign in to comment.