refactor(justfile): pull latest edge in development image#4379
refactor(justfile): pull latest edge in development image#4379zaharidichev merged 4 commits intomainfrom
Conversation
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
There was a problem hiding this comment.
do we need to additionally update the other justfile commands that reference the tag as well? github will not let me hang this comment further down in the file, but i'm thinking of commands like this:
k3d-load-linkerd: _tag-set _k3d-ready
for i in \
'{{ _controller-image }}:{{ linkerd-tag }}' \
'{{ _policy-image }}:{{ linkerd-tag }}' \
'{{ _init-image }}:{{ linkerd-tag }}' \
; do \
docker pull -q "$i" ; \
done
@just-k3d import \
'{{ docker-image }}' \
'{{ _controller-image }}:{{ linkerd-tag }}' \
'{{ _policy-image }}:{{ linkerd-tag }}' \
'{{ _init-image }}:{{ linkerd-tag }}'
There was a problem hiding this comment.
@cratelyn this is correct. I have modified the file to use _latest-edge-tag everywhere the tag is referenced.
There was a problem hiding this comment.
understood, thank you. i felt some hesitance upon seeing (a) how invasive this ends up being to the rest of the file, and (b) that the _latest-edge-tag is not accurately named in the event of an environment variable being set, i spent some time trying a slightly different approach.
instead of introducing a new variable that replaces linkerd-tag everywhere, i tried this:
_linkerd-tag := if env_var_or_default('LINKERD_TAG', '') != '' {
env('LINKERD_TAG')
} else {
```
tag=$(curl -sL https://api.github.com/repos/linkerd/linkerd2/releases 2>/dev/null \
| jq -r '[.[] | select(.tag_name | startswith("edge-")) | .tag_name] | first')
if [ -z "$tag" ] || [ "$tag" = "null" ]; then
echo "ERROR: Failed to fetch latest edge tag from GitHub API." >&2
echo " Set LINKERD_TAG environment variable to specify a tag manually." >&2
exit 1
fi
echo "$tag"
```
}
example:
echo {{ _linkerd-tag }}i found that this does the same thing, with just one variable, while still preserving the pleasant defaults that you've introduced here:
; just example
echo edge-26.1.2
edge-26.1.2
; LINKERD_TAG='hey' just example
echo hey
heywhat do you think of this? this might (a) avoid the need to alter the rest of the justfile as heavily, and (b) avoid the name of the tag variable from becoming deceptive.
There was a problem hiding this comment.
if this looks good (it's really the same as the code you've offered, but squished into a single variable declaration), we can avoid renaming the variable from linkerd-tag to _linkerd-tag, and also avoid the need to remove the _tag-set variable as well.
cratelyn
left a comment
There was a problem hiding this comment.
this looks good to me, i just have one question confirming that there isn't more work to do related to linkerd-tag
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
This PR augments our
justfileso that the latest version of the edge that is used during the build process is derived as follows:LINKERD_TAGenv varLINKERD_TAGcan be used to manually set the version to useFix: #2885