Skip to content

Commit 85be549

Browse files
committed
decorrelate source and target directories
1 parent 500ea72 commit 85be549

1 file changed

Lines changed: 118 additions & 0 deletions

File tree

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Meta
2+
[meta]: #meta
3+
- Name: Decorrelate source dans target directories
4+
- Start Date: 2023-04-03
5+
- Author(s): @xfrancois
6+
- Status: Draft <!-- Acceptable values: Draft, Approved, On Hold, Superseded -->
7+
- RFC Pull Request: (leave blank)
8+
- CNB Pull Request: (leave blank)
9+
- CNB Issue: [Can't make final image directory different from the CNB_APP_DIR](https://github.com/buildpacks/lifecycle/issues/1034)
10+
- Supersedes: N/A
11+
12+
# Summary
13+
[summary]: #summary
14+
15+
Allow CNB users to build image from one directory and have the final image directory structure to be something else. Currently it's possible to change the default target directory (/workspace) by setting the `CNB_APP_DIR` environement variable, but the source directory must also be the one specified in `CNB_APP_DIR`. This behavior is not well suited for constrained environements, like CI.
16+
17+
# Definitions
18+
[definitions]: #definitions
19+
20+
N/A
21+
22+
# Motivation
23+
[motivation]: #motivation
24+
25+
- Why should we do this?
26+
27+
We should do this to provide more flexibility for end-users.
28+
29+
- What use cases does it support?
30+
31+
Building from a CI tool, for example Gitlab-CI. We can't chose the source directory from which we are building. On Gitlab-CI the Git folder is checkout on `/builds/<group>>/<project>`. By having a way to decorrelate source and target directories, we could chose the finaly directory structure we want.
32+
33+
- What is the expected outcome?
34+
35+
Support of a new environment variable / parameter that allows to set the source directory. We probably should document that `CNB_APP_DIR` only handles the target directory.
36+
37+
| Variable | Default value | Description |
38+
|--------------------|---------------|----------------------------|
39+
| `CNB_APP_DIR` | `/workspace` | Target directory structure |
40+
| `CNB_SOURCE_APP_DIR` | `$CNB_APP_DIR` | Source directory structure |
41+
42+
# What it is
43+
[what-it-is]: #what-it-is
44+
45+
This provides a high level overview of the feature.
46+
47+
- Define any new terminology.
48+
- Define the target persona: buildpack author, buildpack user, platform operator, platform implementor, and/or project contributor.
49+
- Explaining the feature largely in terms of examples.
50+
- If applicable, provide sample error messages, deprecation warnings, or migration guidance.
51+
- If applicable, describe the differences between teaching this to existing users and new users.
52+
53+
# How it Works
54+
[how-it-works]: #how-it-works
55+
56+
In the Gitlab-CI example, I can't chose the source directory but I want to be able to chose the target directory. I will set the variables like this :
57+
58+
`CNB_SOURCE_APP_DIR`: /builds/group/project
59+
60+
`CNB_APP_DIR`: /workspace
61+
62+
The final image will be available
63+
64+
# Migration
65+
[migration]: #migration
66+
67+
N/A
68+
69+
# Drawbacks
70+
[drawbacks]: #drawbacks
71+
72+
N/A
73+
74+
# Alternatives
75+
[alternatives]: #alternatives
76+
77+
- What is the impact of not doing this?
78+
79+
The impact is that people wanting to use CNB on CI environment will have to make some workaround (like copying source folders in another location) in order to have a proper directory structure in the final image.
80+
81+
# Prior Art
82+
[prior-art]: #prior-art
83+
84+
Discuss prior art, both the good and bad.
85+
86+
# Unresolved Questions
87+
[unresolved-questions]: #unresolved-questions
88+
89+
- What parts of the design do you expect to be resolved before this gets merged?
90+
- What parts of the design do you expect to be resolved through implementation of the feature?
91+
- What related issues do you consider out of scope for this RFC that could be addressed in the future independently of the solution that comes out of this RFC?
92+
93+
# Spec. Changes (OPTIONAL)
94+
[spec-changes]: #spec-changes
95+
Does this RFC entail any proposed changes to the core specifications or extensions? If so, please document changes here.
96+
Examples of a spec. change might be new lifecycle flags, new `buildpack.toml` fields, new fields in the buildpackage label, etc.
97+
This section is not intended to be binding, but as discussion of an RFC unfolds, if spec changes are necessary, they should be documented here.
98+
99+
# History
100+
[history]: #history
101+
102+
<!--
103+
## Amended
104+
### Meta
105+
[meta-1]: #meta-1
106+
- Name: (fill in the amendment name: Variable Rename)
107+
- Start Date: (fill in today's date: YYYY-MM-DD)
108+
- Author(s): (Github usernames)
109+
- Amendment Pull Request: (leave blank)
110+
111+
### Summary
112+
113+
A brief description of the changes.
114+
115+
### Motivation
116+
117+
Why was this amendment necessary?
118+
--->

0 commit comments

Comments
 (0)