@@ -7,6 +7,7 @@ import {Argv} from "./argv.js";
77import assert from "assert" ;
88import { Utils } from "./utils.js" ;
99import dotenv from "dotenv" ;
10+ import deepmerge from "deepmerge" ;
1011
1112export interface CICDVariable {
1213 type : "file" | "variable" ;
@@ -33,13 +34,15 @@ export class VariablesFromFiles {
3334 let homeFileData : any = { } ;
3435
3536 if ( remoteVariables && ! autoCompleting ) {
36- const match = / (?< url > g i t @ .* ?) = (?< file > .* ?) = (?< ref > .* ) / . exec ( remoteVariables ) ;
37- assert ( match != null , "--remote-variables is malformed use 'git@gitlab.com:firecow/example.git=gitlab-variables.yml=master' syntax" ) ;
38- const url = match . groups ?. url ;
39- const file = match . groups ?. file ;
40- const ref = match . groups ?. ref ;
41- const res = await Utils . bash ( `set -eou pipefail; git archive --remote=${ url } ${ ref } ${ file } | tar -xO ${ file } ` , cwd ) ;
42- remoteFileData = yaml . load ( `${ res . stdout } ` ) ;
37+ for ( let i = 0 ; i < remoteVariables . length ; i ++ ) {
38+ const match = / (?< url > g i t @ .* ?) = (?< file > .* ?) = (?< ref > .* ) / . exec ( remoteVariables [ i ] ) ;
39+ assert ( match != null , "--remote-variables is malformed use 'git@gitlab.com:firecow/example.git=gitlab-variables.yml=master' syntax" ) ;
40+ const url = match . groups ?. url ;
41+ const file = match . groups ?. file ;
42+ const ref = match . groups ?. ref ;
43+ const res = await Utils . bash ( `set -eou pipefail; git archive --remote=${ url } ${ ref } ${ file } | tar -xO ${ file } ` , cwd ) ;
44+ remoteFileData = deepmerge . all ( [ remoteFileData , yaml . load ( `${ res . stdout } ` ) ] ) ;
45+ }
4346 }
4447
4548 if ( await fs . pathExists ( homeVariablesFile ) ) {
0 commit comments