Skip to content

Commit

Permalink
Check for CI variable when determining whether to foreground processe… (
Browse files Browse the repository at this point in the history
#308)

* Check for CI environment variable when determining whether to foreground processes and ignore the value of DETACH_PROXY if we're in CI
* Add check for PIPELINE_WORKSPACE environment variable for AzureDevOps

Signed-off-by: Thomas D. Spear <[email protected]>
  • Loading branch information
tspearconquest authored Dec 26, 2024
1 parent f78d415 commit a48603f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const (

archEnvName = "ARCH"
autoInstallEnvName = "AUTO_INSTALL"
PipelineWsEnvName = "PIPELINE_WORKSPACE"
CiEnvName = "CI"
DefaultConstraint = "DEFAULT_CONSTRAINT"
DefaultVersion = "DEFAULT_" + Version
forceRemoteEnvName = "FORCE_REMOTE"
Expand Down
12 changes: 11 additions & 1 deletion versionmanager/proxy/detach/detached_others.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,24 @@ import (
configutils "github.com/tofuutils/tenv/v4/config/utils"
)

const msgCiErr = "Failed to read " + config.CiEnvName + " environment variable, disable behavior :"
const msgErr = "Failed to read " + config.TenvDetachedProxyEnvName + " environment variable, disable behavior :"
const msgPipelineWsErr = "Failed to read " + config.PipelineWsEnvName + " environment variable, disable behavior :"

func InitBehaviorFromEnv(cmd *exec.Cmd, getenv configutils.GetenvFunc) {
ciEnv, ciErr := getenv.Bool(false, config.CiEnvName)
if ciErr != nil {
fmt.Println(msgCiErr, ciErr) //nolint
}
detached, err := getenv.Bool(true, config.TenvDetachedProxyEnvName)
if err != nil {
fmt.Println(msgErr, err) //nolint
}
if !detached {
pipelineWsEnv, pipelineWsErr := getenv.Bool(false, config.PipelineWsEnvName)
if pipelineWsErr != nil {
fmt.Println(msgPipelineWsErr, pipelineWsErr) //nolint
}
if ciEnv || pipelineWsEnv || !detached {
return
}

Expand Down

0 comments on commit a48603f

Please sign in to comment.