Skip to content

Commit

Permalink
add configurable deployment check timeout for katee-deploy task
Browse files Browse the repository at this point in the history
  • Loading branch information
Michiel Stigter committed Jan 12, 2024
1 parent 5ab1f29 commit 96ecac6
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 13 deletions.
1 change: 1 addition & 0 deletions e2e/actions/deploy-katee/.halfpipe.io
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tasks:
- type: deploy-katee
name: deploy to katee
tag: version
deployment_check_timeout: 120
notifications:
on_failure:
- "#ee-re"
Expand Down
1 change: 1 addition & 0 deletions e2e/actions/deploy-katee/workflowExpected.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ jobs:
KATEE_ENVIRONMENT: halfpipe-team
KATEE_GKE_CREDENTIALS: ${{ steps.secrets.outputs.springernature_data_halfpipe-team_katee-halfpipe-team-service-account-prod_key }}
KATEE_NAMESPACE: katee-halfpipe-team
MAX_CHECKS: "120"
TAG: ${{ env.BUILD_VERSION }}
VERY_SECRET: ${{ steps.secrets.outputs.springernature_data_halfpipe-team_another_secret }}
- name: 'Notify slack #ee-re (failure)'
Expand Down
1 change: 1 addition & 0 deletions e2e/concourse/deploy-katee/.halfpipe.io
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ tasks:
name: deploy to katee
tag: version
vela_manifest: vela.yaml
deployment_check_timeout: 120
notifications:
on_failure:
- "#ee-re"
Expand Down
1 change: 1 addition & 0 deletions e2e/concourse/deploy-katee/pipelineExpected.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ jobs:
KATEE_ENVIRONMENT: halfpipe-team
KATEE_GKE_CREDENTIALS: ((katee-halfpipe-team-service-account-prod.key))
KATEE_NAMESPACE: katee-halfpipe-team
MAX_CHECKS: "120"
VERY_SECRET: blah
platform: linux
run:
Expand Down
27 changes: 14 additions & 13 deletions manifest/deploy_katee.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package manifest

type DeployKatee struct {
Type string
Name string `yaml:"name,omitempty"`
ManualTrigger bool `json:"manual_trigger" yaml:"manual_trigger,omitempty"`
Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
Vars Vars `yaml:"vars,omitempty" secretAllowed:"true"`
VelaManifest string `json:"vela_manifest,omitempty" yaml:"vela_manifest,omitempty"`
Retries int `yaml:"retries,omitempty"`
NotifyOnSuccess bool `json:"notify_on_success,omitempty" yaml:"notify_on_success,omitempty"`
Notifications Notifications `json:"notifications,omitempty" yaml:"notifications,omitempty"`
Tag string `json:"tag,omitempty" yaml:"tag,omitempty"`
BuildHistory int `json:"build_history,omitempty" yaml:"build_history,omitempty"`
Environment string `json:"environment,omitempty" yaml:"environment,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
Type string
Name string `yaml:"name,omitempty"`
ManualTrigger bool `json:"manual_trigger" yaml:"manual_trigger,omitempty"`
Timeout string `json:"timeout,omitempty" yaml:"timeout,omitempty"`
Vars Vars `yaml:"vars,omitempty" secretAllowed:"true"`
VelaManifest string `json:"vela_manifest,omitempty" yaml:"vela_manifest,omitempty"`
Retries int `yaml:"retries,omitempty"`
NotifyOnSuccess bool `json:"notify_on_success,omitempty" yaml:"notify_on_success,omitempty"`
Notifications Notifications `json:"notifications,omitempty" yaml:"notifications,omitempty"`
Tag string `json:"tag,omitempty" yaml:"tag,omitempty"`
BuildHistory int `json:"build_history,omitempty" yaml:"build_history,omitempty"`
Environment string `json:"environment,omitempty" yaml:"environment,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
DeploymentCheckTimeout int `json:"deployment_check_timeout,omitempty" yaml:"deployment_check_timeout,omitempty"`
}

func (d DeployKatee) ReadsFromArtifacts() bool {
Expand Down
5 changes: 5 additions & 0 deletions renderers/actions/deploy_katee.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package actions
import (
"fmt"
"github.com/springernature/halfpipe/manifest"
"strconv"
)

func (a *Actions) deployKateeSteps(task manifest.DeployKatee) (steps Steps) {
Expand All @@ -28,6 +29,10 @@ func (a *Actions) deployKateeSteps(task manifest.DeployKatee) (steps Steps) {
deployKatee.Env["TAG"] = "${{ env.BUILD_VERSION }}"
}

if task.DeploymentCheckTimeout != 0 {
deployKatee.Env["MAX_CHECKS"] = strconv.Itoa(task.DeploymentCheckTimeout)
}

for k, v := range task.Vars {
deployKatee.Env[k] = v
}
Expand Down
5 changes: 5 additions & 0 deletions renderers/concourse/deploy_katee.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"github.com/concourse/concourse/atc"
"github.com/springernature/halfpipe/manifest"
"strconv"
)

func (c Concourse) deployKateeJob(task manifest.DeployKatee, man manifest.Manifest, basePath string) (job atc.JobConfig) {
Expand Down Expand Up @@ -56,6 +57,10 @@ halfpipe-deploy`,
run.Vars["DOCKER_TAG"] = "buildVersion"
}

if task.DeploymentCheckTimeout != 0 {
run.Vars["MAX_CHECKS"] = strconv.Itoa(task.DeploymentCheckTimeout)
}

for k, v := range task.Vars {
run.Vars[k] = v
}
Expand Down

0 comments on commit 96ecac6

Please sign in to comment.