mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-10-23 02:23:53 +00:00
remove workspacePath, hardcode workingDir to /woodpecker
This commit is contained in:
parent
98450c4c44
commit
3104fad983
6 changed files with 4 additions and 15 deletions
|
@ -190,17 +190,13 @@ func execWithAxis(ctx context.Context, c *cli.Command, file, repoPath string, ax
|
|||
if c.Bool("local") {
|
||||
var (
|
||||
workspaceBase = conf.Workspace.Base
|
||||
workspacePath = conf.Workspace.Path
|
||||
)
|
||||
if workspaceBase == "" {
|
||||
workspaceBase = c.String("workspace-base")
|
||||
}
|
||||
if workspacePath == "" {
|
||||
workspacePath = c.String("workspace-path")
|
||||
}
|
||||
|
||||
volumes = append(volumes, prefix+"_default:"+workspaceBase)
|
||||
volumes = append(volumes, repoPath+":"+path.Join(workspaceBase, workspacePath))
|
||||
volumes = append(volumes, repoPath+":"+path.Join(workspaceBase))
|
||||
}
|
||||
|
||||
privilegedPlugins := c.StringSlice("plugins-privileged")
|
||||
|
|
|
@ -182,8 +182,7 @@ func podContainer(step *types.Step, podName, goos string, options BackendOptions
|
|||
container := v1.Container{
|
||||
Name: podName,
|
||||
Image: step.Image,
|
||||
// WorkingDir: step.WorkingDir,
|
||||
WorkingDir: "/woodpecker",
|
||||
WorkingDir: step.WorkingDir,
|
||||
Ports: containerPorts(step.Ports),
|
||||
SecurityContext: containerSecurityContext(options.SecurityContext, step.Privileged),
|
||||
}
|
||||
|
|
|
@ -91,7 +91,6 @@ type Compiler struct {
|
|||
env map[string]string
|
||||
cloneEnv map[string]string
|
||||
workspaceBase string
|
||||
workspacePath string
|
||||
metadata metadata.Metadata
|
||||
registries []Registry
|
||||
secrets map[string]Secret
|
||||
|
@ -152,9 +151,6 @@ func (c *Compiler) Compile(conf *yaml_types.Workflow) (*backend_types.Config, er
|
|||
if len(conf.Workspace.Base) != 0 {
|
||||
c.workspaceBase = path.Clean(conf.Workspace.Base)
|
||||
}
|
||||
if len(conf.Workspace.Path) != 0 {
|
||||
c.workspacePath = path.Clean(conf.Workspace.Path)
|
||||
}
|
||||
|
||||
// add default clone step
|
||||
if !c.local && len(conf.Clone.ContainerList) == 0 && !conf.SkipClone && len(c.defaultClonePlugin) != 0 {
|
||||
|
|
|
@ -90,7 +90,7 @@ func (c *Compiler) createProcess(container *yaml_types.Container, stepType backe
|
|||
environment := map[string]string{}
|
||||
maps.Copy(environment, c.env)
|
||||
|
||||
environment["CI_WORKSPACE"] = path.Join(workspaceBase, c.workspacePath)
|
||||
environment["CI_WORKSPACE"] = path.Join(workspaceBase)
|
||||
|
||||
if stepType == backend_types.StepTypeService || container.Detached {
|
||||
detached = true
|
||||
|
@ -207,7 +207,7 @@ func (c *Compiler) stepWorkingDir(container *yaml_types.Container) string {
|
|||
if container.IsPlugin() {
|
||||
base = pluginWorkspaceBase
|
||||
}
|
||||
return path.Join(base, c.workspacePath, container.Directory)
|
||||
return path.Join(base)
|
||||
}
|
||||
|
||||
func convertPort(portDef string) (backend_types.Port, error) {
|
||||
|
|
|
@ -98,7 +98,6 @@ func WithNetrc(username, password, machine string) Option {
|
|||
func WithWorkspace(base, path string) Option {
|
||||
return func(compiler *Compiler) {
|
||||
compiler.workspaceBase = base
|
||||
compiler.workspacePath = path
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ func TestWithWorkspace(t *testing.T) {
|
|||
),
|
||||
)
|
||||
assert.Equal(t, "/pipeline", compiler.workspaceBase)
|
||||
assert.Equal(t, "src/github.com/octocat/hello-world", compiler.workspacePath)
|
||||
}
|
||||
|
||||
func TestWithEscalated(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue