Extend --tag=branch which tags image with branch and sha #465
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this commit the --tag is extended to include branch argument
which tags image not only with sha but branch-sha
Signed-off-by: Martin Dekov (VMware) mdekov@vmware.com
Extend the --tag with branch feature which tags image with branch and sha.
Description
Added checks to see the --tag argument if its branch it calls not only
GetGitSha, but also new function which checks the branch we are in.
If we are not in a repo it fails and if we are in a repo it gets the branch
and adds it to the image name name.
Motivation and Context
This references #463.
How Has This Been Tested?
Tested by building pushing and deploying image with my change.
Example pushed images are found in this docker hub repo:
https://hub.docker.com/r/martindekov/gofun/tags/
Adding
image:<example name>:<example replacement of latest>
to check if latest will be appended in case the replacement exists.
Tried do build when not in a git repo with
--tag=branch
it returned error2018/07/24 02:09:14 ERROR - Could not execute command: [docker build -t martindekov/gofun:0.2-fatal: not a git repository (or any of the parent directories): .git-fatal: not a git repository (or any of the parent directories): .git .]
Types of changes
Checklist:
git commit -s