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

Trim trailing .git from sourcelink repo urls in container generation #39161

Merged

Conversation

baronfel
Copy link
Member

@baronfel baronfel commented Mar 3, 2024

Fixes dotnet/sdk-container-builds#540 by trimming .git from sourcelink-derived repo urls

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Request triage from a team member labels Mar 3, 2024
@baronfel baronfel added the Area-Containers Related to dotnet SDK containers functionality label Mar 3, 2024
@KalleOlaviNiemitalo
Copy link
Contributor

Trimming the trailing .git looks OK for GitHub but I suspect it can cause git clone to fail with other Git hosting software.

@baronfel
Copy link
Member Author

baronfel commented Mar 3, 2024

We're not really worried about git clone here though?

@KalleOlaviNiemitalo
Copy link
Contributor

KalleOlaviNiemitalo commented Mar 3, 2024

At https://github.com/opencontainers/image-spec/blob/main/annotations.md, it's specified as

org.opencontainers.image.source URL to get source code for building the image (string)

If the value cannot be used for obtaining the source because .git is missing, then I think it violates this spec.

I'm thinking about on-premises Bitbucket in particular, which uses different URL paths for web browser HTML access and for Git access. But I don't remember whether it has .git in the latter.

@KalleOlaviNiemitalo
Copy link
Contributor

Re on-premises Bitbucket, the HTTPS URL formats are like this (including the difference in letter case):

  • https://server.example/projects/DOTNET/repos/sdk/browse for web browsers
  • https://server.example/scm/dotnet/sdk.git for Git

Actually, it works even if you remove .git. The server does not reply with an HTTP redirection to add .git; it just aliases the path. So the trimming seems to be OK for on-premises Bitbucket too. How about others?

@baronfel
Copy link
Member Author

baronfel commented Mar 5, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@ladipro ladipro left a comment

Choose a reason for hiding this comment

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

Since there seems to be some controversy about always considering the .git prefix trimmable, do you think it would be worth adding an opt-out property?

@baronfel
Copy link
Member Author

baronfel commented Mar 6, 2024

Since there seems to be some controversy about always considering the .git prefix trimmable, do you think it would be worth adding an opt-out property?

Not really, no - this seems pretty self-evident for git repo server configuration, and users have a pretty clear workaround if that's the case. We can always revisit if it becomes a problem for folks.

@baronfel baronfel merged commit 6c1ba2f into dotnet:release/8.0.3xx Mar 6, 2024
16 checks passed
@baronfel baronfel deleted the trim-sourceroot-git-suffix branch March 6, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Containers Related to dotnet SDK containers functionality Area-Infrastructure untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants