Skip to content

Commit

Permalink
Fix Tekton depedency order within Pulumi
Browse files Browse the repository at this point in the history
  • Loading branch information
SchahinRohani committed Aug 29, 2024
1 parent 0933c1a commit ef183b6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 15 deletions.
43 changes: 31 additions & 12 deletions native-cli/components/tekton.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,28 @@ func (component *TektonPipelines) Install(

// The configuration for Tekton Triggers.
type TektonTriggers struct {
Version string
Version string
Dependencies []pulumi.Resource
}

// Install installs the Tekton Triggers release and interceptors on the cluster.
func (component *TektonTriggers) Install(
ctx *pulumi.Context,
name string,
) ([]pulumi.Resource, error) {
tektonTriggers, err := yaml.NewConfigFile(ctx, name, &yaml.ConfigFileArgs{
File: fmt.Sprintf(
"https://storage.googleapis.com/tekton-releases/triggers/previous/v%s/release.yaml",
component.Version,
tektonTriggers, err := yaml.NewConfigFile(
ctx,
name,
&yaml.ConfigFileArgs{
File: fmt.Sprintf(
"https://storage.googleapis.com/tekton-releases/triggers/previous/v%s/release.yaml",
component.Version,
),
},
pulumi.DependsOn(
component.Dependencies,
),
})
)
if err != nil {
return nil, fmt.Errorf("%w: %w", errPulumi, err)
}
Expand All @@ -91,6 +99,9 @@ func (component *TektonTriggers) Install(
component.Version,
),
},
pulumi.DependsOn(
[]pulumi.Resource{tektonTriggers},
),
)
if err != nil {
return nil, fmt.Errorf("%w: %w", errPulumi, err)
Expand All @@ -101,20 +112,28 @@ func (component *TektonTriggers) Install(

// Configuration for the Tekton Dashboard.
type TektonDashboard struct {
Version string
Version string
Dependencies []pulumi.Resource
}

// Install installs the Tekton Dashboard on the cluster.
func (component *TektonDashboard) Install(
ctx *pulumi.Context,
name string,
) ([]pulumi.Resource, error) {
tektonDashboard, err := yaml.NewConfigFile(ctx, name, &yaml.ConfigFileArgs{
File: fmt.Sprintf(
"https://storage.googleapis.com/tekton-releases/dashboard/previous/v%s/release.yaml",
component.Version,
tektonDashboard, err := yaml.NewConfigFile(
ctx,
name,
&yaml.ConfigFileArgs{
File: fmt.Sprintf(
"https://storage.googleapis.com/tekton-releases/dashboard/previous/v%s/release.yaml",
component.Version,
),
},
pulumi.DependsOn(
component.Dependencies,
),
})
)
if err != nil {
return nil, fmt.Errorf("%w: %w", errPulumi, err)
}
Expand Down
18 changes: 15 additions & 3 deletions native-cli/programs/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ func ProgramForLocalCluster(ctx *pulumi.Context) error {
tektonPipelines, err := components.AddComponent(
ctx,
"tekton-pipelines",
&components.TektonPipelines{Version: "0.58.0"},
&components.TektonPipelines{
Version: "0.58.0",
},
)
if err != nil {
log.Println(err)
Expand All @@ -81,7 +83,12 @@ func ProgramForLocalCluster(ctx *pulumi.Context) error {
tektonTriggers, err := components.AddComponent(
ctx,
"tekton-triggers",
&components.TektonTriggers{Version: "0.26.1"},
&components.TektonTriggers{
Version: "0.26.1",
Dependencies: slices.Concat(
tektonPipelines,
),
},
)
if err != nil {
log.Println(err)
Expand All @@ -91,7 +98,12 @@ func ProgramForLocalCluster(ctx *pulumi.Context) error {
components.Check(components.AddComponent(
ctx,
"tekton-dashboard",
&components.TektonDashboard{Version: "0.45.0"},
&components.TektonDashboard{
Version: "0.45.0",
Dependencies: slices.Concat(
tektonPipelines, tektonTriggers,
),
},
))

components.Check(components.AddComponent(
Expand Down

0 comments on commit ef183b6

Please sign in to comment.