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(ci): Fix the automatic linking of Docker images #6821

Closed
wants to merge 1 commit into from

Conversation

opello
Copy link
Contributor

@opello opello commented Feb 2, 2023

Description

There were a few issues with the previous implementation. Some of the links were not generated correctly and Docker Official Images were not supported at all.

This should also automatically clean up non-links in the sources list which is causing linting issues.

After this runs there are still some issues where existing Chart.yaml files may include http instead of https URLs or other artifacts that should be cleaned up manually.

⚒️ Fixes

Numerous issues with Chart.yaml sources lists that contain dead links and non-URLs.

⚙️ Type of change

  • ⚙️ Feature/App addition
  • 🪛 Bugfix
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🔃 Refactor of current code

🧪 How Has This Been Tested?

Cut out the sync_tag function and ran it in its own script. Tested against individual charts as well as running against all charts as the CI job would.

📃 Notes:

There is a change of indent to be consistent with what seemed prevalent in the file. There is a move from an if-ladder to a case statement for nicer string matching. There is the use of parameter expansion to manipulate strings. Any of these might be worth careful review or an alternative, more accessible approach.

✔️ Checklist:

  • ⚖️ My code follows the style guidelines of this project
  • 👀 I have performed a self-review of my own code
  • #️⃣ I have commented my code, particularly in hard-to-understand areas
  • 📄 I have made corresponding changes to the documentation
  • ⚠️ My changes generate no new warnings
  • 🧪 I have added tests to this description that prove my fix is effective or that my feature works
  • ⬆️ I increased versions for any altered app according to semantic versioning

➕ App addition

If this PR is an app addition please make sure you have done the following.

  • 🪞 I have opened a PR on truecharts/containers adding the container to TrueCharts mirror repo.
  • 🖼️ I have added an icon in the Chart's root directory called icon.png

Please don't blindly check all the boxes. Read them and only check those that apply.
Those checkboxes are there for the reviewer to see what is this all about and
the status of this PR with a quick glance.

@truecharts-admin truecharts-admin added the size/S Categorises a PR that changes 10-29 lines, ignoring generated files. label Feb 2, 2023
There were a few issues with the previous implementation.  Some of the
links were not generated correctly and Docker Official Images were not
supported at all.

This should also automatically clean up non-links in the sources list
which is causing linting issues.

After this runs there are still some issues where existing Chart.yaml
files may include http instead of https URLs or other artifacts that
should be cleaned up manually.
@truecharts-admin truecharts-admin added precommit:ok CI status: pre-commit validation successful lint:ok CI status: linting successful install:ok CI status: install successful labels Feb 2, 2023
Comment on lines +98 to +108
*ghcr*|*quay*)
# Both ghcr.io and quay.io have nice redirection.
prefix="https://"
;;
*lscr*)
# Images hosted on lscr.io seem to all be available on Docker Hub under the linuxserver user.
prefix="https://hub.docker.com/r/linuxserver/"
# Get the image name without any pathing.
container="${container##*/}"
;;
*tccr*)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't really confident in this matching, it seemed very susceptible to collisions, like if I made an opello/ghcr image and pushed it to Docker Hub, I think a bad link would be generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ran through all of the substrings and didn't find a problem in the generated output. I still think it's worth thinking about a little though.

@truecharts-admin
Copy link
Collaborator

This PR is locked to prevent necro-posting on closed PRs. Please create a issue or contact staff on discord if you want to further discuss this

@truecharts truecharts locked as resolved and limited conversation to collaborators Feb 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
install:ok CI status: install successful lint:ok CI status: linting successful precommit:ok CI status: pre-commit validation successful size/S Categorises a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants