fix registry login scope

This commit is contained in:
Philipp Kunz 2016-06-05 23:59:10 +02:00
parent 73b4057dc9
commit 832031a02a

View File

@ -29,6 +29,7 @@ let docker = function(){
plugins.beautylog.error("You have to specify Login Data to the Docker Registry"); plugins.beautylog.error("You have to specify Login Data to the Docker Registry");
process.exit(1); process.exit(1);
} }
plugins.shelljs.exec("docker login -u gitlab-ci-token -p " + ciBuildToken + " " + "registry.gitlab.com"); // Always also login to GitLab Registry
let dockerRegexResultArray = dockerRegex.exec(process.env.NPMCI_LOGIN_DOCKER); let dockerRegexResultArray = dockerRegex.exec(process.env.NPMCI_LOGIN_DOCKER);
let username = dockerRegexResultArray[1]; let username = dockerRegexResultArray[1];
let password = dockerRegexResultArray[2]; let password = dockerRegexResultArray[2];
@ -41,7 +42,7 @@ let dockerGitlab = function(){
let done = plugins.q.defer(); let done = plugins.q.defer();
env.dockerRegistry = "registry.gitlab.com"; env.dockerRegistry = "registry.gitlab.com";
let ciBuildToken = process.env.CI_BUILD_TOKEN let ciBuildToken = process.env.CI_BUILD_TOKEN
plugins.shelljs.exec("docker login -u gitlab-ci-token -p " + ciBuildToken + " " + env.dockerRegistry); plugins.shelljs.exec("docker login -u gitlab-ci-token -p " + ciBuildToken + " " + "registry.gitlab.com");
done.resolve(); done.resolve();
return done.promise; return done.promise;
} }
@ -51,8 +52,7 @@ export let prepare = function(serviceArg:string){
case "npm": case "npm":
return npm(); return npm();
case "docker": case "docker":
return docker() return docker();
.then(dockerGitlab); // always also login to gitlab registry for tests
case "docker-gitlab": case "docker-gitlab":
return dockerGitlab() return dockerGitlab()
default: default: