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 profile buildpack detect and build logic #11

Merged
merged 7 commits into from
Aug 5, 2022

Conversation

gcemaj
Copy link
Contributor

@gcemaj gcemaj commented Jul 19, 2022

closes: #7
closes: #8

Signed-off-by: gcemaj gcemaj@bloomberg.net

@gcemaj gcemaj requested a review from a team as a code owner July 19, 2022 15:39
@sambhav sambhav added type:enhancement A general enhancement semver:major A change requiring a major version bump labels Jul 19, 2022
@gcemaj gcemaj force-pushed the gcemaj-detect-build branch 3 times, most recently from 45e0c11 to 8a38c2a Compare July 19, 2022 19:11
@gcemaj gcemaj requested a review from sambhav July 19, 2022 19:14
This commit adds detect and build business logic and basic tests

Signed-off-by: gcemaj <gcemaj@bloomberg.net>
@gcemaj gcemaj force-pushed the gcemaj-detect-build branch from 5fa7981 to 699ec05 Compare July 20, 2022 17:54
Signed-off-by: gcemaj <gcemaj@bloomberg.net>
@gcemaj gcemaj requested a review from dmikusa July 29, 2022 19:54
@dmikusa
Copy link
Contributor

dmikusa commented Aug 1, 2022

@samj1912 I was playing with this buildpack and noticed that my .profile is getting sourced twice. I think that's because the lifecycle is doing it once and now the exec.d is doing it. Is that what you'd expect to happen also? If so, what do you think the buildpack can/should do here to try and prevent that from happening?

I'd like to think that in most cases the .profile script should be OK to run twice, but we can't know that. It could have some side effect that breaks the second time it's run or causes other problems. Is it possible to get the lifecycle version when the buildpack runs? We could add a check so that the buildpack does not pass detection on versions of the lifecycle where it still runs the profile script.

Signed-off-by: gcemaj <gcemaj@bloomberg.net>
@gcemaj gcemaj requested review from dmikusa and sambhav August 1, 2022 16:27
@gcemaj
Copy link
Contributor Author

gcemaj commented Aug 1, 2022

@samj1912 I was playing with this buildpack and noticed that my .profile is getting sourced twice. I think that's because the lifecycle is doing it once and now the exec.d is doing it. Is that what you'd expect to happen also? If so, what do you think the buildpack can/should do here to try and prevent that from happening?

I'd like to think that in most cases the .profile script should be OK to run twice, but we can't know that. It could have some side effect that breaks the second time it's run or causes other problems. Is it possible to get the lifecycle version when the buildpack runs? We could add a check so that the buildpack does not pass detection on versions of the lifecycle where it still runs the profile script.

i thought there was a way to say what version of the lifecycle a BP was compatible with. We just need to make this be only compatible with versions that are new enough right?

Signed-off-by: gcemaj <gcemaj@bloomberg.net>
@dmikusa
Copy link
Contributor

dmikusa commented Aug 4, 2022

In regards to the duplicate runs, an update from a Slack conversation. It sounds like the removal from .profile support in the lifecycle will require a buildpack API change. If that's true, then we can specify in buildpack.toml that we require buildpack API 0.9 (or whatever version it ends up being). That would prevent someone from using this buildpack with an older setup & causing problems.

Copy link
Member

@sambhav sambhav left a comment

Choose a reason for hiding this comment

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

Some minor comments. Otherwise LGTM.

Comment on lines 76 to 83
Plans: []libcnb.BuildPlan{{
Provides: []libcnb.BuildPlanProvide{{
Name: "profile",
}},
Requires: []libcnb.BuildPlanRequire{{
Name: "profile",
}},
}},
Copy link
Member

Choose a reason for hiding this comment

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

I don't think the buildpack actually needs any provides/requires?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so the plans should be empty?

Copy link
Contributor

@dmikusa dmikusa Aug 5, 2022

Choose a reason for hiding this comment

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

This question has come up before. I know that in Paketo we always put something, even if provides/requires match-up like here. I don't totally know why that is though. If it's historic reasons or if there's some function to it. It logically seems redundant though, since you are providing your own requirement. The only thing that I can think of off the top of my head that this would do is to ensure there's an entry in the buildplan, but this buildpack isn't looking at the buildplan so idk.

@gcemaj did you by chance try it with an empty buildplan? Did it work the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i have not yet, can i do it locally?

Signed-off-by: gcemaj <gcemaj@bloomberg.net>
@gcemaj gcemaj requested a review from sambhav August 5, 2022 13:07
Signed-off-by: gcemaj <gcemaj@bloomberg.net>
Signed-off-by: gcemaj <gcemaj@bloomberg.net>
@sambhav sambhav changed the title [action] initial attempt Add profile buildpack detect and build logic Aug 5, 2022
@sambhav sambhav merged commit 854f33e into buildpacks:main Aug 5, 2022
@gcemaj gcemaj deleted the gcemaj-detect-build branch August 5, 2022 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:major A change requiring a major version bump type:enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write Build functionality Write Detect functionality
3 participants