Skip to content
Merged
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
18 changes: 16 additions & 2 deletions justfile
Copy link
Copy Markdown
Member

@cratelyn cratelyn Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 }}'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cratelyn this is correct. I have modified the file to use _latest-edge-tag everywhere the tag is referenced.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
hey

what 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great feedback!

Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ docker *args='--output=type=docker': && _clean-cache
--build-arg PROFILE='{{ profile }}' \
--build-arg LINKERD2_PROXY_VENDOR='{{ LINKERD2_PROXY_VENDOR }}' \
--build-arg LINKERD2_PROXY_VERSION='{{ LINKERD2_PROXY_VERSION }}' \
--build-arg LINKERD2_IMAGE='ghcr.io/linkerd/proxy:{{ linkerd-tag }}' \
--no-cache-filter=runtime \
{{ if linkerd-tag == '' { '' } else { '--build-arg=RUNTIME_IMAGE=ghcr.io/linkerd/proxy:' + linkerd-tag } }} \
{{ if features != "" { "--build-arg PROXY_FEATURES=" + features } else { "" } }} \
{{ if DOCKER_BUILDX_CACHE_DIR == '' { '' } else { '--cache-from=type=local,src=' + DOCKER_BUILDX_CACHE_DIR + ' --cache-to=type=local,dest=' + DOCKER_BUILDX_CACHE_DIR } }} \
{{ args }}
Expand Down Expand Up @@ -241,7 +241,21 @@ action-dev-check:
## Linkerd
##

linkerd-tag := env_var_or_default('LINKERD_TAG', '')
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"
```
}

_controller-image := 'ghcr.io/linkerd/controller'
_policy-image := 'ghcr.io/linkerd/controller'
_init-image := 'ghcr.io/linkerd/proxy'
Expand Down