@@ -7,7 +7,12 @@ import commander from "commander";
7
7
import path from "path" ;
8
8
import { Config } from "../../config" ;
9
9
import { 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" ;
11
16
import {
12
17
BUILD_SCRIPT_URL ,
13
18
SERVICE_PIPELINE_FILENAME ,
@@ -28,12 +33,12 @@ import {
28
33
} from "../../lib/pipelines/pipelines" ;
29
34
import { logger } from "../../logger" ;
30
35
import decorator from "./pipeline.decorator.json" ;
36
+ import { build as buildError } from "../../lib/errorBuilder" ;
37
+ import { errorStatusCode } from "../../lib/errorStatusCode" ;
31
38
import {
32
39
validateOrgNameThrowable ,
33
40
validateProjectNameThrowable ,
34
41
} from "../../lib/validator" ;
35
- import { build as buildError } from "../../lib/errorBuilder" ;
36
- import { errorStatusCode } from "../../lib/errorStatusCode" ;
37
42
38
43
export interface CommandOptions {
39
44
orgName : string ;
@@ -51,22 +56,19 @@ export const fetchValues = async (
51
56
serviceName : string ,
52
57
opts : CommandOptions
53
58
) : Promise < CommandOptions > => {
54
- const { azure_devops } = Config ( ) ;
55
59
const gitOriginUrl = await getOriginUrl ( ) ;
56
60
const repoUrl = validateRepoUrl ( opts , gitOriginUrl ) ;
57
61
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
+
62
65
opts . pipelineName = opts . pipelineName || serviceName + "-pipeline" ;
63
66
opts . repoName = getRepositoryName ( repoUrl ) ;
64
67
opts . repoUrl = opts . repoUrl || getRepositoryUrl ( gitOriginUrl ) ;
65
68
opts . buildScriptUrl = opts . buildScriptUrl || BUILD_SCRIPT_URL ;
66
69
67
70
validateOrgNameThrowable ( opts . orgName ) ;
68
71
validateProjectNameThrowable ( opts . devopsProject ) ;
69
-
70
72
return opts ;
71
73
} ;
72
74
@@ -168,13 +170,15 @@ export const execute = async (
168
170
try {
169
171
const gitOriginUrl = await getOriginUrl ( ) ;
170
172
const repoUrl = validateRepoUrl ( opts , gitOriginUrl ) ;
171
- const gitUrlType = await isGitHubUrl ( repoUrl ) ;
173
+ const gitUrlType = isGitHubUrl ( repoUrl ) ;
174
+
172
175
if ( gitUrlType ) {
173
176
throw buildError ( errorStatusCode . VALIDATION_ERR , {
174
177
errorKey : "project-pipeline-err-github-repo" ,
175
178
values : [ repoUrl ] ,
176
179
} ) ;
177
180
}
181
+
178
182
await fetchValues ( serviceName , opts ) ;
179
183
const accessOpts : AzureDevOpsOpts = {
180
184
orgName : opts . orgName ,
0 commit comments