dotnet / docker-tools

This is a repo to house some common tools for our various docker repos.
MIT License
125 stars 47 forks source link

Allow multi-arch tags in MCR tags metadata templates #1464

Closed lbussell closed 1 month ago

lbussell commented 1 month ago

This change allows patterns like:

aspire-dashboard-tags.yml

$(McrTagsYmlRepo:aspire-dashboard)
$(McrTagsYmlTagGroup:8)

monitor-tags.yml

$(McrTagsYmlRepo:monitor)
$(McrTagsYmlTagGroup:9.0)
$(McrTagsYmlTagGroup:8.1-preview-ubuntu-chiseled|.NET Monitor Preview Tags)
$(McrTagsYmlTagGroup:8.1-preview-cbl-mariner-distroless|.NET Monitor Preview Tags)
$(McrTagsYmlTagGroup:8.0-ubuntu-chiseled)
$(McrTagsYmlTagGroup:8.0-cbl-mariner-distroless)
$(McrTagsYmlTagGroup:6.3-alpine)
$(McrTagsYmlTagGroup:6.3-ubuntu-chiseled)
$(McrTagsYmlTagGroup:6.3-cbl-mariner)
$(McrTagsYmlTagGroup:6.3-cbl-mariner-distroless)

runtime-tags.yml:

$(McrTagsYmlRepo:runtime)
$(McrTagsYmlTagGroup:9.0-bookworm-slim)
$(McrTagsYmlTagGroup:9.0-alpine3.20)
$(McrTagsYmlTagGroup:9.0-noble)
$(McrTagsYmlTagGroup:9.0-noble-chiseled)
$(McrTagsYmlTagGroup:9.0-noble-chiseled-extra)
$(McrTagsYmlTagGroup:9.0-azurelinux3.0)
$(McrTagsYmlTagGroup:9.0-azurelinux3.0-distroless)
$(McrTagsYmlTagGroup:9.0-azurelinux3.0-distroless-extra)
$(McrTagsYmlTagGroup:8.0-bookworm-slim)
<snip>

This works by checking if the tag in the variable is multi-arch or not, and if so, adds yaml tag groups for each architecture. This meant we needed a different solution for custom tag tables - I added the option to put that inline with the variable (which you can see above).

I made sure that using the multi-arch tags didn't change the readme output or sorting. In order to do that I had to add some sorting logic to the readme tags table generation - but it's just automating what we were already doing by hand.

dotnet-issue-labeler[bot] commented 1 month ago

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

dotnet-issue-labeler[bot] commented 1 month ago

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

lbussell commented 1 month ago

@mthalman Review new tests please. Thanks.