now testing shell
This commit is contained in:
parent
3300f177ca
commit
faef4da6be
1
dist/npmci.bash.d.ts
vendored
1
dist/npmci.bash.d.ts
vendored
@ -1,2 +1,3 @@
|
|||||||
import "typings-global";
|
import "typings-global";
|
||||||
export declare let bash: (commandArg: any) => void;
|
export declare let bash: (commandArg: any) => void;
|
||||||
|
export declare let bashBare: (commandArg: any) => void;
|
||||||
|
18
dist/npmci.bash.js
vendored
18
dist/npmci.bash.js
vendored
@ -2,12 +2,28 @@
|
|||||||
require("typings-global");
|
require("typings-global");
|
||||||
var plugins = require("./npmci.plugins");
|
var plugins = require("./npmci.plugins");
|
||||||
exports.bash = function (commandArg) {
|
exports.bash = function (commandArg) {
|
||||||
|
if (!process.env.NPMTS_TEST) {
|
||||||
var exitCode = plugins.shelljs.exec("bash -c \"source /usr/local/nvm/nvm.sh &&" +
|
var exitCode = plugins.shelljs.exec("bash -c \"source /usr/local/nvm/nvm.sh &&" +
|
||||||
commandArg +
|
commandArg +
|
||||||
"\"").code;
|
"\"").code;
|
||||||
if (exitCode !== 0) {
|
if (exitCode !== 0) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
plugins.beautylog.log("ShellExec would be: " + commandArg.blue);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports.bashBare = function (commandArg) {
|
||||||
|
if (!process.env.NPMTS_TEST) {
|
||||||
|
var exitCode = plugins.shelljs.exec(commandArg).code;
|
||||||
|
if (exitCode !== 0) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
plugins.beautylog.log("ShellExec would be: " + commandArg.blue);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmJhc2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQ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SB7XG4gICAgICAgIHBsdWdpbnMuYmVhdXR5bG9nLmxvZyhcIlNoZWxsRXhlYyB3b3VsZCBiZTogXCIgKyBjb21tYW5kQXJnLmJsdWUpXG4gICAgfVxufSJdfQ==
|
||||||
|
7
dist/npmci.build.docker.js
vendored
7
dist/npmci.build.docker.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -4,6 +4,7 @@ import path = require("path");
|
|||||||
import * as beautylog from "beautylog"
|
import * as beautylog from "beautylog"
|
||||||
//set up environment
|
//set up environment
|
||||||
process.env.CI_BUILD_REPO = "https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git";
|
process.env.CI_BUILD_REPO = "https://yyyyyy:xxxxxxxx@gitlab.com/mygroup/myrepo.git";
|
||||||
|
process.env.NPMTS_TEST = "true";
|
||||||
process.cwd = () => {
|
process.cwd = () => {
|
||||||
return path.join(__dirname,"assets/");
|
return path.join(__dirname,"assets/");
|
||||||
};
|
};
|
||||||
@ -39,6 +40,12 @@ describe("NPMCI",function(){
|
|||||||
console.log(sortedArrayArg);
|
console.log(sortedArrayArg);
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
|
});
|
||||||
|
it("should correctly chain Dockerfile handling",function(done){
|
||||||
|
NpmciBuildDocker.build()
|
||||||
|
.then(()=>{
|
||||||
|
done();
|
||||||
|
});
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
@ -1,6 +1,7 @@
|
|||||||
import "typings-global";
|
import "typings-global";
|
||||||
import * as plugins from "./npmci.plugins";
|
import * as plugins from "./npmci.plugins";
|
||||||
export let bash = (commandArg) => {
|
export let bash = (commandArg) => {
|
||||||
|
if(!process.env.NPMTS_TEST){
|
||||||
let exitCode = plugins.shelljs.exec(
|
let exitCode = plugins.shelljs.exec(
|
||||||
"bash -c \"source /usr/local/nvm/nvm.sh &&" +
|
"bash -c \"source /usr/local/nvm/nvm.sh &&" +
|
||||||
commandArg +
|
commandArg +
|
||||||
@ -9,8 +10,18 @@ export let bash = (commandArg) => {
|
|||||||
if(exitCode !== 0){
|
if(exitCode !== 0){
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
plugins.beautylog.log("ShellExec would be: " + commandArg.blue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export let bashBare = () => {
|
export let bashBare = (commandArg) => {
|
||||||
|
if (!process.env.NPMTS_TEST){
|
||||||
|
let exitCode = plugins.shelljs.exec(commandArg).code;
|
||||||
|
if(exitCode !== 0){
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
plugins.beautylog.log("ShellExec would be: " + commandArg.blue)
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
import * as plugins from "./npmci.plugins"
|
import * as plugins from "./npmci.plugins"
|
||||||
import * as NpmciEnv from "./npmci.env";
|
import * as NpmciEnv from "./npmci.env";
|
||||||
|
import {bashBare} from "./npmci.bash";
|
||||||
export let build = function(){
|
export let build = function(){
|
||||||
let done = plugins.q.defer();
|
let done = plugins.q.defer();
|
||||||
readDockerfiles()
|
readDockerfiles()
|
||||||
@ -104,7 +104,7 @@ export class Dockerfile {
|
|||||||
if(!this.buildTag){
|
if(!this.buildTag){
|
||||||
this.patchContents();
|
this.patchContents();
|
||||||
let tag = dockerTag(this.repo,this.version);
|
let tag = dockerTag(this.repo,this.version);
|
||||||
plugins.shelljs.exec("docker build -t " + tag + " -f " + this.filePath + " .");
|
bashBare("docker build -t " + tag + " -f " + this.filePath + " .");
|
||||||
this.buildTag = tag;
|
this.buildTag = tag;
|
||||||
NpmciEnv.dockerFilesBuilt.push(this);
|
NpmciEnv.dockerFilesBuilt.push(this);
|
||||||
this.restoreContents();
|
this.restoreContents();
|
||||||
@ -115,7 +115,7 @@ export class Dockerfile {
|
|||||||
};
|
};
|
||||||
push(){
|
push(){
|
||||||
if(this.buildTag){
|
if(this.buildTag){
|
||||||
plugins.shelljs.exec("docker push " + this.buildTag);
|
bashBare("docker push " + this.buildTag);
|
||||||
} else {
|
} else {
|
||||||
plugins.beautylog.error("Dockerfile hasn't been built yet!");
|
plugins.beautylog.error("Dockerfile hasn't been built yet!");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user