Revert "Send configuration as part of the request for external configuration" (#5835)

Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
Anbraten
2026-01-14 11:36:44 +01:00
committed by GitHub
parent 62568f59f8
commit ecb96f3bc2
4 changed files with 27 additions and 35 deletions

View File

@@ -42,10 +42,6 @@ class Request {
repo: Repo;
pipeline: Pipeline;
netrc: Netrc;
configuration: {
name: string; // filename of the configuration file
data: string; // content of the configuration file
}[];
}
```
@@ -56,12 +52,15 @@ Checkout the following models for more information:
- [netrc model](https://github.com/woodpecker-ci/woodpecker/blob/main/server/model/netrc.go)
:::tip
The `netrc` data is pretty powerful as it contains credentials to access the repository. You can use this to clone the repository or even use the forge (Github or Gitlab, ...) API to get more information about the repository.
The `netrc` data is pretty powerful as it contains credentials to access the repository. You can use this to fetch files or other information (like changed files, issues) from the repository using the forge api or even clone the repository.
:::
Example request:
```json
// Please check the latest structure in the models mentioned above.
// This example is likely outdated.
{
"repo": {
"id": 100,
@@ -123,12 +122,12 @@ Example request:
"updated_at": 0,
"verified": false
},
"configs": [
{
"name": ".woodpecker.yaml",
"data": "steps:\n - name: backend\n image: alpine\n commands:\n - echo \"Hello there from Repo (.woodpecker.yaml)\"\n"
}
]
"netrc": {
"machine": "myforge.com",
"login": "myUser",
"password": "myPassword",
"type": "forge"
}
}
```

View File

@@ -187,6 +187,7 @@ The Webhook tokens have been changed for enhanced security and therefore existin
Image pull secrets must now be set explicitly via env var `WOODPECKER_BACKEND_K8S_PULL_SECRET_NAMES` ([#4005](https://github.com/woodpecker-ci/woodpecker/pull/4005))
- Webhook signatures now use the `rfc9421` protocol
- Replaced `configs` object by `netrc` in external configuration APIs
- Git is now the only officially supported SCM.
No others were supported previously, but the existence of the env var `CI_REPO_SCM` indicated that others might be.

View File

@@ -42,10 +42,6 @@ class Request {
repo: Repo;
pipeline: Pipeline;
netrc: Netrc;
configuration: {
name: string; // filename of the configuration file
data: string; // content of the configuration file
}[];
}
```
@@ -56,12 +52,15 @@ Checkout the following models for more information:
- [netrc model](https://github.com/woodpecker-ci/woodpecker/blob/main/server/model/netrc.go)
:::tip
The `netrc` data is pretty powerful as it contains credentials to access the repository. You can use this to clone the repository or even use the forge (Github or Gitlab, ...) API to get more information about the repository.
The `netrc` data is pretty powerful as it contains credentials to access the repository. You can use this to fetch files or other information (like changed files, issues) from the repository using the forge api or even clone the repository.
:::
Example request:
```json
// Please check the latest structure in the models mentioned above.
// This example is likely outdated.
{
"repo": {
"id": 100,
@@ -123,12 +122,12 @@ Example request:
"updated_at": 0,
"verified": false
},
"configs": [
{
"name": ".woodpecker.yaml",
"data": "steps:\n - name: backend\n image: alpine\n commands:\n - echo \"Hello there from Repo (.woodpecker.yaml)\"\n"
}
]
"netrc": {
"machine": "myforge.com",
"login": "myUser",
"password": "myPassword",
"type": "forge"
}
}
```

View File

@@ -37,10 +37,9 @@ type configData struct {
}
type requestStructure struct {
Repo *model.Repo `json:"repo"`
Pipeline *model.Pipeline `json:"pipeline"`
Netrc *model.Netrc `json:"netrc"`
Configuration []*configData `json:"configuration"`
Repo *model.Repo `json:"repo"`
Pipeline *model.Pipeline `json:"pipeline"`
Netrc *model.Netrc `json:"netrc"`
}
type responseStructure struct {
@@ -57,17 +56,11 @@ func (h *http) Fetch(ctx context.Context, forge forge.Forge, user *model.User, r
return nil, fmt.Errorf("could not get Netrc data from forge: %w", err)
}
configuration := make([]*configData, len(oldConfigData))
for i, oldConfig := range oldConfigData {
configuration[i] = &configData{Name: oldConfig.Name, Data: string(oldConfig.Data)}
}
response := new(responseStructure)
body := requestStructure{
Repo: repo,
Pipeline: pipeline,
Netrc: netrc,
Configuration: configuration,
Repo: repo,
Pipeline: pipeline,
Netrc: netrc,
}
status, err := h.client.Send(ctx, net_http.MethodPost, h.endpoint, body, response)