use google/uuid for random 5 char string

This commit is contained in:
pat-s
2025-01-07 09:22:11 +01:00
parent 5bcb00ffc3
commit 5b6bf0e000
5 changed files with 6 additions and 6 deletions

2
go.mod
View File

@@ -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

View File

@@ -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.

View File

@@ -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) {

View File

@@ -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 {

View File

@@ -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)
}