mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-08-24 20:29:12 +00:00
local backend set home variable windows-equivalent too (#2323)
This commit is contained in:
parent
dd335f43f7
commit
8629a418f8
@ -130,12 +130,7 @@ func writeNetRC(step *types.Step, state *workflowState) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Trace().Msgf("try to write netrc to '%s'", file)
|
log.Trace().Msgf("try to write netrc to '%s'", file)
|
||||||
return rmCmd, os.WriteFile(file, []byte(fmt.Sprintf(
|
return rmCmd, os.WriteFile(file, []byte(genNetRC(step.Environment)), 0o600)
|
||||||
netrcFile,
|
|
||||||
step.Environment["CI_NETRC_MACHINE"],
|
|
||||||
step.Environment["CI_NETRC_USERNAME"],
|
|
||||||
step.Environment["CI_NETRC_PASSWORD"],
|
|
||||||
)), 0o600)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// downloadLatestGitPluginBinary download the latest plugin-git binary based on runtime OS and Arch
|
// downloadLatestGitPluginBinary download the latest plugin-git binary based on runtime OS and Arch
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
|
|
||||||
package local
|
package local
|
||||||
|
|
||||||
import "errors"
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
// notAllowedEnvVarOverwrites are all env vars that can not be overwritten by step config
|
// notAllowedEnvVarOverwrites are all env vars that can not be overwritten by step config
|
||||||
var notAllowedEnvVarOverwrites = []string{
|
var notAllowedEnvVarOverwrites = []string{
|
||||||
@ -36,3 +39,12 @@ machine %s
|
|||||||
login %s
|
login %s
|
||||||
password %s
|
password %s
|
||||||
`
|
`
|
||||||
|
|
||||||
|
func genNetRC(env map[string]string) string {
|
||||||
|
return fmt.Sprintf(
|
||||||
|
netrcFile,
|
||||||
|
env["CI_NETRC_MACHINE"],
|
||||||
|
env["CI_NETRC_USERNAME"],
|
||||||
|
env["CI_NETRC_PASSWORD"],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -114,6 +114,7 @@ func (e *local) StartStep(ctx context.Context, step *types.Step, taskUUID string
|
|||||||
|
|
||||||
// Set HOME
|
// Set HOME
|
||||||
env = append(env, "HOME="+state.homeDir)
|
env = append(env, "HOME="+state.homeDir)
|
||||||
|
env = append(env, "USERPROFILE="+state.homeDir)
|
||||||
|
|
||||||
switch step.Type {
|
switch step.Type {
|
||||||
case types.StepTypeClone:
|
case types.StepTypeClone:
|
||||||
|
Loading…
Reference in New Issue
Block a user