Skip to content

Move Alpine floating tags from 3.20 to 3.21 - #6184

Merged
lbussell merged 4 commits into
dotnet:nightlyfrom
lbussell:alpine-floating-tag
Jan 29, 2025
Merged

lbussell merged 4 commits into
dotnet:nightlyfrom
lbussell:alpine-floating-tag

Conversation

@lbussell

Copy link
Copy Markdown
Member

Fixes #6178

I made this edit using regexes and documented it for future reference. Expand the details to see the patterns that were used.

Details

How to replace Alpine floating tags with regex

First, match all Alpine tags.

( )*("\$\((?:dotnet|sdk)\|\d+\.0\|minor-tag\))(-alpine)((?:3.\d+)?)((?:-aot)?(?:-extra)?(?:-composite)?(?:-(?:amd64|arm64v8|arm32v7))?")(: \{\})

We can modify this to select floating tags only. I chose to match two lines in order to get the previous line which will need to be modified since it has a comma.

Regex capture groups:
 1   2                                         3         4           5
(\s+)("\$\((?:dotnet|sdk)\|\d+\.0\|minor-tag\))(-alpine)((?:3.\d+)?)((?:-aot)?(?:-extra)?(?:-composite)?(?:-(?:amd64|arm64v8|arm32v7))?"): \{\}(?:,)?\n\1\2\3\5\{6}: \{\}

Remove all Alpine floating tags

(\s+)("\$\((?:dotnet|sdk)\|\d+\.0\|minor-tag\))(-alpine)((?:3.\d+)?)((?:-aot)?(?:-extra)?(?:-composite)?(?:-(?:amd64|arm64v8|arm32v7))?"): \{\}(?:,)?\n\1\2\3\5: \{\}

Replace with

$1$2$3$4$5: {}

Add new floating tags to precise Alpine version

In this example we want to add floating tags to Alpine 3.21. For each image, Find the last Alpine 3.21 tag without a floating tag (it won't have a comma at the end of the line).

                                      Change the number -----,
                                                             V
(\s+)("\$\((?:dotnet|sdk)\|\d+\.0\|minor-tag\))(-alpine)((?:3.21)?)((?:-aot)?(?:-extra)?(?:-composite)?(?:-(?:amd64|arm64v8|arm32v7))?"): \{\}

Replace with the following to add the floating tags back.

$1$2$3$4$5: {},\n$1$2$3$5: {}

@lbussell
lbussell requested a review from a team as a code owner January 29, 2025 20:59
@lbussell
lbussell requested a review from mthalman January 29, 2025 22:20
@lbussell
lbussell enabled auto-merge (squash) January 29, 2025 22:21
@lbussell
lbussell merged commit 4ebd538 into dotnet:nightly Jan 29, 2025
@richlander richlander mentioned this pull request Jan 30, 2025
1 task done
lbussell added a commit to lbussell/dotnet-docker that referenced this pull request Feb 7, 2025
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