feat: load every environment from --env-file to workflow (#184)

* feat: load every environment from --env-file to workflow

* fix: pass dotenv's environments through by context

* updates to support --secret-file

Co-authored-by: Casey Lee <[email protected]>
This commit is contained in:
jony montanaandCasey Lee authored and GitHub committed 2020-04-17 10:04:40 -07:00
1 parent f6e37a8d67
commit 2f395475b0
10 files changed
+47 -30

No files matched your search

+3 -13
View File
@@ -3,7 +3,6 @@ package runner
import (
"context"
"fmt"
"os"
"path/filepath"
"testing"
@@ -110,18 +109,8 @@ func TestRunEventSecrets(t *testing.T) {
workdir, err := filepath.Abs("testdata")
assert.NilError(t, err, workflowPath)
_ = godotenv.Load(filepath.Join(workdir, workflowPath, ".env"))
secrets := make(map[string]string)
for _, secret := range []string{
"MY_SECRET",
"MULTILINE_SECRET",
"JSON_SECRET",
} {
if env, ok := os.LookupEnv(secret); ok && env != "" {
secrets[secret] = env
}
}
env, _ := godotenv.Read(filepath.Join(workdir, workflowPath, ".env"))
secrets, _ := godotenv.Read(filepath.Join(workdir, workflowPath, ".secrets"))
runnerConfig := &Config{
Workdir: workdir,
@@ -129,6 +118,7 @@ func TestRunEventSecrets(t *testing.T) {
Platforms: platforms,
ReuseContainers: false,
Secrets: secrets,
Env: env,
}
runner, err := New(runnerConfig)
assert.NilError(t, err, workflowPath)