@@ -5,12 +5,11 @@ import yaml from "js-yaml";
55import path from "path" ;
66import process from "process" ;
77import shelljs , { TestOptions } from "shelljs" ;
8- import url from "url" ;
98import { Bedrock } from "../../config" ;
109import { assertIsStringWithContent } from "../../lib/assertions" ;
1110import { build as buildCmd , exit as exitCmd } from "../../lib/commandBuilder" ;
1211import { generateAccessYaml } from "../../lib/fileutils" ;
13- import { getOriginUrl } from "../../lib/gitutils" ;
12+ import { getAzdoOriginUrl , getOriginUrl } from "../../lib/gitutils" ;
1413import { TraefikIngressRoute } from "../../lib/traefik/ingress-route" ;
1514import {
1615 ITraefikMiddleware ,
@@ -170,7 +169,7 @@ export const execute = async (
170169 createStaticComponent,
171170 exec : execAndLog ,
172171 generateAccessYaml,
173- getGitOrigin : getOriginUrl ,
172+ getGitOrigin : tryGetGitOrigin ,
174173 test : shelljs . test ,
175174 writeFile : writeFileSync
176175 } ;
@@ -211,6 +210,17 @@ export const commandDecorator = (command: commander.Command) => {
211210 ) ;
212211} ;
213212
213+ export const tryGetGitOrigin = async (
214+ absRepoPath ?: string
215+ ) : Promise < string > => {
216+ return getAzdoOriginUrl ( ) . catch ( _ => {
217+ logger . warn (
218+ "Could not get Git Origin for Azure DevOps - are you running 'spk' _not_ in a pipeline?"
219+ ) ;
220+ return getOriginUrl ( absRepoPath ) ;
221+ } ) ;
222+ } ;
223+
214224export const reconcileHld = async (
215225 dependencies : IReconcileDependencies ,
216226 bedrockYaml : IBedrockFile ,
@@ -231,7 +241,7 @@ export const reconcileHld = async (
231241 // Repository in HLD ie /path/to/hld/repositoryName/
232242 const absRepositoryInHldPath = path . join ( absHldPath , repositoryName ) ;
233243
234- // Create access.yaml containing the bedrock application repo's URL in access.yaml.
244+ // Create access.yaml containing the bedrock application repo's URL in
235245 await dependencies . createAccessYaml (
236246 dependencies . getGitOrigin ,
237247 dependencies . generateAccessYaml ,
0 commit comments