You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-29 21:48:14 +02:00
Move value of default clone image into shared constant package (#873)
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/pipeline/backend/types"
|
||||
"github.com/woodpecker-ci/woodpecker/server"
|
||||
"github.com/woodpecker-ci/woodpecker/shared/constant"
|
||||
)
|
||||
|
||||
type local struct {
|
||||
@@ -56,13 +56,7 @@ func (e *local) Exec(ctx context.Context, proc *types.Step) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Get default clone image
|
||||
defaultCloneImage := "docker.io/woodpeckerci/plugin-git:latest"
|
||||
if len(server.Config.Pipeline.DefaultCloneImage) > 0 {
|
||||
defaultCloneImage = server.Config.Pipeline.DefaultCloneImage
|
||||
}
|
||||
|
||||
if proc.Image == defaultCloneImage {
|
||||
if proc.Image == constant.DefaultCloneImage {
|
||||
// Default clone step
|
||||
Command = append(Command, "CI_WORKSPACE="+e.workingdir+"/"+proc.Environment["CI_REPO"])
|
||||
Command = append(Command, "plugin-git")
|
||||
@@ -81,7 +75,7 @@ func (e *local) Exec(ctx context.Context, proc *types.Step) error {
|
||||
e.cmd = exec.CommandContext(ctx, "/bin/env", Command...)
|
||||
|
||||
// Prepare working directory
|
||||
if proc.Image == defaultCloneImage {
|
||||
if proc.Image == constant.DefaultCloneImage {
|
||||
e.cmd.Dir = e.workingdir + "/" + proc.Environment["CI_REPO_OWNER"]
|
||||
} else {
|
||||
e.cmd.Dir = e.workingdir + "/" + proc.Environment["CI_REPO"]
|
||||
@@ -112,6 +106,6 @@ func (e *local) Tail(context.Context, *types.Step) (io.ReadCloser, error) {
|
||||
|
||||
// Destroy the pipeline environment.
|
||||
func (e *local) Destroy(context.Context, *types.Config) error {
|
||||
os.RemoveAll(e.cmd.Dir)
|
||||
_ = os.RemoveAll(e.cmd.Dir)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user