Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fairer Task Queue: Add priority to lifecycle phases #648

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/resources/octopusdeploy_lifecycle/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@ resource "octopusdeploy_lifecycle" "example" {
name = "bar"
optional_deployment_targets = ["Environments-321"]
}

phase {
is_optional_phase = true
name = "priority phase"
is_priority_phase = true
optional_deployment_targets = ["Environments-321"]
}
}
11 changes: 11 additions & 0 deletions octopusdeploy/schema_phase.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
phase.IsOptionalPhase = v.(bool)
}

if v, ok := flattenedValues["is_priority_phase"]; ok {
phase.IsPriorityPhase = v.(bool)

Check failure on line 34 in octopusdeploy/schema_phase.go

View workflow job for this annotation

GitHub Actions / build

phase.IsPriorityPhase undefined (type *lifecycles.Phase has no field or method IsPriorityPhase)
}

if v, ok := flattenedValues["minimum_environments_before_promotion"]; ok {
if n, isInt32 := v.(int32); isInt32 {
phase.MinimumEnvironmentsBeforePromotion = n
Expand Down Expand Up @@ -91,6 +95,7 @@
flattenedPhase["automatic_deployment_targets"] = flattenArray(phase.AutomaticDeploymentTargets)
flattenedPhase["id"] = phase.ID
flattenedPhase["is_optional_phase"] = phase.IsOptionalPhase
flattenedPhase["is_priority_phase"] = phase.IsPriorityPhase

Check failure on line 98 in octopusdeploy/schema_phase.go

View workflow job for this annotation

GitHub Actions / build

phase.IsPriorityPhase undefined (type *lifecycles.Phase has no field or method IsPriorityPhase)
flattenedPhase["minimum_environments_before_promotion"] = int(phase.MinimumEnvironmentsBeforePromotion)
flattenedPhase["name"] = phase.Name
flattenedPhase["optional_deployment_targets"] = flattenArray(phase.OptionalDeploymentTargets)
Expand Down Expand Up @@ -127,6 +132,12 @@
Optional: true,
Type: schema.TypeBool,
},
"is_priority_phase": {
Default: false,
Description: "If true, deployments in this phase will be prioritized in the task queue.",
Optional: true,
Type: schema.TypeBool,
},
"minimum_environments_before_promotion": {
Default: 0,
Description: "The number of units required before a release can enter the next phase. If 0, all environments are required.",
Expand Down
Loading