diff --git a/internal/directives/promotions.go b/internal/directives/promotions.go index dc26adaf0..fda35fe12 100644 --- a/internal/directives/promotions.go +++ b/internal/directives/promotions.go @@ -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 @@ -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 "" } diff --git a/internal/directives/simple_engine.go b/internal/directives/simple_engine.go index b56a0871f..80c58862a 100644 --- a/internal/directives/simple_engine.go +++ b/internal/directives/simple_engine.go @@ -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. diff --git a/internal/kargo/promotion_builder.go b/internal/kargo/promotion_builder.go index ff3386fc4..3513b42c0 100644 --- a/internal/kargo/promotion_builder.go +++ b/internal/kargo/promotion_builder.go @@ -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 @@ -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