Skip to content

refactor(justfile): pull latest edge in development image#4379

Merged
zaharidichev merged 4 commits intomainfrom
zd/pull-latest-edge
Jan 23, 2026
Merged

refactor(justfile): pull latest edge in development image#4379
zaharidichev merged 4 commits intomainfrom
zd/pull-latest-edge

Conversation

@zaharidichev
Copy link
Member

This PR augments our justfile so that the latest version of the edge that is used during the build process is derived as follows:

  • by default the latest edge version is fetched from the GH API
  • the version can be overridden by setting the LINKERD_TAG env var
  • if fetching the latest edge fails (e.g. network issues, GH API down), LINKERD_TAG can be used to manually set the version to use

Fix: #2885

Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
@zaharidichev zaharidichev requested a review from a team as a code owner January 20, 2026 12:26
@zaharidichev zaharidichev requested a review from cratelyn January 20, 2026 12:26
Copy link
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
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
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
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
Member Author

Choose a reason for hiding this comment

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

Great feedback!

cratelyn
cratelyn previously approved these changes Jan 20, 2026
Copy link
Member

@cratelyn cratelyn left a comment

Choose a reason for hiding this comment

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

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>
@zaharidichev zaharidichev requested a review from cratelyn January 21, 2026 13:48
@cratelyn cratelyn dismissed their stale review January 22, 2026 02:36

i owe this another review!

Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
@zaharidichev zaharidichev merged commit be865ed into main Jan 23, 2026
16 checks passed
@zaharidichev zaharidichev deleted the zd/pull-latest-edge branch January 23, 2026 17:41
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