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

Add functionality for passing previous-image flag to analyzer #1275

Closed
1 task done
importhuman opened this issue Sep 5, 2021 · 7 comments
Closed
1 task done

Add functionality for passing previous-image flag to analyzer #1275

importhuman opened this issue Sep 5, 2021 · 7 comments
Labels
status/triage Issue or PR that requires contributor attention. type/enhancement Issue that requests a new feature or improvement.

Comments

@importhuman
Copy link
Member

Description

#1198 added the previous-image flag to creator. According to #897, it needs to be added to analyzer as well.

Additional context

  • This feature should be documented somewhere
@importhuman importhuman added status/triage Issue or PR that requires contributor attention. type/enhancement Issue that requests a new feature or improvement. labels Sep 5, 2021
@importhuman
Copy link
Member Author

I'm a bit stuck on what exactly the parameter for analyzer should be. For instance, in creator in #1198, we appended -previous-image <prev-image> to the flags. As per #897, analyzer needs this in the form of analyzer <prev-image>. What is this parameter exactly that is being passed? LifecycleImage?
cc: @jromero

@aemengo
Copy link
Contributor

aemengo commented Sep 9, 2021

@importhuman I'm having trouble following the question as written. In #1198, you implemented the functionality with the following line of code here:

...
   flags = append(flags, "-previous-image", l.opts.PreviousImage)
...

The analyzer would thus require the same parameter: l.opts.PreviousImage. Does this help?

@importhuman
Copy link
Member Author

@aemengo yeah it does, I was initially thinking that creator already takes image as argument, so if analyzer also takes an argument, do I modify that or can I pass an extra parameter. I'll try appending the previous-image to args and make an initial PR.

importhuman added a commit to importhuman/pack that referenced this issue Sep 9, 2021
See buildpacks#897, buildpacks#1275

Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>
@aemengo
Copy link
Contributor

aemengo commented Sep 9, 2021

@importhuman Oh I understand now. Thank you for your patience with me, It's a good question.

As @natalieparellano explained to us in this slack.buildpacks.io thread: analyzer already takes an argument so:

analyzer <image>

should become

analyzer <prev-image>

And it makes sense because the analyzer phase is in fact looking for optimizations from the previous build of your application image.

@importhuman
Copy link
Member Author

@aemengo so is the parameter to be changed l.opts.Image or l.opts.LifecycleImage? 😅

@aemengo
Copy link
Contributor

aemengo commented Sep 10, 2021

@importhuman Ah. Well, I'm not quite so sure myself. There's an opportunity to learn here that I don't want to steal from you. 🙂

@importhuman
Copy link
Member Author

@aemengo that's fair I suppose 😂 looking at tests in internal/build/lifecycle_execution_test.go, analyzer runs the phase with lifecycle image whether publish is true or false, so based on that I reckon tinkering with it is not the correct approach, rather the image should be modified. I'll work on some tests in lifecycle_execution_test.go before the next commit.

importhuman added a commit to importhuman/pack that referenced this issue Sep 15, 2021
This commit adds tests for passing previous-image to analyzer, with
some modifications to the naming of earlier tests for passing the flag
to creator.

Also modifies "opts" to "Opts" in LifecycleExecution to make it
accessible to the test; other changes maintain this change across the
repository.

Closes buildpacks#1275

Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>
importhuman added a commit to importhuman/pack that referenced this issue Sep 18, 2021
See buildpacks#897, buildpacks#1275

Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>
importhuman added a commit to importhuman/pack that referenced this issue Sep 18, 2021
This commit adds getters for lifecycle image and previous image,
and updates the previous-image unit tests using them. Also reverts
"Opts" to "opts" in LifecycleExecution across the repo where applicable
(from an earlier commit).

Closes buildpacks#1275

Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/triage Issue or PR that requires contributor attention. type/enhancement Issue that requests a new feature or improvement.
Projects
None yet
Development

No branches or pull requests

2 participants