-
Notifications
You must be signed in to change notification settings - Fork 0
/
omniPromote.js
48 lines (40 loc) · 1.38 KB
/
omniPromote.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env node
const fs = require('fs');
var util=require('util')
var exec=require('child_process').exec;
var argv = require ("argp").createParser ({ once: true })
.allowUndefinedArguments ()
.allowUndefinedOptions ()
.argv ();
console.log(argv);
/////////// docker block
if (argv.docker) {
var bulkPromote = '';
if (argv.dockerDestination) {
var destination = argv.dockerDestination;
}
else {
console.error('the destination tag for the docker images is required. Where is it all going?')
return 1;
}
// default value
var dockerEnvironmentFile = './exportObject.json';
if (argv.dockerEnvironmentFile) {
dockerEnvironmentFile = argv.dockerEnvironmentFile;
}
let dockerEnvironment = JSON.parse(fs.readFileSync(dockerEnvironmentFile).toString());
console.log(dockerEnvironment);
dockerEnvironment.images.forEach(image => {
var singlePromote='dockerPromote '+image.fullImage+' '+ image.build +' '+destination;
console.log(singlePromote);
bulkPromote = singlePromote + '\n' + bulkPromote;
})
console.log('//////////////// bulk')
console.log(bulkPromote);
console.log('/////////////////////////////////// output of execution')
exec(bulkPromote,function(err,stdout,stderr){
console.log(err);
console.log(stdout);
console.log(stderr);
})
}