Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ genrule(
# gazelle:exclude pkg/model/command.pb.validate.go
# gazelle:exclude pkg/model/common.pb.validate.go
# gazelle:exclude pkg/model/deployment.pb.validate.go
# gazelle:exclude pkg/model/deployment_chain.pb.validate.go
# gazelle:exclude pkg/model/environment.pb.validate.go
# gazelle:exclude pkg/model/event.pb.validate.go
# gazelle:exclude pkg/model/insight.pb.validate.go
Expand Down
1 change: 1 addition & 0 deletions pkg/model/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ proto_library(
"command.proto",
"common.proto",
"deployment.proto",
"deployment_chain.proto",
"environment.proto",
"event.proto",
"insight.proto",
Expand Down
48 changes: 48 additions & 0 deletions pkg/model/deployment_chain.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2021 The PipeCD Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package pipe.model;
option go_package = "github.com/pipe-cd/pipe/pkg/model";

import "validate/validate.proto";
import "pkg/model/application.proto";
import "pkg/model/common.proto";

message DeploymentChain {
// The generated unique identifier.
string id = 1 [(validate.rules).string.min_len = 1];
// The ID of the project this environment belongs to.
string project_id = 2 [(validate.rules).string.min_len = 1];
// Deployment node contains all configuration required to perform deployment(s)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: . at the end.

repeated DeploymentNode nodes = 3;
Comment thread
khanhtc1202 marked this conversation as resolved.
Outdated
// Unix time when all the applications in this chain are deployed.
int64 completed_at = 100 [(validate.rules).int64.gte = 0];
// Unix time when the deployment chain is created.
int64 created_at = 101 [(validate.rules).int64.gt = 0];
// Unix time of the last time when the deployment chain is updated.
int64 updated_at = 102 [(validate.rules).int64.gt = 0];
}

message DeploymentNode {
Comment thread
khanhtc1202 marked this conversation as resolved.
Outdated
// List of applications which should be deployed at the same time in chain.
repeated Application applications = 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we have to think about this field.
Should it be a list of applications or a list of triggered deployments or a list of application IDs?
Could you share your thoughts about this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Btw, in the case of storing the application list, how can we have the status (info) of actually triggered deployments to show in the web console at the "Chains" tab?

@khanhtc1202 khanhtc1202 Nov 16, 2021

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah, I get your point 👍 Since the name of this model is DeploymentChain it should be a chain of deployments, that what I was thought at first, but it looks like at the time we create this DeploymentChain model object, we don't trigger for deployment yet so that we don't have deployment object to use, my plan is to use ApplicationDeploymentReference. But I was wrong, we may need to add the ability to piped of the first application in the chain to enable it to trigger deployments for all applications in the chain and use it here 👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for your valuable comment 🙏 Addressed by 668b664

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we may need to add the ability to piped of the first application in the chain to enable it to trigger deployments for all applications in the chain and use it here

Actually, I still don't see a clear path for triggering all deployments from the first piped since some applications could be handled by other piped.
But it seems we have to store both application ref and deployment ref: all application ref are added when the deployment chain model is initialized, deployment refs are added when its piped triggers them.

I think it is hard to find out a perfect one at this time. So I am ok to merge this PR now and we can update the model if needed later.

// Control whether to start to deploy applications in this node or not.
bool runnable = 2;
// Unix time when the deployment chain node is started.
int64 started_at = 100 [(validate.rules).int64.gte = 0];
// Unix time when all the applications in this chain node are deployed.
int64 completed_at = 101 [(validate.rules).int64.gte = 0];
}