Skip to content

Commit

Permalink
Cherry-pick #4448 #4486 #4520 #4521 #4522 (#4528)
Browse files Browse the repository at this point in the history
* Release v0.44.1 (#4448)
---------

Signed-off-by: khanhtc1202 <[email protected]>

* Release v0.44.2 (#4486)

* Release v0.44.2

* Add release blog

---------

Signed-off-by: Kenta Kozuka <[email protected]>

* Add application related labels to deployment_status metric (#4520)

Fixes: #4475

* Fix deployment status use an incorrect status (#4521)

* Disable terraform drift detection (#4522)

* Add driftDetectionEnabled to terraform provider config

* Fix docs and comments

---------

Signed-off-by: Kenta Kozuka <[email protected]>
Signed-off-by: Naoki Kanatani <[email protected]>

---------

Signed-off-by: khanhtc1202 <[email protected]>
Signed-off-by: Kenta Kozuka <[email protected]>
Signed-off-by: Naoki Kanatani <[email protected]>
  • Loading branch information
khanhtc1202 authored Jul 26, 2023
1 parent 48fe6ed commit 69a7f4a
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 9 deletions.
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tag: v0.44.0
tag: v0.44.2

releaseNoteGenerator:
showCommitter: false
Expand Down
13 changes: 13 additions & 0 deletions docs/content/en/blog/releases/v0.44.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: "Release v0.44.1"
linkTitle: "Release v0.44.1"
date: 2023-06-26
description: >
Release v0.44.1
---

## Changes since v0.44.0

### Bug Fixes

* Fix Terraform drift render logic that causes runtime error ([#4444](https://github.com/pipe-cd/pipecd/pull/4444))
25 changes: 25 additions & 0 deletions docs/content/en/blog/releases/v0.44.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: "Release v0.44.2"
linkTitle: "Release v0.44.2"
date: 2023-07-12
description: >
Release v0.44.2
---

## Changes since v0.44.1
### New Features
* Enable to install Helm and Kustomize if both versions are specified ([#4463](https://github.com/pipe-cd/pipecd/pull/4463))
* Support AWS LoadBalancer with multi listeners ([#4462](https://github.com/pipe-cd/pipecd/pull/4462))

### Notable Changes
* Update logs message for ECS routing stage executor ([#4466](https://github.com/pipe-cd/pipecd/pull/4466))
* Output usage only when flag parsing fails [#4381](https://github.com/pipe-cd/pipecd/pull/4381) ([#4464](https://github.com/pipe-cd/pipecd/pull/4464))
* Update quickstart to support arm hardware(ex: M1) ([#4457](https://github.com/pipe-cd/pipecd/pull/4457))

### Bug Fixes
* Skip update AppState when no log updates ([#4482](https://github.com/pipe-cd/pipecd/pull/4482))
* Update deprecated apiVersion since GKE removed ([#4469](https://github.com/pipe-cd/pipecd/pull/4469))
* Fix ECS rollback stage does not remove canary created tasks ([#4465](https://github.com/pipe-cd/pipecd/pull/4465))

### Internal Changes
* Update web deps ([#4451](https://github.com/pipe-cd/pipecd/pull/4451))
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Must be one of the following structs:
| Field | Type | Description | Required |
|-|-|-|-|
| vars | []string | List of variables that will be set directly on terraform commands with `-var` flag. The variable must be formatted by `key=value`. | No |
| driftDetectionEnabled | bool | Enable drift detection. This is a temporary option and will be possibly removed in the future release. Default is `true` | No |

### PlatformProviderCloudRunConfig

Expand Down
2 changes: 1 addition & 1 deletion pkg/app/piped/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func (c *controller) syncPlanners(ctx context.Context) error {
if pre, ok := pendingByApp[appID]; ok && !d.TriggerBefore(pre) {
continue
}
controllermetrics.UpdateDeploymentStatus(d.Id, d.Status, d.Kind, d.PlatformProvider)
controllermetrics.UpdateDeploymentStatus(d, d.Status)
pendingByApp[appID] = d
}

Expand Down
10 changes: 6 additions & 4 deletions pkg/app/piped/controller/controllermetrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (

const (
deploymentIDKey = "deployment"
applicationIDKey = "application_id"
applicationNameKey = "application_name"
applicationKindKey = "application_kind"
platformProviderKey = "platform_provider"
deploymentStatusKey = "status"
Expand All @@ -32,16 +34,16 @@ var (
Name: "deployment_status",
Help: "The current status of deployment. 1 for current status, 0 for others.",
},
[]string{deploymentIDKey, applicationKindKey, platformProviderKey, deploymentStatusKey},
[]string{deploymentIDKey, applicationIDKey, applicationNameKey, applicationKindKey, platformProviderKey, deploymentStatusKey},
)
)

func UpdateDeploymentStatus(id string, status model.DeploymentStatus, applicationKind model.ApplicationKind, platformProvider string) {
func UpdateDeploymentStatus(d *model.Deployment, status model.DeploymentStatus) {
for name, value := range model.DeploymentStatus_value {
if model.DeploymentStatus(value) == status {
deploymentStatus.WithLabelValues(id, applicationKind.String(), platformProvider, name).Set(1)
deploymentStatus.WithLabelValues(d.Id, d.ApplicationId, d.ApplicationName, d.Kind.String(), d.PlatformProvider, name).Set(1)
} else {
deploymentStatus.WithLabelValues(id, applicationKind.String(), platformProvider, name).Set(0)
deploymentStatus.WithLabelValues(d.Id, d.ApplicationId, d.ApplicationName, d.Kind.String(), d.PlatformProvider, name).Set(0)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/piped/controller/planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (p *planner) Run(ctx context.Context) error {
}

defer func() {
controllermetrics.UpdateDeploymentStatus(p.deployment.Id, p.doneDeploymentStatus, p.deployment.Kind, p.deployment.PlatformProvider)
controllermetrics.UpdateDeploymentStatus(p.deployment, p.doneDeploymentStatus)
}()

planner, ok := p.plannerRegistry.Planner(p.deployment.Kind)
Expand Down
4 changes: 2 additions & 2 deletions pkg/app/piped/controller/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (s *scheduler) Run(ctx context.Context) error {
defer func() {
s.doneTimestamp = s.nowFunc()
s.doneDeploymentStatus = deploymentStatus
controllermetrics.UpdateDeploymentStatus(s.deployment.Id, deploymentStatus, s.deployment.Kind, s.deployment.PlatformProvider)
controllermetrics.UpdateDeploymentStatus(s.deployment, deploymentStatus)
s.done.Store(true)
}()

Expand All @@ -209,7 +209,7 @@ func (s *scheduler) Run(ctx context.Context) error {
if err != nil {
return err
}
controllermetrics.UpdateDeploymentStatus(s.deployment.Id, model.DeploymentStatus_DEPLOYMENT_RUNNING, s.deployment.Kind, s.deployment.PlatformProvider)
controllermetrics.UpdateDeploymentStatus(s.deployment, model.DeploymentStatus_DEPLOYMENT_RUNNING)
}

var (
Expand Down
3 changes: 3 additions & 0 deletions pkg/app/piped/driftdetector/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ func NewDetector(
))

case model.PlatformProviderTerraform:
if !*cp.TerraformConfig.DriftDetectionEnabled {
continue
}
sg, ok := stateGetter.TerraformGetter(cp.Name)
if !ok {
return nil, fmt.Errorf(format, cp.Name)
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/piped.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ type PlatformProviderTerraformConfig struct {
// 'image_id_list=["ami-abc123","ami-def456"]'
// 'image_id_map={"us-east-1":"ami-abc123","us-east-2":"ami-def456"}'
Vars []string `json:"vars,omitempty"`
// Enable drift detection.
// TODO: This is a temporary option because Terraform drift detection is buggy and has performace issues. This will be possibly removed in the future release.
DriftDetectionEnabled *bool `json:"driftDetectionEnabled" default:"true"`
}

type PlatformProviderCloudRunConfig struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/config/piped_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ func TestPipedConfig(t *testing.T) {
"project=gcp-project",
"region=us-centra1",
},
DriftDetectionEnabled: newBoolPointer(false),
},
},
{
Expand Down
1 change: 1 addition & 0 deletions pkg/config/testdata/piped/piped-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ spec:
vars:
- "project=gcp-project"
- "region=us-centra1"
driftDetectionEnabled: false

- name: cloudrun
type: CLOUDRUN
Expand Down

0 comments on commit 69a7f4a

Please sign in to comment.