Merge pull request #62 from mercedes-benz/fix-shortid
fix: shortid generates correctly now
This commit is contained in:
commit
4f2808eb23
1 changed files with 6 additions and 4 deletions
|
|
@ -32,6 +32,7 @@ import (
|
|||
providerCommon "garm/runner/providers/common"
|
||||
|
||||
"github.com/google/go-github/v48/github"
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/teris-io/shortid"
|
||||
)
|
||||
|
|
@ -388,9 +389,6 @@ func (r *basePoolManager) acquireNewInstance(job params.WorkflowJob) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// use own alphabet to avoid '-' and '_' in the shortid
|
||||
const shortidABC = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
func (r *basePoolManager) AddRunner(ctx context.Context, poolID string) error {
|
||||
pool, err := r.helper.GetPoolByID(poolID)
|
||||
if err != nil {
|
||||
|
|
@ -401,7 +399,11 @@ func (r *basePoolManager) AddRunner(ctx context.Context, poolID string) error {
|
|||
if prefix == "" {
|
||||
prefix = params.DefaultRunnerPrefix
|
||||
}
|
||||
name := fmt.Sprintf("%s-%s", prefix, shortid.MustNew(0, shortidABC, 42).String())
|
||||
suffix, err := shortid.Generate()
|
||||
if err != nil {
|
||||
suffix = uuid.New().String()
|
||||
}
|
||||
name := fmt.Sprintf("%s-%s", prefix, suffix)
|
||||
|
||||
createParams := params.CreateInstanceParams{
|
||||
Name: name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue