TrueChartsClone/.github/workflows
Dan Christensen 0d4e9d03b9
fix: Build links to Docker images for Chart.yaml (#6963)
* style: Split long lines, follow .editorconfig

Signed-off-by: Dan Christensen <opello@opello.org>

* fix: Clarify why some sources are being excluded

The explanation is also meant to remind anyone that sees it that the
code could inadvertently remove a sources sequence entry that was
intentionally added, because it can not tell.

Signed-off-by: Dan Christensen <opello@opello.org>

* fix: Comment the image-to-URL code

Signed-off-by: Dan Christensen <opello@opello.org>

* refactor: Use case instead of if-ladder

This is a faithful move from the if-ladder to a case statement that
preserves the existing behavior, with optimization to follow.  The
behavior of the function before and after this change is the same.

Signed-off-by: Dan Christensen <opello@opello.org>

* fix: Remove dead code

No "container source" entry from description_list.md has a scheme.  The
values are parsed from the Dockerfiles and would not have one there
either.

Signed-off-by: Dan Christensen <opello@opello.org>

* fix: tccr.io image links

Parse the tccr.io prefix specifically instead of just checking for the
substring tccr which could result in a false positive.

The generated link was also going to point to a truecharts subdirectory
under mirror in the containers repository that does not exist.

Signed-off-by: Dan Christensen <opello@opello.org>

* fix: lscr.io image links

Parse the lscr.io prefix specifically instead of just checking for the
substring lscr which could result in a false positive.

The generated link would also return a 404 because the web interface
requires the image name to be passed in the query string.

Signed-off-by: Dan Christensen <opello@opello.org>

* fix: gcr.io image links

Parse the gcr.io prefix specifically instead of just checking for the
substring gcr which could result in a false positive.

Signed-off-by: Dan Christensen <opello@opello.org>

* feat: Do not add sources if no prefix is created

The intent of this code is to generate URLs to be included in
documentation to attribute inputs to the chart.  If a publicly
accessible URL can not be generated from the image name it makes sense
to not add anything and instead rely on a manual edit to the Chart.yaml.

Signed-off-by: Dan Christensen <opello@opello.org>

* fix: Disable azurecr.io image links

There does not seem to be a general purpose web index to the azurecr.io
hosted images.

Signed-off-by: Dan Christensen <opello@opello.org>

* feat: Disable mcr.microsoft.com image links

Signed-off-by: Dan Christensen <opello@opello.org>

* fix: public.ecr.aws image links

Parse the public.ecr.aws prefix specifically instead of just checking
for the substring public.ecr.aws which could result in a false positive.

Signed-off-by: Dan Christensen <opello@opello.org>

* fix: Disable ocir.io image links

There does not seem to be a general purpose web index to the ocir.io
hosted images.

Signed-off-by: Dan Christensen <opello@opello.org>

* refactor: Add Docker Hub hosted image links

From the perspective of linking to image details on the Docker Hub web
interface, there are two types of images:

  1. Docker Official Images
  2. all of the other images, regardless of their trustworthiness

The Docker Official Images can be referenced several ways, either on the
command line when passed to docker pull, or in the FROM instruction of a
Dockerfile:

  * busybox
  * library/busybox
  * docker.io/busybox
  * docker.io/library/busybox

Furthermore, over the years there have been several domains used for the
official Docker Hub registry:

  * docker.io
  * index.docker.io
  * registry-1.docker.io
  * registry.hub.docker.com

The goal here is handling each possible case, which makes Docker Hub
images more complex than the handling for other registries.

It also makes the case block's '*' (default) case harder to find in the
sequence of glob expressions, but this is necessary to avoid repeating
the parsing or adding another helper function.

Reference:
https://github.com/docker/hub-feedback/issues/2113
https://github.com/docker/cli/issues/3793

Signed-off-by: Dan Christensen <opello@opello.org>

* feat: ghcr.io image links

Signed-off-by: Dan Christensen <opello@opello.org>

* feat: quay.io image links

Signed-off-by: Dan Christensen <opello@opello.org>

* feat: Do not generate likely-bad links

By assuming image names that are not handled by other cases are Docker
Hub images there is a risk of generating bad links.  Minimize this risk
by not generating a link if the image name for a Docker Hub link has two
slashes.  This is a case that should not happen and would likely mean an
unsupported registry is being used.

There is still a risk of an unsupported registry being treated as Docker
Hub and an invalid link being generated.  That case is if the domain and
image name is example.com/busybox where there is only one slash.

Signed-off-by: Dan Christensen <opello@opello.org>

* refactor: Sort cases

Sort the cases from longest to shortest prioritizing any case with a
suffix only glob over any case with a prefix glob.  The intention is to
avoid having a case that can not be reached.

The combined Docker Hub and default case is last.  It might make sense
to split the default case handling off but it does not seem to be a
problem right now.

Signed-off-by: Dan Christensen <opello@opello.org>

---------

Signed-off-by: Dan Christensen <opello@opello.org>
2023-02-09 13:08:53 +01:00
..
catalog-test.yaml chore(deps): update container image ghcr.io/truecharts/devcontainer to v3.1.1 (#5568) 2023-01-15 19:38:51 +02:00
charts-changelog.yaml chore(deps): update actions/checkout digest to ac59398 (#6006) 2023-01-07 17:29:51 +02:00
charts-lint.yaml feat(cert-manager): add Cert-Manager configuration App (#6378) 2023-01-18 00:06:10 +01:00
charts-release.yaml feat(cert-manager): add Cert-Manager configuration App (#6378) 2023-01-18 00:06:10 +01:00
charts-test.yaml feat(cert-manager): add Cert-Manager configuration App (#6378) 2023-01-18 00:06:10 +01:00
daily.yaml fix: Build links to Docker images for Chart.yaml (#6963) 2023-02-09 13:08:53 +01:00
meta-label-pr-ci-status.yaml chore(deps): update dawidd6/action-download-artifact action to v2.24.3 (#6120) 2023-01-07 19:32:53 +02:00
metadata-label-commenter.yaml chore(deps): update actions/checkout digest to ac59398 (#6006) 2023-01-07 17:29:51 +02:00
metadata-label-pr.yaml
pr-metadata.yaml chore(deps): update actions/upload-artifact digest to 0b7f8ab (#6007) 2023-01-07 17:29:56 +02:00
pr-validate.yaml Update pr-validate.yaml 2023-02-06 18:42:27 +01:00
prune.yaml chore(deps): update actions/checkout digest to ac59398 (#6006) 2023-01-07 17:29:51 +02:00
renovate-bump.yaml chore(deps): update container image ghcr.io/truecharts/devcontainer to v3.1.1 (#5568) 2023-01-15 19:38:51 +02:00
renovate.yml chore(deps): update renovatebot/github-action action to v34.125.1 (#7014) 2023-02-08 09:26:41 +02:00
schedule-sync-labels.yaml chore(deps): update actions/checkout digest to ac59398 (#6006) 2023-01-07 17:29:51 +02:00
stale.yaml