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

Skip fully qualified names when replacing images names #566

Merged
merged 5 commits into from
May 21, 2018

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented May 18, 2018

No description provided.

@dgageot
Copy link
Contributor Author

dgageot commented May 18, 2018

@jonjohnsonjr That's a good idea.

if removed != "host:1234/user/container" {
t.Errorf("Tag vas not removed from an image name with port: %s ", removed)
func TestSplitTag(t *testing.T) {
var tests = []struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a test case for digest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be done now!

return re.ReplaceAllString(image, "")
func splitTag(image string) (string, string) {
re := regexp.MustCompile(`(.*):([^/]+)$`)
matches := re.FindStringSubmatch(image)
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be a little more robust to reuse the name parsing utilities here: https://github.com/google/go-containerregistry/blob/master/name/ref.go

@dgageot dgageot merged commit 73d0a65 into GoogleContainerTools:master May 21, 2018
@dgageot dgageot deleted the skip-tags branch May 29, 2018 04:49
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