1
0
Fork 0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-04-27 05:54:44 +00:00

Revert "Use existing WorkingDir for clone steps ()" ()

This commit is contained in:
Robert Kaussow 2025-04-02 09:21:26 +02:00 committed by GitHub
parent 807fa4289a
commit b4020072b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 27 deletions
.markdownlint.yaml
docs
pipeline/frontend/yaml/compiler

View file

@ -56,6 +56,8 @@ MD013:
tables: false
# Include headings
headings: true
# Include headings
headers: true
# Strict length checking
strict: false
# Stern length checking
@ -71,7 +73,7 @@ MD022:
# MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content
MD024:
# Only check sibling headings
siblings_only: true
allow_different_nesting: true
# MD025/single-title/single-h1 - Multiple top-level headings in the same document
MD025:

View file

@ -646,13 +646,9 @@ For more details and examples check the [Advanced usage docs](./90-advanced-usag
## `clone`
Woodpecker automatically configures a default clone step if it is not explicitly defined. If you are using the `local` backend, the [plugin-git](https://github.com/woodpecker-ci/plugin-git) binary must be in your `$PATH` for the default clone step to work. If this is not the case, you can still write a manual clone step.
Woodpecker automatically configures a default clone step if not explicitly defined. When using the `local` backend, the [plugin-git](https://github.com/woodpecker-ci/plugin-git) binary must be on your `$PATH` for the default clone step to work. If not, you can still write a manual clone step.
:::info
Clone step containers use `/woodpecker` as the working directory. It is recommended that clone plugins do not rely on the working directory and use absolute paths instead.
:::
You can manually configure the clone step in your workflow to customize it:
You can manually configure the clone step in your workflow for customization:
```diff
+clone:
@ -667,7 +663,7 @@ You can manually configure the clone step in your workflow to customize it:
- go test
```
Example configuration to override the depth:
Example configuration to override depth:
```diff
clone:
@ -688,7 +684,7 @@ Example configuration to use a custom clone plugin:
### Git Submodules
To use the credentials used to clone the repository to clone its submodules, update `.gitmodules` to use `https` instead of `git`:
To use the credentials that cloned the repository to clone it's submodules, update `.gitmodules` to use `https` instead of `git`:
```diff
[submodule "my-module"]
@ -714,10 +710,6 @@ steps:
## `skip_clone`
:::warning
The default clone step is executed as `root` to ensure that the workspace directory can be accessed by any user (`0777`). This is necessary to allow rootless step containers to write to the workspace directory. If a rootless step container is used with `skip_clone`, the user must ensure a suitable workspace directory that can be accessed by the unprivileged container use, e.g. `/tmp`.
:::
By default Woodpecker is automatically adding a clone step. This clone step can be configured by the [clone](#clone) property. If you do not need a `clone` step at all you can skip it using:
```yaml

View file

@ -4,14 +4,6 @@ To enhance the usability of Woodpecker and meet evolving security standards, occ
## `next`
### User-facing migrations
#### Clone plugin working directory
- Clone plugins now use `/woodpecker` as working directory instead of `/woodpecker/<workspacePath>/<directory>`. If you use the default clone plugin, you do not need to make any changes. If you use a custom clone plugin, please ensure the plugin uses absolute paths and don't rely on the working directory.
#### Miscellaneous
- (Kubernetes) Deprecated `step` label on pod in favor of new namespaced label `woodpecker-ci.org/step`. The `step` label will be removed in a future update.
## 3.0.0

View file

@ -96,7 +96,7 @@ func TestCompilerCompile(t *testing.T) {
OnSuccess: true,
Failure: "fail",
Volumes: []string{defaultVolume.Name + ":/woodpecker"},
WorkingDir: "/woodpecker",
WorkingDir: "/woodpecker/src/github.com/octocat/hello-world",
WorkspaceBase: "/woodpecker",
Networks: []backend_types.Conn{{Name: "test_default", Aliases: []string{"clone"}}},
ExtraHosts: []backend_types.HostAlias{},

View file

@ -96,7 +96,7 @@ func (c *Compiler) createProcess(container *yaml_types.Container, workflow *yaml
detached = true
}
workingDir = c.stepWorkingDir(container, stepType)
workingDir = c.stepWorkingDir(container)
getSecretValue := func(name string) (string, error) {
name = strings.ToLower(name)
@ -185,7 +185,7 @@ func (c *Compiler) createProcess(container *yaml_types.Container, workflow *yaml
}, nil
}
func (c *Compiler) stepWorkingDir(container *yaml_types.Container, stepType backend_types.StepType) string {
func (c *Compiler) stepWorkingDir(container *yaml_types.Container) string {
if path.IsAbs(container.Directory) {
return container.Directory
}
@ -193,9 +193,6 @@ func (c *Compiler) stepWorkingDir(container *yaml_types.Container, stepType back
if container.IsPlugin() {
base = pluginWorkspaceBase
}
if stepType == backend_types.StepTypeClone {
return base
}
return path.Join(base, c.workspacePath, container.Directory)
}