From 4003283f414cab576e8256e0966f9dc796915e38 Mon Sep 17 00:00:00 2001 From: Surekha Weinberg Date: Tue, 26 Sep 2023 19:05:23 -0700 Subject: [PATCH 1/2] draft parallel env builds --- Jenkinsfile | 89 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 79 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ceaaf30c73..21e135ffb3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,36 @@ +void buildAssetsForEachEnv(env) { + script { + // Check for semantic-release commit + // if ("$GIT_COMMIT_MESSAGE".contains('chore(release):')) { + if ("$GIT_COMMIT_MESSAGE".contains('testBuild:')) { + echo 'stage $env assets' + withCredentials([usernamePassword(credentialsId: 'web-cli-creds', passwordVariable: 'SVC_ACC_PASSWORD', usernameVariable: 'SVC_ACC_USERNAME')]) { + sh ''' + npm run build:$env + OUTPUT=$(web stage --json --tag $STAGE_TAG) + web notify $STAGE_TAG + ''' + } + } + return; + } +} + +void deployAssetsForEachEnv(env) { + when { + // branch 'release' + branch 'jenkinsTest' + } + script { + if ($env ==== "production"); { + dir="js" + } + sh ''' + echo Deploying $env + ''' + } +} + pipeline { agent { label 'mesos' @@ -35,7 +68,8 @@ pipeline { stage('Stage Tag') { when { not { - branch 'release' + // branch 'release' + branch 'jenkinsTest' } } steps { @@ -49,17 +83,52 @@ pipeline { } // For release, stage existing build assets and send notification - stage('Deploy') { + stage('Parallel Build') { when { - branch 'release' + // branch 'release' + branch 'jenkinsTest' } - steps { - withCredentials([usernamePassword(credentialsId: 'web-cli-creds', passwordVariable: 'SVC_ACC_PASSWORD', usernameVariable: 'SVC_ACC_USERNAME')]) { - sh ''' - OUTPUT=$(web stage --json --tag $STAGE_TAG) - web notify $STAGE_TAG - ''' - } + parallel { + stage('Build Stage') { + steps{ + buildAssetsForEachEnv(stage) + } + }, + stage('Build Sandbox') { + steps{ + buildAssetsForEachEnv(sandbox) + } + }, + stage('Build Production') { + steps{ + buildAssetsForEachEnv(production) + } + }, + } + }, + + // For release, deploy existing build assets + stage('Parallel Deploy') { + when { + // branch 'release' + branch 'jenkinsTest' + } + parallel { + stage('Deploy Stage') { + steps { + deployAssetsForEachEnv(stage) + } + }, + stage('Deploy Sandbox') { + steps { + deployAssetsForEachEnv(sandbox) + } + }, + stage('Deploy Production') { + steps { + deployAssetsForEachEnv(production) + } + }, } } } From 202f9052031206d2bcbaed591099c3419f12b6d4 Mon Sep 17 00:00:00 2001 From: Surekha Weinberg Date: Tue, 26 Sep 2023 19:06:51 -0700 Subject: [PATCH 2/2] testBuild: 1 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f0d18b8379..383acef2f5 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![Compare Snapshots](https://github.com/paypal/paypal-messaging-components/actions/workflows/snapshotCompare.yml/badge.svg)](https://github.com/paypal/paypal-messaging-components/actions/workflows/snapshotCompare.yml) [![dependencies Status](https://david-dm.org/paypal/paypal-messaging-components/status.svg)](https://david-dm.org/paypal/paypal-messaging-components) [![devDependencies Status](https://david-dm.org/paypal/paypal-messaging-components/dev-status.svg)](https://david-dm.org/paypal/paypal-messaging-components?type=dev) A messaging component allowing easy integration of PayPal Credit Messages onto your site. +1 ## Dev Docs