File tree Expand file tree Collapse file tree 6 files changed +29
-13
lines changed
interface/cli/commands/context/create/git Expand file tree Collapse file tree 6 files changed +29
-13
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,17 @@ const command = new Command({
17
17
title : 'Create Git Context' ,
18
18
} ,
19
19
builder : ( yargs ) => {
20
- yargs . option ( 'sharing-policy' , {
21
- describe : 'Set the sharing policy for git contexts' ,
22
- choices : [ 'AccountAdmins' , 'AllUsersInAccount' ] ,
23
- default : 'AccountAdmins' ,
24
- } ) ;
20
+ yargs
21
+ . option ( 'sharing-policy' , {
22
+ describe : 'Set the sharing policy for git contexts' ,
23
+ choices : [ 'AccountAdmins' , 'AllUsersInAccount' ] ,
24
+ default : 'AccountAdmins' ,
25
+ } )
26
+ . option ( 'skip-validation' , {
27
+ describe : 'Set to true to skip validation' ,
28
+ type : 'boolean' ,
29
+ default : false ,
30
+ } ) ;
25
31
return yargs ;
26
32
} ,
27
33
handler : async ( argv ) => {
Original file line number Diff line number Diff line change @@ -58,8 +58,11 @@ const command = new Command({
58
58
if ( ! data . metadata . name || ! data . spec . type ) {
59
59
throw new CFError ( 'Name and type must be provided' ) ;
60
60
}
61
-
62
- await context . createContext ( data ) ;
61
+ const opt = { } ;
62
+ if ( argv . skipValidation ) {
63
+ opt . skipValidation = true ;
64
+ }
65
+ await context . createContext ( data , opt ) ;
63
66
console . log ( `Context: ${ data . metadata . name } created` ) ;
64
67
} ,
65
68
} ) ;
Original file line number Diff line number Diff line change @@ -72,8 +72,11 @@ const command = new Command({
72
72
if ( ! data . metadata . name || ! data . spec . type ) {
73
73
throw new CFError ( 'Name and type must be provided' ) ;
74
74
}
75
-
76
- await context . createContext ( data ) ;
75
+ const opt = { } ;
76
+ if ( argv . skipValidation ) {
77
+ opt . skipValidation = true ;
78
+ }
79
+ await context . createContext ( data , opt ) ;
77
80
console . log ( `Context: ${ data . metadata . name } created` ) ;
78
81
} ,
79
82
} ) ;
Original file line number Diff line number Diff line change @@ -63,8 +63,11 @@ const command = new Command({
63
63
if ( ! data . metadata . name || ! data . spec . type ) {
64
64
throw new CFError ( 'Name and type must be provided' ) ;
65
65
}
66
-
67
- await context . createContext ( data ) ;
66
+ const opt = { } ;
67
+ if ( argv . skipValidation ) {
68
+ opt . skipValidation = true ;
69
+ }
70
+ await context . createContext ( data , opt ) ;
68
71
console . log ( `Context: ${ data . metadata . name } created` ) ;
69
72
} ,
70
73
} ) ;
Original file line number Diff line number Diff line change @@ -12,11 +12,12 @@ const _extractFieldsForContextEntity = context => ({
12
12
} ) ;
13
13
14
14
15
- const createContext = async ( data ) => {
15
+ const createContext = async ( data , qs ) => {
16
16
const options = {
17
17
url : '/api/contexts/' ,
18
18
method : 'POST' ,
19
19
body : data ,
20
+ qs,
20
21
} ;
21
22
22
23
return sendHttpRequest ( options ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " codefresh" ,
3
- "version" : " 0.10.4 " ,
3
+ "version" : " 0.11.0 " ,
4
4
"description" : " Codefresh command line utility" ,
5
5
"main" : " index.js" ,
6
6
"preferGlobal" : true ,
You can’t perform that action at this time.
0 commit comments