mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-17 17:45:03 +02: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)
|
||||
return rmCmd, os.WriteFile(file, []byte(fmt.Sprintf(
|
||||
netrcFile,
|
||||
step.Environment["CI_NETRC_MACHINE"],
|
||||
step.Environment["CI_NETRC_USERNAME"],
|
||||
step.Environment["CI_NETRC_PASSWORD"],
|
||||
)), 0o600)
|
||||
return rmCmd, os.WriteFile(file, []byte(genNetRC(step.Environment)), 0o600)
|
||||
}
|
||||
|
||||
// downloadLatestGitPluginBinary download the latest plugin-git binary based on runtime OS and Arch
|
||||
|
@ -14,7 +14,10 @@
|
||||
|
||||
package local
|
||||
|
||||
import "errors"
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// notAllowedEnvVarOverwrites are all env vars that can not be overwritten by step config
|
||||
var notAllowedEnvVarOverwrites = []string{
|
||||
@ -36,3 +39,12 @@ machine %s
|
||||
login %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
|
||||
env = append(env, "HOME="+state.homeDir)
|
||||
env = append(env, "USERPROFILE="+state.homeDir)
|
||||
|
||||
switch step.Type {
|
||||
case types.StepTypeClone:
|
||||
|
Loading…
x
Reference in New Issue
Block a user