Skip to content

Commit

Permalink
fix: add task-<num> to reserved aliases
Browse files Browse the repository at this point in the history
Signed-off-by: Hidde Beydals <[email protected]>
  • Loading branch information
hiddeco committed Dec 17, 2024
1 parent 0ce85c7 commit 842fd81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion internal/directives/promotions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/akuity/kargo/internal/controller/freight"
"github.com/akuity/kargo/internal/credentials"
"github.com/akuity/kargo/internal/expressions"
"github.com/akuity/kargo/internal/kargo"
)

// PromotionStepRunner is an interface for components that implement the logic for
Expand Down Expand Up @@ -472,7 +473,7 @@ func getChartFunc(
// The namespace part is the part before the first "::" separator. Typically,
// this is used for steps inflated from a task.
func getAliasNamespace(alias string) string {
parts := strings.Split(alias, "::")
parts := strings.Split(alias, kargo.PromotionAliasSeparator)
if len(parts) != 2 {
return ""
}
Expand Down
2 changes: 1 addition & 1 deletion internal/directives/simple_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// ReservedStepAliasRegex is a regular expression that matches step aliases that
// are reserved for internal use.
var ReservedStepAliasRegex = regexp.MustCompile(`^step-\d+$`)
var ReservedStepAliasRegex = regexp.MustCompile(`^(step|task)-\d+$`)

// SimpleEngine is a simple engine that executes a list of PromotionSteps in
// sequence.
Expand Down
10 changes: 5 additions & 5 deletions internal/kargo/promotion_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import (
)

const (
// PromotionAliasSeparator is the separator used in the Promotion step alias
// to separate the task alias from the step alias.
PromotionAliasSeparator = "::"

// nameSeparator is the separator used in the Promotion name.
nameSeparator = "."

// aliasSeparator is the separator used in the Promotion step alias
// to separate the task alias from the step alias.
aliasSeparator = "::"

// ulidLength is the length of the ULID string.
ulidLength = ulid.EncodedSize

Expand Down Expand Up @@ -217,7 +217,7 @@ func generatePromotionName(stageName, freight string) string {
// generatePromotionTaskStepAlias generates an alias for a PromotionTask step
// by combining the task alias and the step alias.
func generatePromotionTaskStepAlias(taskAlias, stepAlias string) string {
return fmt.Sprintf("%s%s%s", taskAlias, aliasSeparator, stepAlias)
return fmt.Sprintf("%s%s%s", taskAlias, PromotionAliasSeparator, stepAlias)
}

// promotionTaskVarsToStepVars validates the presence of the PromotionTask
Expand Down

0 comments on commit 842fd81

Please sign in to comment.