@@ -7,7 +7,12 @@ import commander from "commander";
77import path from "path" ;
88import { Config } from "../../config" ;
99import { validateRepository } from "../../lib/git/azure" ;
10- import { build as buildCmd , exit as exitCmd } from "../../lib/commandBuilder" ;
10+ import {
11+ build as buildCmd ,
12+ exit as exitCmd ,
13+ populateInheritValueFromConfig ,
14+ validateForRequiredValues ,
15+ } from "../../lib/commandBuilder" ;
1116import {
1217 BUILD_SCRIPT_URL ,
1318 SERVICE_PIPELINE_FILENAME ,
@@ -28,12 +33,12 @@ import {
2833} from "../../lib/pipelines/pipelines" ;
2934import { logger } from "../../logger" ;
3035import decorator from "./pipeline.decorator.json" ;
36+ import { build as buildError } from "../../lib/errorBuilder" ;
37+ import { errorStatusCode } from "../../lib/errorStatusCode" ;
3138import {
3239 validateOrgNameThrowable ,
3340 validateProjectNameThrowable ,
3441} from "../../lib/validator" ;
35- import { build as buildError } from "../../lib/errorBuilder" ;
36- import { errorStatusCode } from "../../lib/errorStatusCode" ;
3742
3843export interface CommandOptions {
3944 orgName : string ;
@@ -51,22 +56,19 @@ export const fetchValues = async (
5156 serviceName : string ,
5257 opts : CommandOptions
5358) : Promise < CommandOptions > => {
54- const { azure_devops } = Config ( ) ;
5559 const gitOriginUrl = await getOriginUrl ( ) ;
5660 const repoUrl = validateRepoUrl ( opts , gitOriginUrl ) ;
5761
58- opts . orgName = opts . orgName || azure_devops ?. org || "" ;
59- opts . personalAccessToken =
60- opts . personalAccessToken || azure_devops ?. access_token || "" ;
61- opts . devopsProject = opts . devopsProject || azure_devops ?. project || "" ;
62+ populateInheritValueFromConfig ( decorator , Config ( ) , opts ) ;
63+ validateForRequiredValues ( decorator , opts , true ) ;
64+
6265 opts . pipelineName = opts . pipelineName || serviceName + "-pipeline" ;
6366 opts . repoName = getRepositoryName ( repoUrl ) ;
6467 opts . repoUrl = opts . repoUrl || getRepositoryUrl ( gitOriginUrl ) ;
6568 opts . buildScriptUrl = opts . buildScriptUrl || BUILD_SCRIPT_URL ;
6669
6770 validateOrgNameThrowable ( opts . orgName ) ;
6871 validateProjectNameThrowable ( opts . devopsProject ) ;
69-
7072 return opts ;
7173} ;
7274
@@ -168,13 +170,15 @@ export const execute = async (
168170 try {
169171 const gitOriginUrl = await getOriginUrl ( ) ;
170172 const repoUrl = validateRepoUrl ( opts , gitOriginUrl ) ;
171- const gitUrlType = await isGitHubUrl ( repoUrl ) ;
173+ const gitUrlType = isGitHubUrl ( repoUrl ) ;
174+
172175 if ( gitUrlType ) {
173176 throw buildError ( errorStatusCode . VALIDATION_ERR , {
174177 errorKey : "project-pipeline-err-github-repo" ,
175178 values : [ repoUrl ] ,
176179 } ) ;
177180 }
181+
178182 await fetchValues ( serviceName , opts ) ;
179183 const accessOpts : AzureDevOpsOpts = {
180184 orgName : opts . orgName ,
0 commit comments