Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit 67cef57

Browse files
authored
Refactor fab set to set image tag in service directory config file (#378)
1 parent 6326c1a commit 67cef57

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/lib/fileutils.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ export const generateAccessYaml = (
7373

7474
/**
7575
* Outputs a bash string for a _safe_ source branch string -- a string where all
76-
* '/' and '.' in the string have been replaced with a '-'`
76+
* '/', '.', and '_' in the string have been replaced with a '-'`
7777
*/
7878

79-
export const SAFE_SOURCE_BRANCH = `$(echo $(Build.SourceBranchName) | tr / - | tr . -)`;
79+
export const SAFE_SOURCE_BRANCH = `$(echo $(Build.SourceBranchName) | tr / - | tr . - | tr _ - )`;
8080

8181
/**
8282
* Outputs a bash script to generate a _safe_ azure container registry url where it's all lowercase.
@@ -298,7 +298,9 @@ export const serviceBuildAndUpdatePipeline = (
298298
`echo "Image Name: $IMAGE_NAME"`,
299299
`export IMAGE_REPO=${IMAGE_REPO}`,
300300
`echo "Image Repository: $IMAGE_REPO"`,
301-
`../fab/fab set --subcomponent $(Build.Repository.Name).$FAB_SAFE_SERVICE_NAME.${SAFE_SOURCE_BRANCH}.chart image.tag=$IMAGE_TAG image.repository=$IMAGE_REPO/$BUILD_REPO_NAME`,
301+
`cd $(Build.Repository.Name)/$FAB_SAFE_SERVICE_NAME/${SAFE_SOURCE_BRANCH}`,
302+
`echo "FAB SET"`,
303+
`fab set --subcomponent chart image.tag=$IMAGE_TAG image.repository=$IMAGE_REPO/$BUILD_REPO_NAME`,
302304
`echo "GIT STATUS"`,
303305
`git status`,
304306
`echo "GIT ADD (git add -A)"`,

src/test/mockFactory.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@ export const createTestServiceBuildAndUpdatePipelineYaml = (
139139
`echo "Image Name: $IMAGE_NAME"`,
140140
`export IMAGE_REPO=${IMAGE_REPO}`,
141141
`echo "Image Repository: $IMAGE_REPO"`,
142-
`../fab/fab set --subcomponent $(Build.Repository.Name).$FAB_SAFE_SERVICE_NAME.${SAFE_SOURCE_BRANCH}.chart image.tag=$IMAGE_TAG image.repository=$IMAGE_REPO/$BUILD_REPO_NAME`,
142+
`cd $(Build.Repository.Name)/$FAB_SAFE_SERVICE_NAME/${SAFE_SOURCE_BRANCH}`,
143+
`echo "FAB SET"`,
144+
`fab set --subcomponent chart image.tag=$IMAGE_TAG image.repository=$IMAGE_REPO/$BUILD_REPO_NAME`,
143145
`echo "GIT STATUS"`,
144146
`git status`,
145147
`echo "GIT ADD (git add -A)"`,

0 commit comments

Comments
 (0)