1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2026-06-03 16:35:37 +02:00

Kubernetes: detached steps are no services (#6435)

This commit is contained in:
6543
2026-04-15 15:29:01 +02:00
committed by GitHub
parent bb4682acc5
commit e173bed3f1
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -56,8 +56,8 @@ func TestStepToPodName(t *testing.T) {
name, err = stepToPodName(&types.Step{UUID: "01he8bebctabr3kg", Name: "postgres", Type: types.StepTypeService, Ports: []types.Port{{Number: 5432}}})
assert.NoError(t, err)
assert.EqualValues(t, "wp-svc-01he8bebctabr3kg-postgres", name)
// Detached service
name, err = stepToPodName(&types.Step{UUID: "01he8bebctabr3kg", Name: "postgres", Detached: true, Ports: []types.Port{{Number: 5432}}})
// Service
name, err = stepToPodName(&types.Step{UUID: "01he8bebctabr3kg", Name: "postgres", Detached: true, Type: types.StepTypeService, Ports: []types.Port{{Number: 5432}}})
assert.NoError(t, err)
assert.EqualValues(t, "wp-svc-01he8bebctabr3kg-postgres", name)
// Detached long running container
@@ -82,11 +82,12 @@ func TestPodMeta(t *testing.T) {
assert.EqualValues(t, "wp-svc-01he8bebctabr3kg-postgres", meta.Labels[ServiceLabel])
assert.EqualValues(t, taskUUID, meta.Labels[TaskUUIDLabel])
// Detached service
// Service
meta, err = podMeta(&types.Step{
Name: "postgres",
UUID: "01he8bebctabr3kg",
Detached: true,
Type: types.StepTypeService,
Image: "postgres:16",
WorkingDir: "/woodpecker/src",
Environment: map[string]string{"CI": "woodpecker"},
+1 -1
View File
@@ -60,7 +60,7 @@ func serviceName(step *types.Step) (string, error) {
}
func isService(step *types.Step) bool {
return step.Type == types.StepTypeService || (step.Detached && dnsPattern.FindStringIndex(step.Name) != nil)
return step.Type == types.StepTypeService
}
func subdomain(taskUUID string) (string, error) {