diff --git a/go.mod b/go.mod index 8e2077ae4..04d03a801 100644 --- a/go.mod +++ b/go.mod @@ -31,6 +31,7 @@ require ( github.com/golang-jwt/jwt/v5 v5.2.1 github.com/google/go-github/v68 v68.0.0 github.com/google/tink/go v1.7.0 + github.com/google/uuid v1.6.0 github.com/gorilla/securecookie v1.1.2 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-plugin v1.6.2 @@ -131,7 +132,6 @@ require ( github.com/google/go-cmp v0.6.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/hashicorp/go-version v1.7.0 // indirect diff --git a/pipeline/backend/docker/convert.go b/pipeline/backend/docker/convert.go index b1d0fd8ca..a1b11189b 100644 --- a/pipeline/backend/docker/convert.go +++ b/pipeline/backend/docker/convert.go @@ -70,7 +70,7 @@ func (e *docker) toConfig(step *types.Step, options BackendOptions) *container.C } func toContainerName(step *types.Step, workflowName string) string { - return "wp_" + workflowName + "-" + step.Name + "-" + step.UUID[len(step.UUID)-5:] + return "wp_" + workflowName + "-" + step.Name + "-" + step.UUID } // returns a container host configuration. diff --git a/pipeline/backend/kubernetes/pod.go b/pipeline/backend/kubernetes/pod.go index 93f5f58bf..63c33d92f 100644 --- a/pipeline/backend/kubernetes/pod.go +++ b/pipeline/backend/kubernetes/pod.go @@ -77,7 +77,7 @@ func stepToPodName(step *types.Step, workflowName string) (name string, err erro } func podName(step *types.Step, workflowName string) (string, error) { - return dnsName(podPrefix + workflowName + "-" + step.Name + "-" + step.UUID[len(step.UUID)-5:]) + return dnsName(podPrefix + workflowName + "-" + step.Name + "-" + step.UUID) } func podMeta(step *types.Step, config *config, options BackendOptions, podName, workflowName string) (meta_v1.ObjectMeta, error) { diff --git a/pipeline/backend/kubernetes/service.go b/pipeline/backend/kubernetes/service.go index 1f5aad35c..668206a6a 100644 --- a/pipeline/backend/kubernetes/service.go +++ b/pipeline/backend/kubernetes/service.go @@ -63,7 +63,7 @@ func mkService(step *types.Step, config *config, workflowName string) (*v1.Servi } func serviceName(step *types.Step, workflowName string) (string, error) { - return dnsName(servicePrefix + workflowName + "-" + step.Name + "-" + step.UUID[len(step.UUID)-5:]) + return dnsName(servicePrefix + workflowName + "-" + step.Name + "-" + step.UUID) } func servicePort(port types.Port) v1.ServicePort { diff --git a/pipeline/pipeline.go b/pipeline/pipeline.go index 3bbc2ea73..e5861dac0 100644 --- a/pipeline/pipeline.go +++ b/pipeline/pipeline.go @@ -21,7 +21,7 @@ import ( "sync" "time" - "github.com/oklog/ulid/v2" + "github.com/google/uuid" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "golang.org/x/sync/errgroup" @@ -73,7 +73,7 @@ func New(spec *backend.Config, opts ...Option) *Runtime { r.Description = map[string]string{} r.spec = spec r.ctx = context.Background() - r.taskUUID = ulid.Make().String() + r.taskUUID = uuid.New().String()[:5] for _, opts := range opts { opts(r) }