@@ -3,6 +3,7 @@ import yaml from "js-yaml";
33import path from "path" ;
44import {
55 ACCESS_FILENAME ,
6+ HELM_VERSION ,
67 HLD_COMPONENT_FILENAME ,
78 PROJECT_PIPELINE_FILENAME ,
89 RENDER_HLD_PIPELINE_FILENAME ,
@@ -162,7 +163,7 @@ export const serviceBuildAndUpdatePipeline = (
162163 {
163164 task : "HelmInstaller@1" ,
164165 inputs : {
165- helmVersionToInstall : "2.16.3"
166+ helmVersionToInstall : HELM_VERSION
166167 }
167168 } ,
168169 {
@@ -234,7 +235,7 @@ export const serviceBuildAndUpdatePipeline = (
234235 {
235236 task : "HelmInstaller@1" ,
236237 inputs : {
237- helmVersionToInstall : "2.16.3"
238+ helmVersionToInstall : HELM_VERSION
238239 }
239240 } ,
240241 {
@@ -281,18 +282,14 @@ export const serviceBuildAndUpdatePipeline = (
281282 `cd $(Build.Repository.Name)/$FAB_SAFE_SERVICE_NAME/${ SAFE_SOURCE_BRANCH } ` ,
282283 `echo "FAB SET"` ,
283284 `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` ,
288285 `` ,
289286 `# Set git identity` ,
290287 `git config user.email "admin@azuredevops.com"` ,
291288 `git config user.name "Automated Account"` ,
292289 `` ,
293290 `# 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 ` ,
296293 `` ,
297294 `# Git Push` ,
298295 `git_push` ,
@@ -496,7 +493,7 @@ const manifestGenerationPipelineYaml = (): string => {
496493 {
497494 task : "HelmInstaller@1" ,
498495 inputs : {
499- helmVersionToInstall : "2.16.3"
496+ helmVersionToInstall : HELM_VERSION
500497 }
501498 } ,
502499 {
@@ -696,7 +693,7 @@ const hldLifecyclePipelineYaml = (): string => {
696693 {
697694 task : "HelmInstaller@1" ,
698695 inputs : {
699- helmVersionToInstall : "2.16.3"
696+ helmVersionToInstall : HELM_VERSION
700697 }
701698 } ,
702699 {
@@ -735,18 +732,21 @@ const hldLifecyclePipelineYaml = (): string => {
735732 `git checkout -b "RECONCILE/$(Build.Repository.Name)-$(Build.BuildNumber)"` ,
736733 `echo "spk hld reconcile $(Build.Repository.Name) $PWD ./.."` ,
737734 `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` ,
742735 `` ,
743736 `# Set git identity` ,
744737 `git config user.email "admin@azuredevops.com"` ,
745738 `git config user.name "Automated Account"` ,
746739 `` ,
747740 `# 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` ,
750750 `` ,
751751 `# Git Push` ,
752752 `git_push` ,
0 commit comments