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

Can't make final image directory different from the CNB_APP_DIR #1034

Open
xfrancois opened this issue Mar 15, 2023 · 4 comments
Open

Can't make final image directory different from the CNB_APP_DIR #1034

xfrancois opened this issue Mar 15, 2023 · 4 comments

Comments

@xfrancois
Copy link

xfrancois commented Mar 15, 2023

Summary

I try to build images on Gitlab-CI with CNB. I can't chose the path from which I build the image because of this, but I would like to have a proper hierarchy in the final image.

Example :

My Gitlab-CI job use paketobuildpacks/builder:base as a base image and checkout the code in /builds/myapp (I can't chose that). I need to set CNB_APP_DIR to /builds/myapp, otherwise CNB doesn't know where is the code. But in the final image, the constructed hierarchy is also /builds/myapp and I would need it be /workspace/ for example.

From what I saw, it was possible with the PACK_APP_DIR variable introduced here #35 but it was removed after. #223 seems to talk about the exact issue i'm facing, but without pointing to some solution.

Is there any solution to decorrelate the location of the code used by the buildpacks and the location of the hierarchy in the final image ?

lifecycle version

0.16.0

platform version(s)

0.9

@xfrancois xfrancois added status/triage type/bug Something isn't working labels Mar 15, 2023
@natalieparellano
Copy link
Member

@xfrancois I believe the CNB spec as it stands currently prevents this decoupling. From the platform spec:

  • The app image:
    • MUST contain the following Env entries
      • CNB_APP_DIR=<app>
    • MUST have the working directory set to the value of <app>.

If you are invoking the lifecycle directly you could try passing a different value of -app to the exporter, but that may have unexpected results as the source directory might not get exported. pack build supports --workspace to make the source directory configurable, but it uses the same value for every lifecycle phase.

This might be something we could add to the spec if needed, but we'd need to deliberate about it and find the best way to do it.

@natalieparellano natalieparellano added status/awaiting-response Further information is requested type/support and removed type/bug Something isn't working status/triage labels Mar 20, 2023
@xfrancois
Copy link
Author

xfrancois commented Mar 21, 2023

Thank you for your answer. Yes, as it stands, it's hard to use on a constrained environment where we can't chose the source folder (typically on a CI system). I don't know the best way to implement this improvement, but I think it should be considered

@natalieparellano
Copy link
Member

Sounds good - as this is a spec change, it would require an RFC (the process can be found here). If you'd be interested in contributing an RFC, I or another maintainer would be glad to assist you in this process.

@natalieparellano
Copy link
Member

Blocking on buildpacks/rfcs#282

@natalieparellano natalieparellano added status/blocked and removed status/awaiting-response Further information is requested labels Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants