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

Support pulling mod by manifest hash #998

Merged
merged 7 commits into from
Jan 3, 2025
Merged

Conversation

thespad
Copy link
Member

@thespad thespad commented Dec 30, 2024

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

Closes #922

Further work needed to support a wider range of formats for the mods as currently it only works with the mods:tag@sha256:hash format and not mods@sha256:hash format.

Benefits of this PR and context:

Given the following inputs for DOCKER_MODS:

linuxserver/mods:universal-tshoot@sha256:d31f2d4a88a0c5d98f6bf7f4725e228959b6d22dcd14d44c7a755521f007cd98
linuxserver/mods@sha256:d31f2d4a88a0c5d98f6bf7f4725e228959b6d22dcd14d44c7a755521f007cd98
linuxserver/mods:universal-tshoot

The data is parsed as:

$ENDPOINT         $USERNAME     $REPO   $FULLTAG                                                                                  $TAG              $TAGSHA
linuxserver/mods  linuxserver   mods    universal-tshoot@sha256:d31f2d4a88a0c5d98f6bf7f4725e228959b6d22dcd14d44c7a755521f007cd98  universal-tshoot  sha256:d31f2d4a88a0c5d98f6bf7f4725e228959b6d22dcd14d44c7a755521f007cd98
linuxserver/mods  linuxserver   mods                                                                                                                sha256:d31f2d4a88a0c5d98f6bf7f4725e228959b6d22dcd14d44c7a755521f007cd98
linuxserver/mods  linuxserver   mods                                                                                              universal-tshoot

And then correctly fetched from the remote registry and saved as:

linuxserver.mods.universal-tshoot.d31f2d4a88a0c5d98f6bf7f4725e228959b6d22dcd14d44c7a755521f007cd98.tar.xz
linuxserver.mods.d31f2d4a88a0c5d98f6bf7f4725e228959b6d22dcd14d44c7a755521f007cd98.tar.xz
linuxserver.mods.universal-tshoot.tar.xz

How Has This Been Tested?

Source / References:

Note that technically when supplying a SHA hash the tag is not used by the docker CLI, thus all of the following will result in the same image being fetched:

linuxserver/mods:universal-tshoot@sha256:d31f2d4a88a0c5d98f6bf7f4725e228959b6d22dcd14d44c7a755521f007cd98
linuxserver/mods@sha256:d31f2d4a88a0c5d98f6bf7f4725e228959b6d22dcd14d44c7a755521f007cd98
linuxserver/mods:foo@sha256:d31f2d4a88a0c5d98f6bf7f4725e228959b6d22dcd14d44c7a755521f007cd98

But from a mod perspective they're treated as 3 different mods because of how we store the data about them (Layer SHA, not manifest SHA).

@thespad thespad self-assigned this Dec 30, 2024
@thespad thespad marked this pull request as ready for review December 31, 2024 09:04
@thespad thespad requested a review from a team December 31, 2024 09:04
Copy link
Member

@quietsy quietsy left a comment

Choose a reason for hiding this comment

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

Haven't tested but looks good

@thespad thespad merged commit 4816424 into mod-scripts Jan 3, 2025
@thespad thespad deleted the mod-scripts-sha branch January 3, 2025 15:22
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