diff --git a/BUILD.bazel b/BUILD.bazel index d896999aec..e9aef6861f 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -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 diff --git a/pkg/model/BUILD.bazel b/pkg/model/BUILD.bazel index 3388908a99..d4cdd403be 100644 --- a/pkg/model/BUILD.bazel +++ b/pkg/model/BUILD.bazel @@ -11,6 +11,7 @@ proto_library( "command.proto", "common.proto", "deployment.proto", + "deployment_chain.proto", "environment.proto", "event.proto", "insight.proto", diff --git a/pkg/model/deployment_chain.proto b/pkg/model/deployment_chain.proto new file mode 100644 index 0000000000..6e35baf8c7 --- /dev/null +++ b/pkg/model/deployment_chain.proto @@ -0,0 +1,49 @@ +// 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/common.proto"; +import "pkg/model/deployment.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]; + // List of all deployment node in the chain which contains all + // configuration required to perform deployment(s). + repeated DeploymentChainNode nodes = 3; + // 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 DeploymentChainNode { + // List of applications which should be deployed at the same time in chain. + repeated Deployment deployments = 1; + // 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]; +}