clean up retagging

This commit is contained in:
Philipp Kunz 2017-08-26 10:06:20 +02:00
parent b3c5db3ed9
commit 35c4963192
2 changed files with 15 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@ -169,7 +169,7 @@ export class Dockerfile {
this.buildTag = this.cleanTag this.buildTag = this.cleanTag
this.gitlabTestTag = dockerTag('registry.gitlab.com', this.repo, this.version, 'test') this.gitlabTestTag = dockerTag('registry.gitlab.com', this.repo, this.version, 'test')
this.gitlabReleaseTag = dockerTag('registry.gitlab.com', this.repo, this.version) this.gitlabReleaseTag = dockerTag('registry.gitlab.com', this.repo, this.version)
this.releaseTag = dockerTag(NpmciEnv.dockerRegistry, this.repo, this.version) this.releaseTag = dockerTag('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))
@ -193,16 +193,16 @@ export class Dockerfile {
* pushes the Dockerfile to a registry * pushes the Dockerfile to a registry
*/ */
async push (stageArg) { async push (stageArg) {
await bash(`docker tag ${this.buildTag} ${this.releaseTag}`)
await bash(`docker tag ${this.buildTag} ${this.gitlabReleaseTag}`)
await bash(`docker tag ${this.buildTag} ${this.gitlabTestTag}`)
switch (stageArg) { switch (stageArg) {
case 'release': case 'release':
await bash(`docker tag ${this.buildTag} ${this.releaseTag}`)
await bash(`docker push ${this.releaseTag}`)
await bash(`docker tag ${this.buildTag} ${this.gitlabReleaseTag}`)
await bash(`docker push ${this.gitlabReleaseTag}`) await bash(`docker push ${this.gitlabReleaseTag}`)
await bash(`docker push ${this.releaseTag}`)
break break
case 'test': case 'test':
default: default:
await bash(`docker tag ${this.buildTag} ${this.gitlabTestTag}`)
await bash(`docker push ${this.gitlabTestTag}`) await bash(`docker push ${this.gitlabTestTag}`)
break break
} }
@ -212,9 +212,8 @@ export class Dockerfile {
* pulls the Dockerfile from a registry * pulls the Dockerfile from a registry
*/ */
async pull (registryArg: string) { async pull (registryArg: string) {
let pullTag = this.gitlabTestTag await bash(`docker pull ${this.gitlabTestTag}`)
await bash('docker pull ' + pullTag) await bash(`docker tag ${this.gitlabTestTag} ${this.buildTag}`)
await bash('docker tag ' + pullTag + ' ' + this.buildTag)
} }
/** /**