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: don't truncate names too arbitrarily #138

Merged
merged 3 commits into from
Jan 22, 2025
Merged

fix: don't truncate names too arbitrarily #138

merged 3 commits into from
Jan 22, 2025

Conversation

sigma
Copy link
Collaborator

@sigma sigma commented Jan 17, 2025

The problem with selecting the last 63 characters of the image name
for a k8s label is that there's no guarantee that the result will
respect the other contraints.

In particular,
us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101411.4-rc.4
yields .pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101411.4-rc.4
which is invalid because it starts with a dot.
So the net outcome is that valid images fail to deploy because of an
invalid attached label.

This change select the longest prefix available while breaking only at /
So for the image above, the label would be
oplabs-tools-artifacts/images/op-geth:v1.101411.4-rc.4

@sigma
Copy link
Collaborator Author

sigma commented Jan 17, 2025

Note: I am not entirely sure what constraints #96 was navigating, so take the proposal with a grain of salt !

@sigma sigma marked this pull request as ready for review January 17, 2025 23:43
The problem with selecting the last 63 characters of the image name
for a k8s label is that there's no guarantee that the result will
respect the other contraints.

In particular,
us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101411.4-rc.4
yields .pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101411.4-rc.4
which is invalid because it starts with a dot.
So the net outcome is that valid images fail to deploy because of an
invalid attached label.

This change select the longest prefix available while breaking only at /
So for the image above, the label would be
oplabs-tools-artifacts/images/op-geth:v1.101411.4-rc.4
@zhwrd zhwrd enabled auto-merge (squash) January 22, 2025 00:12
@zhwrd zhwrd merged commit edb9ce2 into main Jan 22, 2025
5 checks passed
@zhwrd zhwrd deleted the sigma/fix-label branch January 22, 2025 00:17
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