mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-02-13 21:00:00 +00:00
Revert "Send configuration as part of the request for external configuration" (#5835)
Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
@@ -42,10 +42,6 @@ class Request {
|
|||||||
repo: Repo;
|
repo: Repo;
|
||||||
pipeline: Pipeline;
|
pipeline: Pipeline;
|
||||||
netrc: Netrc;
|
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)
|
- [netrc model](https://github.com/woodpecker-ci/woodpecker/blob/main/server/model/netrc.go)
|
||||||
|
|
||||||
:::tip
|
:::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:
|
Example request:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
// Please check the latest structure in the models mentioned above.
|
||||||
|
// This example is likely outdated.
|
||||||
|
|
||||||
{
|
{
|
||||||
"repo": {
|
"repo": {
|
||||||
"id": 100,
|
"id": 100,
|
||||||
@@ -123,12 +122,12 @@ Example request:
|
|||||||
"updated_at": 0,
|
"updated_at": 0,
|
||||||
"verified": false
|
"verified": false
|
||||||
},
|
},
|
||||||
"configs": [
|
"netrc": {
|
||||||
{
|
"machine": "myforge.com",
|
||||||
"name": ".woodpecker.yaml",
|
"login": "myUser",
|
||||||
"data": "steps:\n - name: backend\n image: alpine\n commands:\n - echo \"Hello there from Repo (.woodpecker.yaml)\"\n"
|
"password": "myPassword",
|
||||||
}
|
"type": "forge"
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -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))
|
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
|
- Webhook signatures now use the `rfc9421` protocol
|
||||||
|
- Replaced `configs` object by `netrc` in external configuration APIs
|
||||||
|
|
||||||
- Git is now the only officially supported SCM.
|
- 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.
|
No others were supported previously, but the existence of the env var `CI_REPO_SCM` indicated that others might be.
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ class Request {
|
|||||||
repo: Repo;
|
repo: Repo;
|
||||||
pipeline: Pipeline;
|
pipeline: Pipeline;
|
||||||
netrc: Netrc;
|
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)
|
- [netrc model](https://github.com/woodpecker-ci/woodpecker/blob/main/server/model/netrc.go)
|
||||||
|
|
||||||
:::tip
|
:::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:
|
Example request:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
// Please check the latest structure in the models mentioned above.
|
||||||
|
// This example is likely outdated.
|
||||||
|
|
||||||
{
|
{
|
||||||
"repo": {
|
"repo": {
|
||||||
"id": 100,
|
"id": 100,
|
||||||
@@ -123,12 +122,12 @@ Example request:
|
|||||||
"updated_at": 0,
|
"updated_at": 0,
|
||||||
"verified": false
|
"verified": false
|
||||||
},
|
},
|
||||||
"configs": [
|
"netrc": {
|
||||||
{
|
"machine": "myforge.com",
|
||||||
"name": ".woodpecker.yaml",
|
"login": "myUser",
|
||||||
"data": "steps:\n - name: backend\n image: alpine\n commands:\n - echo \"Hello there from Repo (.woodpecker.yaml)\"\n"
|
"password": "myPassword",
|
||||||
}
|
"type": "forge"
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -37,10 +37,9 @@ type configData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type requestStructure struct {
|
type requestStructure struct {
|
||||||
Repo *model.Repo `json:"repo"`
|
Repo *model.Repo `json:"repo"`
|
||||||
Pipeline *model.Pipeline `json:"pipeline"`
|
Pipeline *model.Pipeline `json:"pipeline"`
|
||||||
Netrc *model.Netrc `json:"netrc"`
|
Netrc *model.Netrc `json:"netrc"`
|
||||||
Configuration []*configData `json:"configuration"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type responseStructure struct {
|
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)
|
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)
|
response := new(responseStructure)
|
||||||
body := requestStructure{
|
body := requestStructure{
|
||||||
Repo: repo,
|
Repo: repo,
|
||||||
Pipeline: pipeline,
|
Pipeline: pipeline,
|
||||||
Netrc: netrc,
|
Netrc: netrc,
|
||||||
Configuration: configuration,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status, err := h.client.Send(ctx, net_http.MethodPost, h.endpoint, body, response)
|
status, err := h.client.Send(ctx, net_http.MethodPost, h.endpoint, body, response)
|
||||||
|
|||||||
Reference in New Issue
Block a user