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

RFC: lifecycle/all #46

Merged
merged 7 commits into from
Feb 6, 2020
Merged

RFC: lifecycle/all #46

merged 7 commits into from
Feb 6, 2020

Conversation

ekcasey
Copy link
Member

@ekcasey ekcasey commented Jan 22, 2020

@ekcasey ekcasey changed the title RFC: /lifecycle/all RFC: lifecycle/all Jan 22, 2020
text/0000-lifecycle-all.md Outdated Show resolved Hide resolved
text/0000-lifecycle-all.md Outdated Show resolved Hide resolved
text/0000-lifecycle-all.md Outdated Show resolved Hide resolved
text/0000-lifecycle-all.md Outdated Show resolved Hide resolved
text/0000-lifecycle-all.md Outdated Show resolved Hide resolved
@jabrown85
Copy link
Contributor

If bin/develop gets built and get it's own binary at /cnb/lifecycle/develop should we consider /cnb/lifecycle/build or another name?


Each of these phases will continue to be available individually as provided by the current lifecycle.

### Platform API 0.3
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this callout and I don't have a problem being "more" breaking than would be strictly necessary.

text/0000-lifecycle-all.md Outdated Show resolved Hide resolved
text/0000-lifecycle-all.md Outdated Show resolved Hide resolved
text/0000-lifecycle-all.md Outdated Show resolved Hide resolved
This new binary supports two main goals.

### Goal 1: faster `pack` builds
By creating a single container and invoking `/cnb/lifecycle/all` instead of creating a container per lifecycle phase, pack can shave approximate `6s` from the execution time of `pack build`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know what the primary cause of the 6s increase in multi container builds? Is it purely the docker startup overhead?

Copy link
Member

@thisisnotashwin thisisnotashwin Jan 23, 2020

Choose a reason for hiding this comment

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

It appeared to be from the overhead of both starting up as well as tearing down the container. We didn't do a complete teardown of where in the container lifecycle we were losing time. Comparing the execution time of the binaries within the container vs the execution time of the entire container had a constant ∆ of roughly 1.5s. So running 1 container instead of 5 showed about a 6-7s improvement in the end to end pack build times.


### Usage

`/cnb/lifecycle/all <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.

Currently, pack prepends lifecycle output with the step of the container builds. Such as: ===> DETECTING.

Are we expecting the /lifecycle/all binary prepend the output or will pack still detect the current step in the build?

Copy link
Member

@thisisnotashwin thisisnotashwin Jan 23, 2020

Choose a reason for hiding this comment

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

In this case, pack would have to be more clever when invoking /lifecycle/all to know which phase is running and this effort might be non trivial. I suspect the all binary might have to be better about logging which phase is currently being run.

Copy link
Member Author

Choose a reason for hiding this comment

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

As a stop gap we could add the phase to the lifecycle logs. I think the better longterm solution is the structured logging RFC I have long been threatening to submit. This should be a good forcing function.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to structured logging

| `-gid` | required | `CNB_GROUP_ID` | - | GID of user's group in the stack's build and run images |
| `-version` | optional | - | false | show version |
| `-skip-restore` | optional | - | false | do not restore metadata from previous image or data from cache
| `-tag` (multiples allowed) | optional | - | | additional tags to apply to exported image
Copy link
Contributor

Choose a reason for hiding this comment

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

What image would the lifecycle analyze for previous layers? Could we add a previous-image to separate the tags that we right to from the resulting location?

Copy link
Member

Choose a reason for hiding this comment

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

The argument provided as the <image name> would be the one that the lifecycle would analyze, no? -tag will be used to specify additional write locations.

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems a bit confusing to me that tags are not the complete list of locations that the lifecycle will export to especially because doesn't have the tag name inside of it.

Additionally, at times it can be useful to explicitly call out the image input to the analyze step. For example: kpack could pass in the previous image's digest to the analyzer. You obviously wouldn't export to an image name with the digest.

Copy link
Member Author

Choose a reason for hiding this comment

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

@matthewmcnew I am not opposed to adding an optional flag for the previous image image, so long as it default to the export tag when not supplied.

The rationale behind the single positional argument is that an image tag is the only required input. Whereas every other flag configures the build process, the <image-name> is the primary thing the process acts on.

Given that we already enforce that all exported tags are tags on the same registry, what if we changed the value passed to -t to be a "tag tag" (in the <registry.com/repo/name:tag> sense). I am not sure exporting to multiple different repositories in the same registry is really a valid use case. Maybe that would make the usage clearer - only the positional argument gets to define the repository.

Copy link
Contributor

Choose a reason for hiding this comment

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

Love the optional previous image flag.

Copy link
Contributor

Choose a reason for hiding this comment

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

I fear using "tag tag" as the value passed to -t would be confusing because it would be differ from the "tag" terminology in docker and kpack.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we just reuse the multiple positional arguments like what is in exporter today for multiple tags?

Copy link
Member Author

Choose a reason for hiding this comment

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

A single positional argument and additional -tags seems more honest? The exporter currently treats the first of the positional arguments differently than the rest. In this proposed phase the positional argument will be used as the default value for the analyzer image. If one of the tags in special, 1 positional arg + flags seems to indicate that more clearly.

@ekcasey
Copy link
Member Author

ekcasey commented Jan 23, 2020

@jabrown85

should we consider /cnb/lifecycle/build or another name?

build seems too close to builder and therefore likely to be confusing.

/cnb/lifecycle/combo?

text/0000-lifecycle-all.md Outdated Show resolved Hide resolved
[summary]: #summary

### `/cnb/lifecycle/all`
A new lifecycle binary with the name `lifecycle/all` will be included in each released lifecycle archive. Within a builder image, it will be found at the path `/cnb/lifecycle/all`. When invoked, it will run the following phases sequentially:
Copy link
Member

Choose a reason for hiding this comment

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

RE: name

Creating a thread to discuss the name of this new binary.

Previous comments:

If bin/develop gets built and get it's own binary at /cnb/lifecycle/develop should we consider /cnb/lifecycle/build or another name?
#46 (comment) - @jabrown85

build seems too close to builder and therefore likely to be confusing.
/cnb/lifecycle/combo?
#46 (comment) - @ekcasey

Copy link
Member

Choose a reason for hiding this comment

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

Not a fan of combo....

Also, FWIW, it already isn't all in that it doesn't include rebaser.

Copy link
Member Author

Choose a reason for hiding this comment

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

@jromero gonna start a thread just to shoot down every idea without adding a suggestion? ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

lifecycle/make or lifecycle/constructor?

Copy link
Member Author

Choose a reason for hiding this comment

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

ooo, I think /lifecycle/make is my favorite so far (@ashwin-venkatesh agrees 💯 )

Copy link
Member

Choose a reason for hiding this comment

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

@ekcasey :D Wanted to start the thread but didn't have any good ideas myself.

Binary name suggestions:

  • /lifecycle/phases

Maybe we don't need a new binary at all and only provide a subcommand to the single lifecycle binary.

  • lifecycle/lifecycle build-app
  • lifecycle/lifecycle run-phases

Copy link
Member

Choose a reason for hiding this comment

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

I'm ok with lifecycle/make but it could be confused with make

# Unresolved Questions
[unresolved-questions]: #unresolved-questions

- Is there a better name than `lifecycle/all`? It doesn't include `launcher` or `rebaser` functionality so it isn't truly `all`.
Copy link
Member

Choose a reason for hiding this comment

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

  • lifecycle/accio
  • lifecycle/alohomora
  • lifecycle/morsmordre (dark magic)
  • lifecycle/sectumsempra (very dark magic)

Copy link
Member Author

Choose a reason for hiding this comment

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

lifecycle/sectumsempra

lifecycle/silencio

Copy link
Member

@dgageot dgageot Jan 31, 2020

Choose a reason for hiding this comment

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

lifecycle/ash_nazg to rule them all

@nebhale
Copy link
Contributor

nebhale commented Jan 29, 2020

I move that this RFC be sent to FCP with a disposition of merge, closing 1700 PT, February 5, 2019.

# Summary
[summary]: #summary

### `/cnb/lifecycle/all`
Copy link
Member Author

Choose a reason for hiding this comment

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

Following suggestion in WG I am going to use this comment thread to conduct an informal poll to select the name for this binary. After this comment I will add comments each containing a single suggestion:

  1. Please vote with a 👍
  2. No more than 2 votes per person
  3. Feel free to express dislike with a 👎 (full disclosure these may not factor into the counting)
  4. To add a suggestion, add a comment containing only the suggestion

Copy link
Member Author

Choose a reason for hiding this comment

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

lifecycle/all

Copy link
Member Author

Choose a reason for hiding this comment

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

lifecycle/make

Copy link
Member Author

Choose a reason for hiding this comment

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

lifecycle/combo

Copy link
Member Author

Choose a reason for hiding this comment

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

lifecycle/phases

Copy link
Member Author

Choose a reason for hiding this comment

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

lifecycle/constructor

Copy link
Member Author

Choose a reason for hiding this comment

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

lifecycle/creator

Copy link
Member Author

Choose a reason for hiding this comment

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

/lifecycle/build

@zmackie
Copy link
Contributor

zmackie commented Feb 6, 2020

@ekcasey Will make changes to codify lifecycle/creator

ekcasey added a commit that referenced this pull request Feb 6, 2020
* name selected via poll #46 (comment)

Signed-off-by: Emily Casey <[email protected]>
@ekcasey ekcasey requested a review from a team as a code owner February 6, 2020 20:35
ekcasey and others added 7 commits February 6, 2020 12:58
* summary
* motivation
* 1/2 of what-is-it

Signed-off-by: Emily Casey <[email protected]>
Signed-off-by: Ben Hale <[email protected]>
* adds context around security concerns
* indicates the uid and gid are required

Signed-off-by: Emily Casey <[email protected]>
Signed-off-by: Ben Hale <[email protected]>
* typo fixes
* docker build -t as prior art

Signed-off-by: Emily Casey <[email protected]>
Signed-off-by: Ben Hale <[email protected]>
Signed-off-by: Emily Casey <[email protected]>
Signed-off-by: Ben Hale <[email protected]>
Signed-off-by: Emily Casey <[email protected]>
Signed-off-by: Ben Hale <[email protected]>
* name selected via poll #46 (comment)

Signed-off-by: Emily Casey <[email protected]>
Signed-off-by: Ben Hale <[email protected]>
[resolves #46]

Signed-off-by: Ben Hale <[email protected]>
@nebhale nebhale closed this in 528b1a1 Feb 6, 2020
@nebhale nebhale merged commit 528b1a1 into master Feb 6, 2020
@nebhale nebhale deleted the lifecycle-all branch February 6, 2020 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants