@@ -3,6 +3,7 @@ import yaml from "js-yaml";
3
3
import path from "path" ;
4
4
import {
5
5
ACCESS_FILENAME ,
6
+ HELM_VERSION ,
6
7
HLD_COMPONENT_FILENAME ,
7
8
PROJECT_PIPELINE_FILENAME ,
8
9
RENDER_HLD_PIPELINE_FILENAME ,
@@ -162,7 +163,7 @@ export const serviceBuildAndUpdatePipeline = (
162
163
{
163
164
task : "HelmInstaller@1" ,
164
165
inputs : {
165
- helmVersionToInstall : "2.16.3"
166
+ helmVersionToInstall : HELM_VERSION
166
167
}
167
168
} ,
168
169
{
@@ -234,7 +235,7 @@ export const serviceBuildAndUpdatePipeline = (
234
235
{
235
236
task : "HelmInstaller@1" ,
236
237
inputs : {
237
- helmVersionToInstall : "2.16.3"
238
+ helmVersionToInstall : HELM_VERSION
238
239
}
239
240
} ,
240
241
{
@@ -281,18 +282,14 @@ export const serviceBuildAndUpdatePipeline = (
281
282
`cd $(Build.Repository.Name)/$FAB_SAFE_SERVICE_NAME/${ SAFE_SOURCE_BRANCH } ` ,
282
283
`echo "FAB SET"` ,
283
284
`fab set --subcomponent chart image.tag=$IMAGE_TAG image.repository=$IMAGE_REPO/$BUILD_REPO_NAME` ,
284
- `echo "GIT STATUS"` ,
285
- `git status` ,
286
- `echo "GIT ADD (git add -A)"` ,
287
- `git add -A` ,
288
285
`` ,
289
286
`# Set git identity` ,
290
287
`git config user.email "[email protected] "` ,
291
288
`git config user.name "Automated Account"` ,
292
289
`` ,
293
290
`# Commit changes` ,
294
- `echo "GIT COMMIT"` ,
295
- `git commit -m "Updating $SERVICE_NAME_LOWER image tag to ${ IMAGE_TAG } ."` ,
291
+ `echo "GIT ADD and COMMIT -- Will throw error if there is nothing to commit. "` ,
292
+ `git_commit_if_changes "Updating $SERVICE_NAME_LOWER image tag to ${ IMAGE_TAG } ." 1 unusedVar ` ,
296
293
`` ,
297
294
`# Git Push` ,
298
295
`git_push` ,
@@ -496,7 +493,7 @@ const manifestGenerationPipelineYaml = (): string => {
496
493
{
497
494
task : "HelmInstaller@1" ,
498
495
inputs : {
499
- helmVersionToInstall : "2.16.3"
496
+ helmVersionToInstall : HELM_VERSION
500
497
}
501
498
} ,
502
499
{
@@ -696,7 +693,7 @@ const hldLifecyclePipelineYaml = (): string => {
696
693
{
697
694
task : "HelmInstaller@1" ,
698
695
inputs : {
699
- helmVersionToInstall : "2.16.3"
696
+ helmVersionToInstall : HELM_VERSION
700
697
}
701
698
} ,
702
699
{
@@ -735,18 +732,21 @@ const hldLifecyclePipelineYaml = (): string => {
735
732
`git checkout -b "RECONCILE/$(Build.Repository.Name)-$(Build.BuildNumber)"` ,
736
733
`echo "spk hld reconcile $(Build.Repository.Name) $PWD ./.."` ,
737
734
`spk hld reconcile $(Build.Repository.Name) $PWD ./..` ,
738
- `echo "GIT STATUS"` ,
739
- `git status` ,
740
- `echo "GIT ADD (git add -A)"` ,
741
- `git add -A` ,
742
735
`` ,
743
736
`# Set git identity` ,
744
737
`git config user.email "[email protected] "` ,
745
738
`git config user.name "Automated Account"` ,
746
739
`` ,
747
740
`# Commit changes` ,
748
- `echo "GIT COMMIT"` ,
749
- `git commit -m "Reconciling HLD with $(Build.Repository.Name)-$(Build.BuildNumber)."` ,
741
+ `echo "GIT ADD and COMMIT -- Will NOT throw error if there is nothing to commit."` ,
742
+ `didCommit=0` ,
743
+ `git_commit_if_changes "Reconciling HLD with $(Build.Repository.Name)-$(Build.BuildNumber)." 0 didCommit` ,
744
+ `` ,
745
+ `# Skip push and opening PR steps if there were no changes changes to commit.` ,
746
+ `if [ $didCommit == 0 ]; then` ,
747
+ `echo "DID NOT FIND CHANGES TO COMMIT. EXITING."` ,
748
+ `exit 0` ,
749
+ `fi` ,
750
750
`` ,
751
751
`# Git Push` ,
752
752
`git_push` ,
0 commit comments