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({
1717 title : 'Create Git Context' ,
1818 } ,
1919 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+ } ) ;
2531 return yargs ;
2632 } ,
2733 handler : async ( argv ) => {
Original file line number Diff line number Diff line change @@ -58,8 +58,11 @@ const command = new Command({
5858 if ( ! data . metadata . name || ! data . spec . type ) {
5959 throw new CFError ( 'Name and type must be provided' ) ;
6060 }
61-
62- await context . createContext ( data ) ;
61+ const opt = { } ;
62+ if ( argv . skipValidation ) {
63+ opt . skipValidation = true ;
64+ }
65+ await context . createContext ( data , opt ) ;
6366 console . log ( `Context: ${ data . metadata . name } created` ) ;
6467 } ,
6568} ) ;
Original file line number Diff line number Diff line change @@ -72,8 +72,11 @@ const command = new Command({
7272 if ( ! data . metadata . name || ! data . spec . type ) {
7373 throw new CFError ( 'Name and type must be provided' ) ;
7474 }
75-
76- await context . createContext ( data ) ;
75+ const opt = { } ;
76+ if ( argv . skipValidation ) {
77+ opt . skipValidation = true ;
78+ }
79+ await context . createContext ( data , opt ) ;
7780 console . log ( `Context: ${ data . metadata . name } created` ) ;
7881 } ,
7982} ) ;
Original file line number Diff line number Diff line change @@ -63,8 +63,11 @@ const command = new Command({
6363 if ( ! data . metadata . name || ! data . spec . type ) {
6464 throw new CFError ( 'Name and type must be provided' ) ;
6565 }
66-
67- await context . createContext ( data ) ;
66+ const opt = { } ;
67+ if ( argv . skipValidation ) {
68+ opt . skipValidation = true ;
69+ }
70+ await context . createContext ( data , opt ) ;
6871 console . log ( `Context: ${ data . metadata . name } created` ) ;
6972 } ,
7073} ) ;
Original file line number Diff line number Diff line change @@ -12,11 +12,12 @@ const _extractFieldsForContextEntity = context => ({
1212} ) ;
1313
1414
15- const createContext = async ( data ) => {
15+ const createContext = async ( data , qs ) => {
1616 const options = {
1717 url : '/api/contexts/' ,
1818 method : 'POST' ,
1919 body : data ,
20+ qs,
2021 } ;
2122
2223 return sendHttpRequest ( options ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " codefresh" ,
3- "version" : " 0.10.4 " ,
3+ "version" : " 0.11.0 " ,
44 "description" : " Codefresh command line utility" ,
55 "main" : " index.js" ,
66 "preferGlobal" : true ,
You can’t perform that action at this time.
0 commit comments