Skip to content
This repository was archived by the owner on Aug 14, 2020. It is now read-only.

Commit 148303f

Browse files
committed
Merge pull request #228 from jonboulle/env
SPEC: specify only minimum set of environment vars
2 parents 5584b15 + 0bd25ac commit 148303f

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

SPEC.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,18 @@ Note that logging mechanisms other than stdout and stderr are not required by th
190190

191191
#### Execution Environment
192192

193-
* **Working directory** defaults to the root of the application image, overridden with "workingDirectory"
193+
The following environment variables MUST be set for each application's main process and any lifecycle processes:
194194
* **PATH** `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
195195
* **USER, LOGNAME** username of the user executing this app
196196
* **HOME** home directory of the user
197197
* **SHELL** login shell of the user
198198
* **AC_APP_NAME** name of the application, as defined in the image manifest
199199
* **AC_METADATA_URL** URL where the metadata service for this container can be found
200200

201+
An executor MAY set additional environment variables for the application processes.
202+
203+
Additionally, processes must have their **working directory** set to the value of the application's **workingDirectory** option, if specified, or the root of the application image by default.
204+
201205
### Isolators
202206

203207
Isolators enforce resource constraints rather than namespacing.

ace/validator.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ func ValidateWorkingDirectory(wwd string) (r results) {
177177
return
178178
}
179179

180-
// ValidateEnvironment ensures that the given environment exactly maps the
181-
// environment in which this process is running
180+
// ValidateEnvironment ensures that the given environment contains the
181+
// necessary/expected environment variables.
182182
func ValidateEnvironment(wenv map[string]string) (r results) {
183183
for wkey, wval := range wenv {
184184
gval := os.Getenv(wkey)
@@ -187,16 +187,6 @@ func ValidateEnvironment(wenv map[string]string) (r results) {
187187
r = append(r, err)
188188
}
189189
}
190-
for _, s := range os.Environ() {
191-
parts := strings.SplitN(s, "=", 2)
192-
k := parts[0]
193-
_, ok := wenv[k]
194-
switch {
195-
case k == appNameEnv, k == "PATH", k == "TERM", k == "AC_METADATA_URL":
196-
case !ok:
197-
r = append(r, fmt.Errorf("unexpected environment variable %q set", k))
198-
}
199-
}
200190
return
201191
}
202192

0 commit comments

Comments
 (0)