forked from actions/runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b19e5d7
commit 0da38a6
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# ADR 0278: Env Context | ||
|
||
**Date**: 2019-09-30 | ||
|
||
**Status**: Accepted | ||
|
||
## Context | ||
|
||
User wants to reference workflow variables defined in workflow yaml file for action's input, displayName and condition. | ||
|
||
## Decision | ||
|
||
### Add `env` context in the runner | ||
|
||
Runner will create and populate the `env` context for every job execution using following logic: | ||
1. On job start, create `env` context with any environment variables in the job message, these are env defined in customer's YAML file's job/workflow level `env` section. | ||
2. Update `env` context when customer use `::set-env::` to set env at the runner level. | ||
|
||
The `env` context is only available in the runner, customer can't use the `env` context in any server evaluation part, just like the `runner` context | ||
|
||
Example yaml: | ||
```yaml | ||
|
||
env: | ||
env1: 100 | ||
jobs: | ||
build: | ||
env: | ||
env2: 200 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
echo ${{ env.env1 }} | ||
if: env.env2 == 200 | ||
name: ${{ env.env1 }}_${{ env.env2 }} | ||
``` | ||
### Don't populate the `env` context with environment variables from runner machine. | ||
|
||
With job container and container action, the `env` context may not have the right value customer want and will cause confusion. | ||
Ex: | ||
```yaml | ||
build: | ||
runs-on: ubuntu-latest <- $USER=runner in hosted machine | ||
container: ubuntu:16.04 <- $USER=root in container | ||
steps: | ||
- run: echo ${{env.USER}} <- what should customer expect this output? runner/root | ||
- uses: docker://ubuntu:18.04 | ||
with: | ||
args: echo ${{env.USER}} <- what should customer expect this output? runner/root | ||
``` |