Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tag concatenating issue #512

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions build_latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,13 @@ function build_image() {
repo=$1; shift;
build=$1; shift;
btype=$1; shift;
local local_tag=$1; shift;

local local_tags=("$@") # copy arguments to local array
for i in "${!local_tags[@]}"
do
echo "Tag - ${i} : ${local_tags[$i]}" # Adding an echo to check if jenkins build job is passing multiple tags
tags="${tags} -t ${repo}:${local_tags[$i]}"
done
tags=" -t ${repo}:${local_tag}"

auto_space_line=" "
image_name="${repo}:${tag}"
printf -v expanded_tags "%s ${repo}:%s " "-t" "${local_tags[@]}" # concatenate to single string : -t repo:tag -t repo:tag2
image_name="${repo}:${local_tag}"
printf -v expanded_tags "%s ${repo}:%s " "-t" "${local_tag}" # concatenate to single string : -t repo:tag -t repo:tag2
expanded_tags=${expanded_tags%?} # remove trailing space
dockerfile="Dockerfile.${vm}.${build}.${btype}"
# Check if we need to build this image.
Expand All @@ -235,7 +231,7 @@ function build_image() {
return;
fi

echo "docker push ${repo}:${tag}" >> "${push_cmdfile}"
echo "docker push ${repo}:${local_tag}" >> "${push_cmdfile}"
echo "#####################################################"
echo "INFO: docker build --no-cache ${expanded_tags} -f ${dockerfile} ."
echo "#####################################################"
Expand Down