fix: ensure both default and dynamic environment variables are merged

- Added logic to merge variables from both `ENV` and `JSON` fields
- Resolved issue where default environment variables were not being set
This commit is contained in:
Robert Tajnšek 2024-09-20 21:51:19 +02:00
parent 62e5045f3b
commit 34443ad5e4

View File

@ -150,6 +150,13 @@ func (t *LocalJob) getEnvironmentExtraVarsJSON(username string, incomingVersion
func (t *LocalJob) getEnvironmentENV() (res []string, err error) { func (t *LocalJob) getEnvironmentENV() (res []string, err error) {
environmentVars := make(map[string]string) environmentVars := make(map[string]string)
if t.Environment.ENV != nil {
err = json.Unmarshal([]byte(*t.Environment.ENV), &environmentVars)
if err != nil {
return
}
}
if t.Environment.JSON != "" { if t.Environment.JSON != "" {
err = json.Unmarshal([]byte(t.Environment.JSON), &environmentVars) err = json.Unmarshal([]byte(t.Environment.JSON), &environmentVars)
if err != nil { if err != nil {