Compare commits

..
Author SHA1 Message Date
mrhid6 aee910c1f8 fix: fixed variable inputs
Server Deploy / deploy (push) Successful in 1m22s
2026-07-20 18:00:47 +01:00
+24 -1
View File
@@ -2,6 +2,7 @@ package services
import (
"fmt"
"os"
"strings"
"time"
@@ -188,9 +189,19 @@ func runServer(runID string, srvIdx int, steps []models.ResolvedStep, serverID s
for k, v := range secretVals {
allSecrets[k] = v
}
// Input values may template earlier step outputs and secrets, e.g.
// URL="http://example.com/$VersionNumber". Expand against runEnv (outputs
// threaded from prior steps) and this step's secrets before dispatch.
subst := map[string]string{}
for k, v := range runEnv {
subst[k] = v
}
for k, v := range secretVals {
subst[k] = v
}
cmdEnv := map[string]string{}
for k, v := range step.Inputs {
cmdEnv[k] = v
cmdEnv[k] = expandVars(v, subst)
}
for k, v := range runEnv {
cmdEnv[k] = v
@@ -310,6 +321,18 @@ func dispatchAndWait(serverID, commandID string, cmd *pb.RunStepCmd) *pb.StepRes
}
}
// expandVars substitutes $VAR and ${VAR} references in an input value from the
// given lookup (prior step outputs and secrets). Unknown references expand to
// empty, matching shell behaviour; a literal "$" is written as "$$".
func expandVars(v string, lookup map[string]string) string {
return os.Expand(v, func(name string) string {
if name == "$" {
return "$"
}
return lookup[name]
})
}
func resolveSecrets(refs []string) map[string]string {
out := map[string]string{}
for _, ref := range refs {