Skip to content

Commit

Permalink
Fix UIKit jenkinsfile (#1752)
Browse files Browse the repository at this point in the history
  • Loading branch information
AtomXY authored Apr 18, 2023
1 parent cd37d05 commit b864818
Showing 1 changed file with 57 additions and 71 deletions.
128 changes: 57 additions & 71 deletions deploy/web/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ G_webbuild = "Not set"
G_webdeploy = "Not set"
G_statusMergedPR = 'closed'
G_developmentBranch = 'development'
G_global_npm_path = "/var/jenkins_home/workspace/Front"
G_global_npm_path = null
G_buildImage = null

pipeline {
agent {
dockerfile {
dir 'deploy/dockerfiles'
filename 'Dockerfile_Web'
label 'master'
}
label 'linux'
}
parameters {
string(name: 'BRANCH', defaultValue: 'development', description: 'Branch for the build')
Expand Down Expand Up @@ -48,79 +45,68 @@ pipeline {
disableConcurrentBuilds()
}
stages {
stage('Prepare environment') {
steps {
script {
G_buildImage = "uikit-build-${UUID.randomUUID().toString().toLowerCase()}"
docker.build(G_buildImage, '--no-cache --force-rm -f deploy/dockerfiles/Dockerfile_Web deploy')
}
}
}
stage('Check the merge to development') {
when { anyOf { environment name: 'FORCE', value: 'true'; allOf {expression { "${action}" == G_statusMergedPR}; expression { "${destination_branch}" == G_developmentBranch}}}}
stages {
stage('Pre-setup') {
steps {
script {
def buildCause = currentBuild.getBuildCauses()
echo "buildCause: ${buildCause}";
}
}
post {
success {
script{G_setup = "success"}
steps {
script {
docker.image(G_buildImage).inside() {
stage('Pre-setup') {
G_global_npm_path = pwd()
try {
def buildCause = currentBuild.getBuildCauses()
echo "buildCause: ${buildCause}"
G_setup = "success"
} catch(ex) {
G_setup = "failure"
error "Pre-setup failed"
}
}
failure {
script{G_setup = "failure"}
stage('Lerna boostrap') {
try {
sshagent (credentials: [G_gitcred]) {
sh """
npx lerna bootstrap && npx lerna run prepare
"""
}
G_install = "success"
} catch(ex) {
G_install = "failure"
error "Lerna boostrap failed"
}
}
}
}
stage('Lerna boostrap') {
steps{
script {
sshagent (credentials: [G_gitcred]) {
stage('Webapp build'){
try {
sh """
npx lerna bootstrap && npx lerna run prepare
cd Example
yarn run web:bundle
"""
G_webbuild = "success"
} catch(ex) {
G_webbuild = "failure"
error "Lerna boostrap failed"
}
}
}
post {
success {
script{G_install = "success"}
}
failure {
script{G_install = "failure"}
}
}
}
stage('Webapp build'){
steps {
script {
sh """
cd Example
yarn run web:bundle
"""
}
}
post {
success {
script{G_webbuild = "success"}
}
failure {
script{G_webbuild = "failure"}
}
}
}
stage('Webapp deploy'){
steps {
script {
sh """
npm config set prefix $G_global_npm_path
alias firebase="`npm config get prefix`/bin/firebase"
cd Example
firebase deploy --token "$token"
"""
}
}
post {
success {
script{G_webdeploy = "success"}
}
failure {
script{G_webdeploy = "failure"}
stage('Webapp deploy'){
try {
sh """
npm config set prefix $G_global_npm_path
alias firebase="`npm config get prefix`/bin/firebase"
cd Example
firebase deploy --token "$token"
"""
G_webdeploy = "success"
} catch(ex) {
G_webdeploy = "failure"
error "Webapp deploy failed"
}
}
}
}
Expand Down

0 comments on commit b864818

Please sign in to comment.