start unclutter env

This commit is contained in:
2016-06-05 21:11:30 +02:00
parent 0d4fd9dbba
commit 0571051009
4 changed files with 26 additions and 12 deletions

View File

@ -3,7 +3,7 @@ import * as plugins from "./npmci.plugins";
export let bash = (commandArg:string,retryArg = 2) => {
if(!process.env.NPMTS_TEST){
for (let i = 0; i <= retryArg; i++){
let exitCode = plugins.shelljs.exec(
let exitCode:number = plugins.shelljs.exec(
"bash -c \"source /usr/local/nvm/nvm.sh &&" +
commandArg +
"\""
@ -11,7 +11,10 @@ export let bash = (commandArg:string,retryArg = 2) => {
if(exitCode !== 0 && i == retryArg){
process.exit(1);
} else if(exitCode == 0){
i = retryArg + 1;
i = retryArg + 1; // if everything works out ok retrials are not wanted
} else {
plugins.beautylog.warn("Something went wrong! Exit Code: " + exitCode.toString);
plugins.beautylog.info("Retry " + (i + 1).toString + " of " + retryArg.toString);
}
}
} else {
@ -19,14 +22,17 @@ export let bash = (commandArg:string,retryArg = 2) => {
}
}
export let bashBare = (commandArg,retryArg = 3) => {
export let bashBare = (commandArg,retryArg = 2) => {
if (!process.env.NPMTS_TEST){
for(let i = 0; i <= retryArg; i++){
let exitCode = plugins.shelljs.exec(commandArg).code;
let exitCode:number = plugins.shelljs.exec(commandArg).code;
if(exitCode !== 0 && i == retryArg){
process.exit(1);
} else if(exitCode == 0){
i = retryArg + 1;
i = retryArg + 1; // if everything works out ok retrials are not wanted
} else {
plugins.beautylog.warn("Something went wrong! Exit Code: " + exitCode.toString);
plugins.beautylog.info("Retry " + (i + 1).toString + " of " + retryArg.toString);
}
}
} else {

View File

@ -162,12 +162,12 @@ export let dockerBaseImage = function(dockerfileContentArg:string){
export let dockerTag = function(repoArg:string,versionArg:string):string{
let tagString:string;
let registry = NpmciEnv.dockerRegistry;
if(process.env.CI_BUILD_STAGE == "build" || process.env.CI_BUILD_STAGE == "test"){
if(NpmciEnv.buildStage == "build" || NpmciEnv.buildStage == "test"){
registry = "registry.gitlab.com";
}
let repo = repoArg;
let version = versionArg;
if(process.env.CI_BUILD_STAGE == "build" || process.env.CI_BUILD_STAGE == "test"){
if(NpmciEnv.buildStage == "build" || NpmciEnv.buildStage == "test"){
version = version + "_test";
}
tagString = registry + "/" + repo + ":" + version;

View File

@ -3,9 +3,9 @@ import * as plugins from "./npmci.plugins";
import {GitRepo} from "smartstring";
import {Dockerfile} from "./npmci.build.docker"
export let repo = new GitRepo(process.env.CI_BUILD_REPO);
export let dockerTestTag:string;
export let dockerReleaseTag:string;
export let repo:GitRepo = new GitRepo(process.env.CI_BUILD_REPO);
export let buildStage:string = process.env.CI_BUILD_STAGE;
export let dockerRegistry; // will be set by npmci.prepare
export let dockerFilesBuilt:Dockerfile[] = [];