mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-12-04 23:31:05 +01:00
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:
parent
62e5045f3b
commit
34443ad5e4
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user