Skip to content

Skip fully qualified names when replacing images names#566

Merged
dgageot merged 5 commits intoGoogleContainerTools:masterfrom
dgageot:skip-tags
May 21, 2018
Merged

Skip fully qualified names when replacing images names#566
dgageot merged 5 commits intoGoogleContainerTools:masterfrom
dgageot:skip-tags

Conversation

@dgageot
Copy link
Copy Markdown
Contributor

@dgageot dgageot commented May 18, 2018

No description provided.

@dgageot
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 added 5 commits May 18, 2018 18:15
Fix GoogleContainerTools#565

Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
@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