fix tagging logic

This commit is contained in:
Philipp Kunz 2016-06-07 22:27:10 +02:00
parent e92d421bae
commit c0d0e5154a
3 changed files with 27 additions and 12 deletions

View File

@ -3,7 +3,7 @@ export declare let readDockerfiles: () => any;
export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => any; export declare let sortDockerfiles: (sortableArrayArg: Dockerfile[]) => any;
export declare let mapDockerfiles: (sortedArray: Dockerfile[]) => any; export declare let mapDockerfiles: (sortedArray: Dockerfile[]) => any;
export declare let buildDockerfiles: (sortedArrayArg: Dockerfile[]) => any; export declare let buildDockerfiles: (sortedArrayArg: Dockerfile[]) => any;
export declare let pushDockerfiles: (sortedArrayArg: Dockerfile[], regsitryArg?: string) => any; export declare let pushDockerfiles: (sortedArrayArg: Dockerfile[]) => any;
export declare let pullDockerfileImages: (sortableArrayArg: Dockerfile[], registryArg?: string) => any; export declare let pullDockerfileImages: (sortableArrayArg: Dockerfile[], registryArg?: string) => any;
export declare let testDockerfiles: (sortedArrayArg: Dockerfile[]) => any; export declare let testDockerfiles: (sortedArrayArg: Dockerfile[]) => any;
export declare let releaseDockerfiles: (sortedArrayArg: Dockerfile[], registryArg?: any) => any; export declare let releaseDockerfiles: (sortedArrayArg: Dockerfile[], registryArg?: any) => any;
@ -26,7 +26,7 @@ export declare class Dockerfile {
read?: boolean; read?: boolean;
}); });
build(): any; build(): any;
push(registryArg: string): any; push(stageArg: any): any;
pull(registryArg: string): void; pull(registryArg: string): void;
test(): void; test(): void;
getId(): string; getId(): string;

File diff suppressed because one or more lines are too long

View File

@ -83,10 +83,10 @@ export let buildDockerfiles = (sortedArrayArg:Dockerfile[]) => {
return done.promise; return done.promise;
} }
export let pushDockerfiles = function(sortedArrayArg:Dockerfile[],regsitryArg = "registry.gitlab.com"){ export let pushDockerfiles = function(sortedArrayArg:Dockerfile[]){
let done = plugins.q.defer(); let done = plugins.q.defer();
sortedArrayArg.forEach(function(dockerfileArg){ sortedArrayArg.forEach(function(dockerfileArg){
dockerfileArg.push(regsitryArg); dockerfileArg.push(NpmciEnv.buildStage);
}); });
done.resolve(sortedArrayArg); done.resolve(sortedArrayArg);
return done.promise; return done.promise;
@ -155,10 +155,18 @@ export class Dockerfile {
done.resolve(); done.resolve();
return done.promise; return done.promise;
}; };
push(registryArg:string){ push(stageArg){
let done = plugins.q.defer(); let done = plugins.q.defer();
let pushTag; let pushTag;
NpmciEnv.buildStage == "test" ? pushTag = this.testTag : pushTag = this.releaseTag; switch (stageArg){
case "release":
pushTag = this.releaseTag;
break;
case "test":
default:
pushTag = this.testTag;
break;
}
bashBare("docker tag " + this.buildTag + " " + pushTag); bashBare("docker tag " + this.buildTag + " " + pushTag);
bashBare("docker push " + pushTag); bashBare("docker push " + pushTag);
done.resolve(); done.resolve();