1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-11-29 21:48:14 +02:00

Renamed procs/jobs to steps in code (#1331)

Renamed `procs` to `steps` in code for the issue #1288

Co-authored-by: Harikesh Prajapati <harikesh.prajapati@druva.com>
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
Harikesh00
2022-10-28 21:08:53 +05:30
committed by GitHub
parent b44e895017
commit 36e42914fa
109 changed files with 1474 additions and 1364 deletions

View File

@@ -55,33 +55,33 @@ func (e *local) Load() error {
}
// Setup the pipeline environment.
func (e *local) Setup(ctx context.Context, proc *types.Config) error {
func (e *local) Setup(ctx context.Context, config *types.Config) error {
return nil
}
// Exec the pipeline step.
func (e *local) Exec(ctx context.Context, proc *types.Step) error {
func (e *local) Exec(ctx context.Context, step *types.Step) error {
// Get environment variables
Env := os.Environ()
for a, b := range proc.Environment {
for a, b := range step.Environment {
if a != "HOME" && a != "SHELL" { // Don't override $HOME and $SHELL
Env = append(Env, a+"="+b)
}
}
Command := []string{}
if proc.Image == constant.DefaultCloneImage {
if step.Image == constant.DefaultCloneImage {
// Default clone step
Env = append(Env, "CI_WORKSPACE="+e.workingdir+"/"+proc.Environment["CI_REPO"])
Env = append(Env, "CI_WORKSPACE="+e.workingdir+"/"+step.Environment["CI_REPO"])
Command = append(Command, "plugin-git")
} else {
// Use "image name" as run command
Command = append(Command, proc.Image)
Command = append(Command, step.Image)
Command = append(Command, "-c")
// Decode script and delete initial lines
// Deleting the initial lines removes netrc support but adds compatibility for more shells like fish
Script, _ := base64.RawStdEncoding.DecodeString(proc.Environment["CI_SCRIPT"])
Script, _ := base64.RawStdEncoding.DecodeString(step.Environment["CI_SCRIPT"])
Command = append(Command, string(Script)[strings.Index(string(Script), "\n\n")+2:])
}
@@ -90,10 +90,10 @@ func (e *local) Exec(ctx context.Context, proc *types.Step) error {
e.cmd.Env = Env
// Prepare working directory
if proc.Image == constant.DefaultCloneImage {
e.cmd.Dir = e.workingdir + "/" + proc.Environment["CI_REPO_OWNER"]
if step.Image == constant.DefaultCloneImage {
e.cmd.Dir = e.workingdir + "/" + step.Environment["CI_REPO_OWNER"]
} else {
e.cmd.Dir = e.workingdir + "/" + proc.Environment["CI_REPO"]
e.cmd.Dir = e.workingdir + "/" + step.Environment["CI_REPO"]
}
err := os.MkdirAll(e.cmd.Dir, 0o700)
if err != nil {