fix 99: support string and map variants of container
This commit is contained in:
@@ -53,8 +53,9 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
||||
job := rc.Run.Job()
|
||||
|
||||
var image string
|
||||
if job.Container != nil {
|
||||
image = job.Container.Image
|
||||
c := job.Container()
|
||||
if c != nil {
|
||||
image = c.Image
|
||||
} else {
|
||||
platformName := rc.ExprEval.Interpolate(job.RunsOn)
|
||||
image = rc.Config.Platforms[strings.ToLower(platformName)]
|
||||
|
@@ -87,8 +87,9 @@ func (sc *StepContext) setupEnv() common.Executor {
|
||||
step := sc.Step
|
||||
return func(ctx context.Context) error {
|
||||
var env map[string]string
|
||||
if job.Container != nil {
|
||||
env = mergeMaps(rc.GetEnv(), job.Container.Env, step.GetEnv())
|
||||
c := job.Container()
|
||||
if c != nil {
|
||||
env = mergeMaps(rc.GetEnv(), c.Env, step.GetEnv())
|
||||
} else {
|
||||
env = mergeMaps(rc.GetEnv(), step.GetEnv())
|
||||
}
|
||||
|
8
pkg/runner/testdata/job-container/push.yml
vendored
8
pkg/runner/testdata/job-container/push.yml
vendored
@@ -10,3 +10,11 @@ jobs:
|
||||
TEST_ENV: test-value
|
||||
steps:
|
||||
- run: echo ${TEST_ENV} | grep test-value
|
||||
|
||||
test2:
|
||||
runs-on: ubuntu-latest
|
||||
container: node:10.16-jessie
|
||||
steps:
|
||||
- run: echo ${TEST_ENV} | grep test-value
|
||||
env:
|
||||
TEST_ENV: test-value
|
||||
|
Reference in New Issue
Block a user