From b1c7fe155f5e7983aed261bfb5576a9b4e5a6cc5 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 27 Jan 2022 11:30:25 -0500 Subject: [PATCH 1/5] Process specific working directory Signed-off-by: Natalie Arellano --- buildpack.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/buildpack.md b/buildpack.md index d7f2ead1..b21b61a8 100644 --- a/buildpack.md +++ b/buildpack.md @@ -704,7 +704,9 @@ Given the start command and execution strategy, 1. The lifecycle MUST set all buildpack-provided launch environment variables as described in the [Environment](#environment) section. -2. The lifecycle MUST +2. The lifecycle MUST set the working directory for the process to `working-directory`, or to the application directory if `working-directory` is not specified. + +3. The lifecycle MUST 1. [execute](#execd) each file in each `//exec.d` directory in the launch environment and set the [returned variables](#execd-output-toml) in the launch environment before continuing, 1. Firstly, in order of `/bin/build` execution used to construct the OCI image. 2. Secondly, in alphabetically ascending order by layer directory name. @@ -714,7 +716,7 @@ Given the start command and execution strategy, 2. Secondly, in alphabetically ascending order by layer directory name. 3. Thirdly, in alphabetically ascending order by file name. -3. If using an execution strategy involving a shell, the lifecycle MUST use a single shell process to +4. If using an execution strategy involving a shell, the lifecycle MUST use a single shell process to 1. source each file in each `//profile.d` directory, 1. Firstly, in order of `/bin/build` execution used to construct the OCI image. 2. Secondly, in alphabetically ascending order by layer directory name. @@ -726,9 +728,9 @@ Given the start command and execution strategy, 3. source [†](README.md#linux-only)`/.profile` or [‡](README.md#windows-only)`/.profile.bat` if it is present. -3. If using an execution strategy involving a shell, the lifecycle MUST source [†](README.md#linux-only)`/.profile` or [‡](README.md#windows-only)`/.profile.bat` if it is present. +5. If using an execution strategy involving a shell, the lifecycle MUST source [†](README.md#linux-only)`/.profile` or [‡](README.md#windows-only)`/.profile.bat` if it is present. -4. The lifecycle MUST invoke the start command with the decided execution strategy. +6. The lifecycle MUST invoke the start command with the decided execution strategy. [†](README.md#linux-only)When executing a process using any execution strategy, the lifecycle SHOULD replace the lifecycle process in memory without forking it. @@ -901,6 +903,7 @@ command = "" args = [""] direct = false default = false +working-directory = "" [[slices]] paths = [""] @@ -928,6 +931,7 @@ For each process, the buildpack: - MAY specify an `args` list to be passed directly to the specified executable. - MAY specify a `direct` boolean that bypasses the shell. - MAY specify a `default` boolean that indicates that the process type should be selected as the [buildpack-provided default](https://github.com/buildpacks/spec/blob/main/platform.md#outputs-4) during the export phase. +- MAY specify a `working-directory` for the process. The `working-directory` defaults to the application directory if not specified. An individual buildpack may only specify one process type with `default = true`. The lifecycle MUST select, from all buildpack-provided process types, the last process type with `default = true` as the buildpack-provided default. If multiple buildpacks define processes of the same type, the lifecycle MUST use the last process type definition ordered by buildpack execution for the combined process list (a non-default process type definition may override a default process type definition, leaving the app image with no default). From 270ca0461962e58d5bcd966a98bf3a86b1271fd3 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Fri, 11 Feb 2022 10:45:57 -0500 Subject: [PATCH 2/5] Reorder things and clarify the working directory for exec.d and profile.d Signed-off-by: Natalie Arellano --- buildpack.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/buildpack.md b/buildpack.md index b21b61a8..45867114 100644 --- a/buildpack.md +++ b/buildpack.md @@ -704,9 +704,7 @@ Given the start command and execution strategy, 1. The lifecycle MUST set all buildpack-provided launch environment variables as described in the [Environment](#environment) section. -2. The lifecycle MUST set the working directory for the process to `working-directory`, or to the application directory if `working-directory` is not specified. - -3. The lifecycle MUST +1. The lifecycle MUST 1. [execute](#execd) each file in each `//exec.d` directory in the launch environment and set the [returned variables](#execd-output-toml) in the launch environment before continuing, 1. Firstly, in order of `/bin/build` execution used to construct the OCI image. 2. Secondly, in alphabetically ascending order by layer directory name. @@ -716,7 +714,9 @@ Given the start command and execution strategy, 2. Secondly, in alphabetically ascending order by layer directory name. 3. Thirdly, in alphabetically ascending order by file name. -4. If using an execution strategy involving a shell, the lifecycle MUST use a single shell process to +The working directory for all executed files SHALL be ``. + +1. If using an execution strategy involving a shell, the lifecycle MUST use a single shell process to 1. source each file in each `//profile.d` directory, 1. Firstly, in order of `/bin/build` execution used to construct the OCI image. 2. Secondly, in alphabetically ascending order by layer directory name. @@ -727,10 +727,11 @@ Given the start command and execution strategy, 3. Thirdly, in alphabetically ascending order by file name. 3. source [†](README.md#linux-only)`/.profile` or [‡](README.md#windows-only)`/.profile.bat` if it is present. +The working directory for all sourced files SHALL be ``. -5. If using an execution strategy involving a shell, the lifecycle MUST source [†](README.md#linux-only)`/.profile` or [‡](README.md#windows-only)`/.profile.bat` if it is present. +1. The lifecycle MUST set the working directory for the start command to `working-directory`, or to `` if `working-directory` is not specified. -6. The lifecycle MUST invoke the start command with the decided execution strategy. +1. The lifecycle MUST invoke the start command with the decided execution strategy. [†](README.md#linux-only)When executing a process using any execution strategy, the lifecycle SHOULD replace the lifecycle process in memory without forking it. From e06c670cf3ed89e0fbf0b8e7e3ddb5fe27dd0edf Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 24 Feb 2022 16:19:02 -0500 Subject: [PATCH 3/5] Apply suggestions from code review Signed-off-by: Natalie Arellano Co-authored-by: Emily Casey --- buildpack.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildpack.md b/buildpack.md index 45867114..9e2ca5ae 100644 --- a/buildpack.md +++ b/buildpack.md @@ -705,7 +705,7 @@ Given the start command and execution strategy, 1. The lifecycle MUST set all buildpack-provided launch environment variables as described in the [Environment](#environment) section. 1. The lifecycle MUST - 1. [execute](#execd) each file in each `//exec.d` directory in the launch environment and set the [returned variables](#execd-output-toml) in the launch environment before continuing, + 1. [execute](#execd) each file in each `//exec.d` directory in the launch environment, with working directory ``, and set the [returned variables](#execd-output-toml) in the launch environment before continuing, 1. Firstly, in order of `/bin/build` execution used to construct the OCI image. 2. Secondly, in alphabetically ascending order by layer directory name. 3. Thirdly, in alphabetically ascending order by file name. @@ -716,7 +716,7 @@ Given the start command and execution strategy, The working directory for all executed files SHALL be ``. -1. If using an execution strategy involving a shell, the lifecycle MUST use a single shell process to +1. If using an execution strategy involving a shell, the lifecycle MUST use a single shell process with working directory `` to 1. source each file in each `//profile.d` directory, 1. Firstly, in order of `/bin/build` execution used to construct the OCI image. 2. Secondly, in alphabetically ascending order by layer directory name. @@ -729,7 +729,7 @@ The working directory for all executed files SHALL be ``. The working directory for all sourced files SHALL be ``. -1. The lifecycle MUST set the working directory for the start command to `working-directory`, or to `` if `working-directory` is not specified. +1. The lifecycle MUST set the working directory for the start command to ``, or to `` if `` is not specified. 1. The lifecycle MUST invoke the start command with the decided execution strategy. From 0ecb2fe3054b1b2063b172377015c4e5d6d260e6 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 24 Feb 2022 16:23:08 -0500 Subject: [PATCH 4/5] Remove standalone lines, and add one more line Signed-off-by: Natalie Arellano --- buildpack.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/buildpack.md b/buildpack.md index 9e2ca5ae..b2757976 100644 --- a/buildpack.md +++ b/buildpack.md @@ -709,14 +709,12 @@ Given the start command and execution strategy, 1. Firstly, in order of `/bin/build` execution used to construct the OCI image. 2. Secondly, in alphabetically ascending order by layer directory name. 3. Thirdly, in alphabetically ascending order by file name. - 2. [execute](#execd) each file in each `//exec.d/` directory in the launch environment and set the [returned variables](#execd-output-toml) in the launch environment before continuing, + 2. [execute](#execd) each file in each `//exec.d/` directory in the launch environment, with working directory ``, and set the [returned variables](#execd-output-toml) in the launch environment before continuing, 1. Firstly, in order of `/bin/build` execution used to construct the OCI image. 2. Secondly, in alphabetically ascending order by layer directory name. 3. Thirdly, in alphabetically ascending order by file name. -The working directory for all executed files SHALL be ``. - -1. If using an execution strategy involving a shell, the lifecycle MUST use a single shell process with working directory `` to +1. If using an execution strategy involving a shell, the lifecycle MUST use a single shell process, with working directory ``, to 1. source each file in each `//profile.d` directory, 1. Firstly, in order of `/bin/build` execution used to construct the OCI image. 2. Secondly, in alphabetically ascending order by layer directory name. @@ -727,8 +725,6 @@ The working directory for all executed files SHALL be ``. 3. Thirdly, in alphabetically ascending order by file name. 3. source [†](README.md#linux-only)`/.profile` or [‡](README.md#windows-only)`/.profile.bat` if it is present. -The working directory for all sourced files SHALL be ``. - 1. The lifecycle MUST set the working directory for the start command to ``, or to `` if `` is not specified. 1. The lifecycle MUST invoke the start command with the decided execution strategy. From e3ba9c3b7a5c702a68c8df4a7b5e9ab373e8cf9c Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Wed, 2 Mar 2022 18:04:54 -0500 Subject: [PATCH 5/5] Change working-directory to working-dir Signed-off-by: Natalie Arellano --- buildpack.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildpack.md b/buildpack.md index b2757976..9f8b6e72 100644 --- a/buildpack.md +++ b/buildpack.md @@ -725,7 +725,7 @@ Given the start command and execution strategy, 3. Thirdly, in alphabetically ascending order by file name. 3. source [†](README.md#linux-only)`/.profile` or [‡](README.md#windows-only)`/.profile.bat` if it is present. -1. The lifecycle MUST set the working directory for the start command to ``, or to `` if `` is not specified. +1. The lifecycle MUST set the working directory for the start command to ``, or to `` if `` is not specified. 1. The lifecycle MUST invoke the start command with the decided execution strategy. @@ -900,7 +900,7 @@ command = "" args = [""] direct = false default = false -working-directory = "" +working-dir = "" [[slices]] paths = [""] @@ -928,7 +928,7 @@ For each process, the buildpack: - MAY specify an `args` list to be passed directly to the specified executable. - MAY specify a `direct` boolean that bypasses the shell. - MAY specify a `default` boolean that indicates that the process type should be selected as the [buildpack-provided default](https://github.com/buildpacks/spec/blob/main/platform.md#outputs-4) during the export phase. -- MAY specify a `working-directory` for the process. The `working-directory` defaults to the application directory if not specified. +- MAY specify a `working-dir` for the process. The `working-dir` defaults to the application directory if not specified. An individual buildpack may only specify one process type with `default = true`. The lifecycle MUST select, from all buildpack-provided process types, the last process type with `default = true` as the buildpack-provided default. If multiple buildpacks define processes of the same type, the lifecycle MUST use the last process type definition ordered by buildpack execution for the combined process list (a non-default process type definition may override a default process type definition, leaving the app image with no default).