update to notice missing gitlab registry token

This commit is contained in:
Philipp Kunz 2017-08-26 10:57:23 +02:00
parent 15714204a6
commit f98f490956
5 changed files with 30 additions and 24 deletions

View File

@ -91,7 +91,7 @@ export declare let dockerBaseImage: (dockerfileContentArg: string) => string;
/** /**
* returns the docker tag * returns the docker tag
*/ */
export declare let dockerTag: (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string) => string; export declare let getDockerTagString: (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string) => string;
/** /**
* *
*/ */

File diff suppressed because one or more lines are too long

View File

@ -62,7 +62,10 @@ let docker = () => __awaiter(this, void 0, void 0, function* () {
* prepare docker for gitlab registry * prepare docker for gitlab registry
*/ */
let dockerGitlab = () => __awaiter(this, void 0, void 0, function* () { let dockerGitlab = () => __awaiter(this, void 0, void 0, function* () {
// env.setDockerRegistry('registry.gitlab.com') if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') {
plugins.beautylog.error('No registry token specified by gitlab!');
process.exit(1);
}
yield npmci_bash_1.bash(`docker login -u gitlab-ci-token -p ${process.env.CI_BUILD_TOKEN} registry.gitlab.com`); yield npmci_bash_1.bash(`docker login -u gitlab-ci-token -p ${process.env.CI_BUILD_TOKEN} registry.gitlab.com`);
plugins.beautylog.success(`docker authenticated for registry.gitlab.com!`); plugins.beautylog.success(`docker authenticated for registry.gitlab.com!`);
return; return;
@ -92,4 +95,4 @@ exports.prepare = (serviceArg) => __awaiter(this, void 0, void 0, function* () {
break; break;
} }
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfcHJlcGFyZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEseUNBQXdDO0FBQ3hDLDhDQUFvQztBQUNwQyxvQ0FBbUM7QUFDbkMsMkNBQTBDO0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BSyxLQUFLO1lBQ1IsTUFBTSxDQUFDLE1BQU0sR0FBRyxFQUFFLENBQUE7UUFDcEI7WUFDRSxLQUFLLENBQUE7SUFDVCxDQUFDO0FBQ0gsQ0FBQyxDQUFBLENBQUEifQ==

View File

@ -167,9 +167,12 @@ export class Dockerfile {
this.version = dockerFileVersion(plugins.path.parse(options.filePath).base) this.version = dockerFileVersion(plugins.path.parse(options.filePath).base)
this.cleanTag = this.repo + ':' + this.version this.cleanTag = this.repo + ':' + this.version
this.buildTag = this.cleanTag this.buildTag = this.cleanTag
this.gitlabTestTag = dockerTag('registry.gitlab.com', this.repo, this.version, 'test') this.gitlabTestTag = getDockerTagString('registry.gitlab.com', this.repo, this.version, 'test')
this.gitlabReleaseTag = dockerTag('registry.gitlab.com', this.repo, this.version) this.gitlabReleaseTag = getDockerTagString('registry.gitlab.com', this.repo, this.version)
this.releaseTag = dockerTag('docker.io', this.repo, this.version)
// the releaseTag determines where the image gets released
this.releaseTag = getDockerTagString('docker.io', this.repo, this.version)
this.containerName = 'dockerfile-' + this.version this.containerName = 'dockerfile-' + this.version
if (options.filePath && options.read) { if (options.filePath && options.read) {
this.content = plugins.smartfile.fs.toStringSync(plugins.path.resolve(options.filePath)) this.content = plugins.smartfile.fs.toStringSync(plugins.path.resolve(options.filePath))
@ -272,15 +275,13 @@ export let dockerBaseImage = function (dockerfileContentArg: string) {
/** /**
* returns the docker tag * returns the docker tag
*/ */
export let dockerTag = function (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string): string { export let getDockerTagString = function (registryArg: string, repoArg: string, versionArg: string, suffixArg?: string): string {
let tagString: string // determine wether the suffix is needed
let registry = registryArg
let repo = repoArg
let version = versionArg let version = versionArg
if (suffixArg) { if (suffixArg) {
version = versionArg + '_' + suffixArg version = versionArg + '_' + suffixArg
} }
tagString = registry + '/' + repo + ':' + version let tagString = `${registryArg}/${repoArg}:${version}`
return tagString return tagString
} }

View File

@ -62,7 +62,10 @@ let docker = async () => {
* prepare docker for gitlab registry * prepare docker for gitlab registry
*/ */
let dockerGitlab = async () => { let dockerGitlab = async () => {
// env.setDockerRegistry('registry.gitlab.com') if (!process.env.CI_BUILD_TOKEN || process.env.CI_BUILD_TOKEN === '') {
plugins.beautylog.error('No registry token specified by gitlab!')
process.exit(1)
}
await bash(`docker login -u gitlab-ci-token -p ${process.env.CI_BUILD_TOKEN} registry.gitlab.com`) await bash(`docker login -u gitlab-ci-token -p ${process.env.CI_BUILD_TOKEN} registry.gitlab.com`)
plugins.beautylog.success(`docker authenticated for registry.gitlab.com!`) plugins.beautylog.success(`docker authenticated for registry.gitlab.com!`)
return return