@@ -13,7 +13,6 @@ import {
1313 SERVICE_PIPELINE_FILENAME
1414} from "../../lib/constants" ;
1515import { IAzureDevOpsOpts } from "../../lib/git" ;
16- import { GitAPI } from "../../lib/git/azure" ;
1716import {
1817 getOriginUrl ,
1918 getRepositoryName ,
@@ -81,14 +80,21 @@ export const execute = async (
8180 project : opts . devopsProject
8281 } ;
8382
83+ // if a packages dir is supplied, its a mono-repo
84+ const pipelinesYamlPath = opts . packagesDir
85+ ? // if a packages dir is supplied, concat <packages-dir>/<service-name>
86+ path . join ( opts . packagesDir , serviceName , SERVICE_PIPELINE_FILENAME )
87+ : // if no packages dir, then just concat with the service directory.
88+ path . join ( serviceName , SERVICE_PIPELINE_FILENAME ) ;
89+
8490 // By default the version descriptor is for the master branch
8591 await repositoryHasFile (
86- SERVICE_PIPELINE_FILENAME ,
92+ pipelinesYamlPath ,
8793 opts . yamlFileBranch ? opts . yamlFileBranch : "master" ,
8894 opts . repoName ,
8995 accessOpts
9096 ) ;
91- await installBuildUpdatePipeline ( serviceName , opts ) ;
97+ await installBuildUpdatePipeline ( serviceName , pipelinesYamlPath , opts ) ;
9298 await exitFn ( 0 ) ;
9399 } catch ( err ) {
94100 logger . error ( err ) ;
@@ -112,10 +118,12 @@ export const commandDecorator = (command: commander.Command) => {
112118 * @param serviceName Name of the service this pipeline belongs to;
113119 * this is only used when `packagesDir` is defined as a means
114120 * to locate the azure-pipelines.yaml file
121+ * @param pipelinesYamlPath Relative path to the build update hld pipelines yaml file in the repository
115122 * @param values Values from commander
116123 */
117124export const installBuildUpdatePipeline = async (
118125 serviceName : string ,
126+ pipelinesYamlPath : string ,
119127 values : ICommandOptions
120128) => {
121129 let devopsClient : IBuildApi | undefined ;
@@ -128,13 +136,6 @@ export const installBuildUpdatePipeline = async (
128136 ) ;
129137 logger . info ( "Fetched DevOps Client" ) ;
130138
131- // if a packages dir is supplied, its a mono-repo
132- const yamlFilePath = values . packagesDir
133- ? // if a packages dir is supplied, concat <packages-dir>/<service-name>
134- path . join ( values . packagesDir , serviceName , SERVICE_PIPELINE_FILENAME )
135- : // if no packages dir, then just concat with the service directory.
136- path . join ( serviceName , SERVICE_PIPELINE_FILENAME ) ;
137-
138139 const definition = definitionForAzureRepoPipeline ( {
139140 branchFilters : [ "master" ] ,
140141 maximumConcurrentBuilds : 1 ,
@@ -143,7 +144,7 @@ export const installBuildUpdatePipeline = async (
143144 repositoryUrl : values . repoUrl ,
144145 variables : requiredPipelineVariables ( values . buildScriptUrl ) ,
145146 yamlFileBranch : values . yamlFileBranch ,
146- yamlFilePath
147+ yamlFilePath : pipelinesYamlPath
147148 } ) ;
148149
149150 logger . debug (
@@ -153,7 +154,7 @@ export const installBuildUpdatePipeline = async (
153154 ) ;
154155
155156 logger . info (
156- `Attempting to create new pipeline: ${ values . pipelineName } defined in repository:${ values . repoUrl } , branch: ${ values . yamlFileBranch } , filePath: ${ yamlFilePath } `
157+ `Attempting to create new pipeline: ${ values . pipelineName } defined in repository:${ values . repoUrl } , branch: ${ values . yamlFileBranch } , filePath: ${ pipelinesYamlPath } `
157158 ) ;
158159
159160 builtDefinition = await createPipelineForDefinition (
0 commit comments