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 flags generated from Bash array #344

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

DrJosh9000
Copy link
Contributor

@DrJosh9000 DrJosh9000 commented Dec 5, 2024

--tag foo:bar as a single arg is not a valid flag, but --tag=foo:bar is valid.

Small bit of manual testing this time:

bash-3.2$ parse_version() {
>   local v="$1"
>   IFS='.' read -r -a parts <<< "${v%-*}"
>
>   for idx in $(seq 1 ${#parts[*]}) ; do
>     sed -e 's/ /./g' <<< "${parts[@]:0:$idx}"
>   done
>
>   [[ "${v%-*}" == "${v}" ]] || echo "${v}"
> }
bash-3.2$ registry="public.ecr.aws/buildkite/agent-metrics"
bash-3.2$ version_tags=($(parse_version "5.9.11"))
bash-3.2$ docker build "${version_tags[@]/#/--tag=${registry}:v}" .
[+] Building 17.2s (13/13) FINISHED                                          docker:orbstack

...snip...

 => => writing image sha256:b5162648ecf2f901b463c852eab2acfc2dfb0acd0aad5e7b2e77bb28c0  0.0s
 => => naming to public.ecr.aws/buildkite/agent-metrics:v5                              0.0s
 => => naming to public.ecr.aws/buildkite/agent-metrics:v5.9                            0.0s
 => => naming to public.ecr.aws/buildkite/agent-metrics:v5.9.11                         0.0s

@DrJosh9000 DrJosh9000 enabled auto-merge December 5, 2024 00:35
@DrJosh9000 DrJosh9000 disabled auto-merge December 5, 2024 00:37
@DrJosh9000 DrJosh9000 enabled auto-merge December 5, 2024 00:38
@DrJosh9000 DrJosh9000 merged commit c1066cb into master Dec 5, 2024
1 check passed
@DrJosh9000 DrJosh9000 deleted the fix-docker-tag-flag-from-array branch December 5, 2024 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants