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

tiltfile: add default_registry(single_name) to push all images to the same image name #3699

Merged
merged 1 commit into from Aug 13, 2020

Conversation

nicks
Copy link
Member

@nicks nicks commented Aug 12, 2020

Hello @maiamcc,

Please review the following commits I made in branch nicks/ch8726:

c8e1b3e (2020-08-12 19:50:01 -0400)
tiltfile: add default_registry(single_name) to push all images to the same image name
Fixes #2419

0422a04 (2020-08-12 19:35:49 -0400)
tiltfile: add a stringable type to make it easier to unpack strings

Code review reminders, by giving a LGTM you attest that:

  • Commits are adequately tested
  • Code is easy to understand and conforms to style guides
  • Incomplete code is marked with TODOs
  • Code is suitably instrumented with logging and metrics

@nicks nicks requested a review from maiamcc August 12, 2020 23:50
@nicks
Copy link
Member Author

nicks commented Aug 12, 2020

All the RefSet infrastructure made this a lot easier!!!

Copy link
Contributor

@maiamcc maiamcc left a comment

Choose a reason for hiding this comment

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

lgtm (except for the part where i have no idea how pushing all images to the same image name works 🤔 )

if defaultReg == "" {
return rs.AsNamedOnly(), nil
}

// validate the ref produced
newNs := fmt.Sprintf("%s/%s", defaultReg, escapeName(rs.RefFamiliarName()))
newNs := ""
Copy link
Contributor

Choose a reason for hiding this comment

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

this wasn't your variable name but while you're here--this looks like newNamespace and took me a sec to process, maybe rename?

Copy link
Member Author

Choose a reason for hiding this comment

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

i also wondered about this! fixed

@@ -108,7 +109,12 @@ func (rs RefSet) ClusterRef() reference.Named {
}

// TagRefs tags both of the references used for build/deploy with the given tag.
Copy link
Contributor

Choose a reason for hiding this comment

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

new func name in docstring

Copy link
Member Author

Choose a reason for hiding this comment

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

done

func (rs RefSet) TagRefs(tag string) (TaggedRefs, error) {
func (rs RefSet) AddTagSuffix(suffix string) (TaggedRefs, error) {
tag := suffix
if rs.registry.SingleName != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

comment about the ECS special case?

Copy link
Member Author

Choose a reason for hiding this comment

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

added it to the function comment

// https://aws_account_id.dkr.ecr.region.amazonaws.com/my-repo
// (They call this a repo).
//
// For this reason, some users using ECR prefer to push all images to a single image name.
Copy link
Contributor

Choose a reason for hiding this comment

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

I... what?? how does this even work?!

Copy link
Member Author

Choose a reason for hiding this comment

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

I tested it a bit locally with tilt.build sending all the images to

default_registry('localhost:3000', single_name='dev-repo')

you end up creating images like

localhost:3000/dev-repo:tilt-site-tilt-deadbeef

let me add a link to docs on this.

i think this is definitely in the "minimum viable solution" space (it's a bit simpler than the original "image transform function" solution suggested). I am curious how people will end up using it!

@nicks nicks merged commit 5d44f0d into master Aug 13, 2020
@nicks nicks deleted the nicks/ch8726 branch August 13, 2020 21:59
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.

default_registry path building too opinionated for ECR
2 participants