Skip to content

Conversation

@nghialv
Copy link
Member

@nghialv nghialv commented Dec 11, 2020

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #1199

Does this PR introduce a user-facing change?:

Introducing the CLI tool: pipectl

@nghialv
Copy link
Member Author

nghialv commented Dec 11, 2020

/cc @khanhtc1202

@pipecd-bot
Copy link
Collaborator

GO_LINTER

The following files are not gofmt-ed. By commenting /golinter fmt, the formatted one will be appended to this pull request automatically.

pkg/app/pipectl/cmd/deployment/waitstatus_test.go
--- pkg/app/pipectl/cmd/deployment/waitstatus_test.go.orig
+++ pkg/app/pipectl/cmd/deployment/waitstatus_test.go
@@ -42,8 +42,8 @@
 			name:     "ok",
 			statuses: []string{"SUCCESS", "PLANNED"},
 			expected: map[model.DeploymentStatus]struct{}{
-				model.DeploymentStatus_DEPLOYMENT_SUCCESS: struct{}{},
-				model.DeploymentStatus_DEPLOYMENT_PLANNED: struct{}{},
+				model.DeploymentStatus_DEPLOYMENT_SUCCESS: {},
+				model.DeploymentStatus_DEPLOYMENT_PLANNED: {},
 			},
 		},
 	}

Copy link
Collaborator

@pipecd-bot pipecd-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GO_LINTER

Some issues were detected while linting go source files in your changes.

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 33.31%. This pull request decreases coverage by -0.17%.

File Function Base Head Diff
pkg/app/pipectl/cmd/deployment/deployment.go NewCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/deployment/waitstatus.go newWaitStatusCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/deployment/waitstatus.go waitStatus.run -- 0.00% +0.00%
pkg/app/pipectl/cmd/deployment/waitstatus.go makeDeploymentStatuses -- 100.00% +100.00%
pkg/cli/cmd.go runWithContext 78.26% 77.27% -0.99%

@nghialv nghialv changed the title Add implementation for pipectl tool [WIP] Add implementation for pipectl tool Dec 14, 2020
@nghialv
Copy link
Member Author

nghialv commented Dec 14, 2020

I just realized that we need a wait-status after syncing an application for our B team.
So changed this PR to be WIP.

@pipecd-bot
Copy link
Collaborator

GO_LINTER

The following files are not gofmt-ed. By commenting /golinter fmt, the formatted one will be appended to this pull request automatically.

pkg/app/pipectl/client/deployment.go
--- pkg/app/pipectl/client/deployment.go.orig
+++ pkg/app/pipectl/client/deployment.go
@@ -20,9 +20,10 @@
 	"strings"
 	"time"
 
+	"go.uber.org/zap"
+
 	"github.com/pipe-cd/pipe/pkg/app/api/service/apiservice"
 	"github.com/pipe-cd/pipe/pkg/model"
-	"go.uber.org/zap"
 )
 
 // WaitDeploymentStatuses waits a given deployment until it reaches one of the specified statuses.

StacktraceKey: "stacktrace",
LineEnding: zapcore.DefaultLineEnding,
EncodeLevel: encodeLevel,
EncodeTime: HumanizeTimeEncoder,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed TimeEncoder from humanize mode to simplify the log output of CLI.

@nghialv nghialv changed the title [WIP] Add implementation for pipectl tool Add implementation for pipectl tool Dec 14, 2020
@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 33.31%. This pull request decreases coverage by -0.17%.

File Function Base Head Diff
pkg/app/pipectl/cmd/application/add.go newAddCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/application/add.go add.run -- 0.00% +0.00%
pkg/app/pipectl/cmd/application/application.go NewCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/application/sync.go newSyncCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/application/sync.go sync.run -- 0.00% +0.00%
pkg/app/pipectl/cmd/application/sync.go makeStatuses -- 100.00% +100.00%
pkg/app/pipectl/cmd/application/sync.go availableStatuses -- 100.00% +100.00%
pkg/app/pipectl/cmd/deployment/deployment.go NewCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/deployment/waitstatus.go newWaitStatusCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/deployment/waitstatus.go waitStatus.run -- 0.00% +0.00%
pkg/app/pipectl/cmd/deployment/waitstatus.go makeStatuses -- 100.00% +100.00%
pkg/app/pipectl/cmd/deployment/waitstatus.go availableStatuses -- 100.00% +100.00%
pkg/cli/cmd.go runWithContext 78.26% 77.27% -0.99%
pkg/log/log.go HumanizeTimeEncoder 100.00% -- -100.00%

func newAddCommand(root *command) *cobra.Command {
c := &add{
root: root,
gitPathConfigFileName: ".pipe.yaml",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like it should be changeable via --config-file-name or something like that. And the default value should refer to pkg.model.DefaultDeploymentConfigFileName.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I just now found it has been already changeable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I changed to use the value defined in the model package and simplified the flags.

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 33.31%. This pull request decreases coverage by -0.17%.

File Function Base Head Diff
pkg/app/pipectl/cmd/application/add.go newAddCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/application/add.go add.run -- 0.00% +0.00%
pkg/app/pipectl/cmd/application/application.go NewCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/application/sync.go newSyncCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/application/sync.go sync.run -- 0.00% +0.00%
pkg/app/pipectl/cmd/application/sync.go makeStatuses -- 100.00% +100.00%
pkg/app/pipectl/cmd/application/sync.go availableStatuses -- 100.00% +100.00%
pkg/app/pipectl/cmd/deployment/deployment.go NewCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/deployment/waitstatus.go newWaitStatusCommand -- 0.00% +0.00%
pkg/app/pipectl/cmd/deployment/waitstatus.go waitStatus.run -- 0.00% +0.00%
pkg/app/pipectl/cmd/deployment/waitstatus.go makeStatuses -- 100.00% +100.00%
pkg/app/pipectl/cmd/deployment/waitstatus.go availableStatuses -- 100.00% +100.00%
pkg/cli/cmd.go runWithContext 78.26% 77.27% -0.99%
pkg/log/log.go HumanizeTimeEncoder 100.00% -- -100.00%

@nakabonne
Copy link
Member

/lgtm

@khanhtc1202
Copy link
Member

/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by khanhtc1202.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

@pipecd-bot pipecd-bot merged commit 750c8ee into master Dec 14, 2020
@pipecd-bot pipecd-bot deleted the pipectl branch December 14, 2020 07:41
@pipecd-bot pipecd-bot mentioned this pull request Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement pipectl tool

5 participants