mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-03-27 14:52:48 +00:00
parent
cfbb3ecf68
commit
00aa968afa
6 changed files with 9 additions and 40 deletions
|
@ -4,7 +4,7 @@ To enhance the usability of Woodpecker and meet evolving security standards, occ
|
||||||
|
|
||||||
## `next`
|
## `next`
|
||||||
|
|
||||||
- (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.
|
- No changes
|
||||||
|
|
||||||
## 3.0.0
|
## 3.0.0
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// StepLabelLegacy is the legacy label name from before the introduction of the woodpecker-ci.org namespace.
|
StepLabel = "step"
|
||||||
// This will be removed in the future.
|
podPrefix = "wp-"
|
||||||
StepLabelLegacy = "step"
|
defaultFSGroup int64 = 1000
|
||||||
StepLabel = "woodpecker-ci.org/step"
|
|
||||||
podPrefix = "wp-"
|
|
||||||
defaultFSGroup int64 = 1000
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func mkPod(step *types.Step, config *config, podName, goos string, options BackendOptions) (*v1.Pod, error) {
|
func mkPod(step *types.Step, config *config, podName, goos string, options BackendOptions) (*v1.Pod, error) {
|
||||||
|
@ -118,10 +115,6 @@ func podLabels(step *types.Step, config *config, options BackendOptions) (map[st
|
||||||
if step.Type == types.StepTypeService {
|
if step.Type == types.StepTypeService {
|
||||||
labels[ServiceLabel], _ = serviceName(step)
|
labels[ServiceLabel], _ = serviceName(step)
|
||||||
}
|
}
|
||||||
labels[StepLabelLegacy], err = stepLabel(step)
|
|
||||||
if err != nil {
|
|
||||||
return labels, err
|
|
||||||
}
|
|
||||||
labels[StepLabel], err = stepLabel(step)
|
labels[StepLabel], err = stepLabel(step)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return labels, err
|
return labels, err
|
||||||
|
|
|
@ -72,8 +72,7 @@ func TestTinyPod(t *testing.T) {
|
||||||
"namespace": "woodpecker",
|
"namespace": "woodpecker",
|
||||||
"creationTimestamp": null,
|
"creationTimestamp": null,
|
||||||
"labels": {
|
"labels": {
|
||||||
"step": "build-via-gradle",
|
"step": "build-via-gradle"
|
||||||
"woodpecker-ci.org/step": "build-via-gradle"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"spec": {
|
"spec": {
|
||||||
|
@ -154,8 +153,7 @@ func TestFullPod(t *testing.T) {
|
||||||
"labels": {
|
"labels": {
|
||||||
"app": "test",
|
"app": "test",
|
||||||
"part-of": "woodpecker-ci",
|
"part-of": "woodpecker-ci",
|
||||||
"step": "go-test",
|
"step": "go-test"
|
||||||
"woodpecker-ci.org/step": "go-test"
|
|
||||||
},
|
},
|
||||||
"annotations": {
|
"annotations": {
|
||||||
"apps.kubernetes.io/pod-index": "0",
|
"apps.kubernetes.io/pod-index": "0",
|
||||||
|
@ -449,8 +447,7 @@ func TestScratchPod(t *testing.T) {
|
||||||
"namespace": "woodpecker",
|
"namespace": "woodpecker",
|
||||||
"creationTimestamp": null,
|
"creationTimestamp": null,
|
||||||
"labels": {
|
"labels": {
|
||||||
"step": "curl-google",
|
"step": "curl-google"
|
||||||
"woodpecker-ci.org/step": "curl-google"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"spec": {
|
"spec": {
|
||||||
|
@ -495,8 +492,7 @@ func TestSecrets(t *testing.T) {
|
||||||
"namespace": "woodpecker",
|
"namespace": "woodpecker",
|
||||||
"creationTimestamp": null,
|
"creationTimestamp": null,
|
||||||
"labels": {
|
"labels": {
|
||||||
"step": "test-secrets",
|
"step": "test-secrets"
|
||||||
"woodpecker-ci.org/step": "test-secrets"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"spec": {
|
"spec": {
|
||||||
|
|
|
@ -258,10 +258,6 @@ func registrySecretLabels(step *types.Step) (map[string]string, error) {
|
||||||
if step.Type == types.StepTypeService {
|
if step.Type == types.StepTypeService {
|
||||||
labels[ServiceLabel], _ = serviceName(step)
|
labels[ServiceLabel], _ = serviceName(step)
|
||||||
}
|
}
|
||||||
labels[StepLabelLegacy], err = stepLabel(step)
|
|
||||||
if err != nil {
|
|
||||||
return labels, err
|
|
||||||
}
|
|
||||||
labels[StepLabel], err = stepLabel(step)
|
labels[StepLabel], err = stepLabel(step)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return labels, err
|
return labels, err
|
||||||
|
|
|
@ -212,8 +212,7 @@ func TestRegistrySecret(t *testing.T) {
|
||||||
"namespace": "woodpecker",
|
"namespace": "woodpecker",
|
||||||
"creationTimestamp": null,
|
"creationTimestamp": null,
|
||||||
"labels": {
|
"labels": {
|
||||||
"step": "go-test",
|
"step": "go-test"
|
||||||
"woodpecker-ci.org/step": "go-test"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type": "kubernetes.io/dockerconfigjson",
|
"type": "kubernetes.io/dockerconfigjson",
|
||||||
|
|
|
@ -19,7 +19,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"maps"
|
"maps"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/oklog/ulid/v2"
|
"github.com/oklog/ulid/v2"
|
||||||
|
@ -195,20 +194,6 @@ func (b *StepBuilder) genItemForWorkflow(workflow *model.Workflow, axis matrix.A
|
||||||
maps.Copy(item.Labels, b.DefaultLabels)
|
maps.Copy(item.Labels, b.DefaultLabels)
|
||||||
}
|
}
|
||||||
|
|
||||||
// "woodpecker-ci.org" namespace is reserved for internal use
|
|
||||||
for key := range item.Labels {
|
|
||||||
if strings.HasPrefix(key, "woodpecker-ci.org") {
|
|
||||||
log.Debug().Str("forge", b.Forge.Name()).Str("repo", b.Repo.FullName).Str("label", key).Msg("dropped pipeline label with reserved prefix woodpecker-ci.org")
|
|
||||||
delete(item.Labels, key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
item.Labels["woodpecker-ci.org/forge-id"] = b.Forge.Name()
|
|
||||||
item.Labels["woodpecker-ci.org/repo-forge-id"] = string(b.Repo.ForgeRemoteID)
|
|
||||||
item.Labels["woodpecker-ci.org/repo-id"] = strconv.FormatInt(b.Repo.ID, 10)
|
|
||||||
item.Labels["woodpecker-ci.org/repo-name"] = b.Repo.Name
|
|
||||||
item.Labels["woodpecker-ci.org/branch"] = b.Repo.Branch
|
|
||||||
|
|
||||||
return item, errorsAndWarnings
|
return item, errorsAndWarnings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue