From 114c99fa39ea52d32594ce3dd7099fc3a77bff9f Mon Sep 17 00:00:00 2001 From: pajgo <51755949+pajgo@users.noreply.github.com> Date: Thu, 19 Sep 2019 21:56:05 +0600 Subject: [PATCH] feat: disable push into :latest tag (#12) BREAKING CHANGE: no longer pushes latest tag without a special flag of `--tag_latest` --- bin/cmds/docker.js | 13 ++++++++++++- doc/rfc/docker_disable_latest_tag.md | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 doc/rfc/docker_disable_latest_tag.md diff --git a/bin/cmds/docker.js b/bin/cmds/docker.js index 935a44a..6a53576 100644 --- a/bin/cmds/docker.js +++ b/bin/cmds/docker.js @@ -16,6 +16,12 @@ exports.builder = (yargs) => ( boolean: true, default: true, }) + .option('tag_latest', { + alias: 'tl', + describe: 'adds :latest tag to the image', + boolean: true, + default: false, + }) .option('docker_file', { alias: 'f', describe: 'path to docker file', @@ -33,13 +39,18 @@ exports.handler = (argv) => { argv.base = `${argv.repository}/${argv.project}`; argv.baseTag = argv.include_node ? `${argv.node}-${argv.version}` : argv.version; argv.mainTag = `${argv.base}:${argv.baseTag}`; - argv.tags = [`${argv.base}:latest`]; + argv.tags = []; // adds extra tag if (argv.include_node) { argv.tags.push(`${argv.base}:${argv.node}`); } + // adds :latest tag + if (argv.tag_latest) { + argv.tags.push(`${argv.base}:latest`); + } + // a little bit hacky exports.called = true; }; diff --git a/doc/rfc/docker_disable_latest_tag.md b/doc/rfc/docker_disable_latest_tag.md new file mode 100644 index 0000000..5d7a4b4 --- /dev/null +++ b/doc/rfc/docker_disable_latest_tag.md @@ -0,0 +1,10 @@ +# Disable push using `:latest` tag + +## Overview and Motivation +`docker deploy/release/` command pushes images with `baseTag:latest` tag into Docker Hub. +This happens even if we built a beta or alpha version of the image. If the project has docker image dependency without version tag, +this beta image will be used. + +## `--tag_latest [false]` param +New `--tag_latest` param(defaults to false) instruct `deploy` command to add `${baseTag}:latest` tag to the image. +Otherwise `:latest` tag not assigned to the image.