Skip to content

Commit

Permalink
Revert "create delivery version"
Browse files Browse the repository at this point in the history
  • Loading branch information
landylee007 authored Dec 10, 2021
1 parent 07a9813 commit 91321d8
Show file tree
Hide file tree
Showing 35 changed files with 314 additions and 2,396 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
github.com/bugsnag/bugsnag-go v2.1.0+incompatible // indirect
github.com/bugsnag/panicwrap v1.3.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.1
github.com/chartmuseum/helm-push v0.10.1
github.com/coocood/freecache v1.1.0
github.com/coreos/go-oidc/v3 v3.0.0
github.com/dexidp/dex v0.0.0-20210802203454-3fac2ab6bc3b
Expand Down
5 changes: 0 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw=
github.com/chartmuseum/helm-push v0.10.1 h1:NqStAmarEy0GnrDCk0zubGKeRmkhOm/rRi5au8h76BA=
github.com/chartmuseum/helm-push v0.10.1/go.mod h1:s6xTICU31jKdLkOXS+GgaR61E+oU4h8TWb1yZcHq8OE=
github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw=
github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
Expand Down Expand Up @@ -539,7 +537,6 @@ github.com/garyburd/redigo v1.6.2 h1:yE/pwKCrbLpLpQICzYTeZ7JsTA/C53wFTJHaEtRqniM
github.com/garyburd/redigo v1.6.2/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc=
github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w=
Expand Down Expand Up @@ -2353,8 +2350,6 @@ k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8
k8s.io/gengo v0.0.0-20190822140433-26a664648505/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20201214224949-b6c5ce23f027/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
k8s.io/helm v2.17.0+incompatible h1:Bpn6o1wKLYqKM3+Osh8e+1/K2g/GsQJ4F4yNF2+deao=
k8s.io/helm v2.17.0+incompatible/go.mod h1:LZzlS4LQBHfciFOurYBFkCMTaZ0D1l+p0teMg7TSULI=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
Expand Down
4 changes: 0 additions & 4 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,6 @@ func ObjectStorageTemplatePath(name, kind string) string {
return filepath.Join("templates", kind, name)
}

func ObjectStorageDeliveryVersionPath(project string) string {
return filepath.Join("delivery-distributes", "files", project)
}

func ObjectStorageChartTemplatePath(name string) string {
return ObjectStorageTemplatePath(name, setting.ChartTemplatesPath)
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/microservice/aslan/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,6 @@ func LocalServicePathWithRevision(project, service string, revision int64) strin
return configbase.LocalServicePathWithRevision(project, service, fmt.Sprintf("%d", revision))
}

func LocalDeliveryChartPathWithRevision(project, service string, revision int64) string {
return configbase.LocalServicePathWithRevision(project, service, fmt.Sprintf("delivery/%d", revision))
}

func ServiceNameWithRevision(serviceName string, revision int64) string {
return fmt.Sprintf("%s-%d", serviceName, revision)
}
Expand Down
1 change: 0 additions & 1 deletion pkg/microservice/aslan/config/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ type DistributeType string
const (
File DistributeType = "file"
Image DistributeType = "image"
Chart DistributeType = "chart"
)

type NotifyType int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,16 @@ import (
type DeliveryDistribute struct {
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
ReleaseID primitive.ObjectID `bson:"release_id" json:"releaseId"`
ServiceName string `bson:"service_name" json:"serviceName,omitempty"`
ServiceName string `bson:"service_name" json:"serviceName"`
DistributeType config.DistributeType `bson:"distribute_type" json:"distributeType"`
RegistryName string `bson:"registry_name" json:"registryName"`
ChartVersion string `bson:"chart_version" json:"chartVersion,omitempty"`
ChartName string `bson:"chart_name" json:"chartName,omitempty"`
ChartRepoName string `bson:"chart_repo_name" json:"chartRepoName,omitempty"`
SubDistributes []*DeliveryDistribute `bson:"-" json:"subDistributes,omitempty"`
Namespace string `bson:"namespace" json:"namespace,omitempty"`
PackageFile string `bson:"package_file" json:"packageFile,omitempty"`
RemoteFileKey string `bson:"remote_file_key" json:"remoteFileKey,omitempty"`
DestStorageURL string `bson:"dest_storage_url" json:"destStorageUrl,omitempty"`
S3StorageID string `bson:"s3_storage_id" json:"s3StorageID"`
StorageURL string `bson:"-" json:"storageUrl"`
StorageBucket string `bson:"-" json:"storageBucket"`
SrcStorageURL string `bson:"src_storage_url" json:"srcStorageUrl,omitempty"`
StartTime int64 `bson:"start_time,omitempty" json:"start_time,omitempty,omitempty"`
EndTime int64 `bson:"end_time,omitempty" json:"end_time,omitempty,omitempty"`
Namespace string `bson:"namespace" json:"namespace"`
PackageFile string `bson:"package_file" json:"packageFile"`
RemoteFileKey string `bson:"remote_file_key" json:"remoteFileKey"`
DestStorageURL string `bson:"dest_storage_url" json:"destStorageUrl"`
SrcStorageURL string `bson:"src_storage_url" json:"srcStorageUrl"`
StartTime int64 `bson:"start_time,omitempty" json:"start_time,omitempty"`
EndTime int64 `bson:"end_time,omitempty" json:"end_time,omitempty"`
CreatedAt int64 `bson:"created_at" json:"created_at"`
DeletedAt int64 `bson:"deleted_at" json:"deleted_at"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,18 @@ import (
"go.mongodb.org/mongo-driver/bson/primitive"
)

type DeliveryVersionProgress struct {
SuccessChartCount int `json:"successChartCount"`
TotalChartCount int `json:"totalChartCount"`
PackageUploadStatus string `json:"packageStatus"`
Error string `json:"error"`
}

type DeliveryVersion struct {
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
Version string `bson:"version" json:"version"`
ProductName string `bson:"product_name" json:"productName"`
WorkflowName string `bson:"workflow_name" json:"workflowName"`
Type string `bson:"type" json:"type"`
TaskID int `bson:"task_id" json:"taskId"`
Desc string `bson:"desc" json:"desc"`
Labels []string `bson:"labels" json:"labels"`
ProductEnvInfo *Product `bson:"product_env_info" json:"productEnvInfo"`
Status string `bson:"status" json:"status"`
Error string `bson:"error" json:"-"`
Progress *DeliveryVersionProgress `bson:"-" json:"progress"`
CreateArgument interface{} `bson:"createArgument" json:"-"`
CreatedBy string `bson:"created_by" json:"createdBy"`
CreatedAt int64 `bson:"created_at" json:"created_at"`
DeletedAt int64 `bson:"deleted_at" json:"deleted_at"`
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
Version string `bson:"version" json:"version"`
ProductName string `bson:"product_name" json:"productName"`
WorkflowName string `bson:"workflow_name" json:"workflowName"`
TaskID int `bson:"task_id" json:"taskId"`
Desc string `bson:"desc" json:"desc"`
Labels []string `bson:"labels" json:"labels"`
ProductEnvInfo *Product `bson:"product_env_info" json:"productEnvInfo"`
CreatedBy string `bson:"created_by" json:"createdBy"`
CreatedAt int64 `bson:"created_at" json:"created_at"`
DeletedAt int64 `bson:"deleted_at" json:"deleted_at"`
}

func (DeliveryVersion) TableName() string {
Expand Down
27 changes: 13 additions & 14 deletions pkg/microservice/aslan/core/common/repository/models/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ type Queue struct {
IsArchived bool `bson:"is_archived" json:"is_archived"`
AgentID string `bson:"agent_id" json:"agent_id"`
MultiRun bool `bson:"multi_run" json:"multi_run"`
Target string `bson:"target,omitempty" json:"target"` // target service name, for k8s: containerName, for pm: serviceName
BuildModuleVer string `bson:"build_module_ver,omitempty" json:"build_module_ver"`
Target string `bson:"target,omitempty" json:"target"` // target 服务名称, k8s为容器名称, 物理机为服务名
BuildModuleVer string `bson:"build_module_ver,omitempty" json:"build_module_ver"` // 使用预定义编译管理模块中的内容生成SubTasks, 查询条件为 服务模板名称: ServiceTmpl, 版本: BuildModuleVer 如果为空,则使用pipeline自定义SubTasks
ServiceName string `bson:"service_name,omitempty" json:"service_name,omitempty"`
TaskArgs *TaskArgs `bson:"task_args,omitempty" json:"task_args,omitempty"` // TaskArgs job parameters for single-service workflow
WorkflowArgs *WorkflowTaskArgs `bson:"workflow_args" json:"workflow_args,omitempty"` // WorkflowArgs job parameters for multi-service workflow
TestArgs *TestTaskArgs `bson:"test_args,omitempty" json:"test_args,omitempty"` // TestArgs parameters for testing
ServiceTaskArgs *ServiceTaskArgs `bson:"service_args,omitempty" json:"service_args,omitempty"` // ServiceTaskArgs parameters for script-deployed workflows
TaskArgs *TaskArgs `bson:"task_args,omitempty" json:"task_args,omitempty"` // TaskArgs 单服务工作流任务参数
WorkflowArgs *WorkflowTaskArgs `bson:"workflow_args" json:"workflow_args,omitempty"` // WorkflowArgs 多服务工作流任务参数
TestArgs *TestTaskArgs `bson:"test_args,omitempty" json:"test_args,omitempty"` // TestArgs 测试任务参数
ServiceTaskArgs *ServiceTaskArgs `bson:"service_args,omitempty" json:"service_args,omitempty"` // ServiceTaskArgs 脚本部署工作流任务参数
ArtifactPackageTaskArgs *ArtifactPackageTaskArgs `bson:"artifact_package_args,omitempty" json:"artifact_package_args,omitempty"`
ConfigPayload *ConfigPayload `bson:"configpayload,omitempty" json:"config_payload"`
Error string `bson:"error,omitempty" json:"error,omitempty"`
Expand Down Expand Up @@ -96,10 +96,9 @@ type ServiceTaskArgs struct {
}

type ImageData struct {
ImageUrl string `bson:"image_url" json:"image_url"`
ImageName string `bson:"image_name" json:"image_name"`
ImageTag string `bson:"image_tag" json:"image_tag"`
RegistryID string `bson:"registry_id" json:"registry_id"`
ImageUrl string `bson:"image_url" json:"image_url"`
ImageName string `bson:"image_name" json:"image_name"`
ImageTag string `bson:"image_tag" json:"image_tag"`
}

type ImagesByService struct {
Expand All @@ -109,10 +108,10 @@ type ImagesByService struct {

type ArtifactPackageTaskArgs struct {
ProjectName string `bson:"project_name" json:"project_name"`
EnvName string `bson:"env_name" json:"env_name"`
Images []*ImagesByService `bson:"images" json:"images"`
SourceRegistries []string `json:"source_registries" json:"source_registries"`
TargetRegistries []string `json:"target_registries" json:"target_registries"`
EnvName string `bson:"env_name" json:"env_name"`
Images []*ImagesByService `bson:"images" json:"images"`
SourceRegistries []string `json:"source_registries" json:"source_registries"`
TargetRegistries []string `json:"target_registries" json:"target_registries"`
}

type ConfigPayload struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,12 @@ limitations under the License.
package task

import (
"encoding/json"
"fmt"

"github.com/koderover/zadig/pkg/microservice/aslan/config"
"github.com/koderover/zadig/pkg/microservice/aslan/core/common/repository/models"
)

type ImageData struct {
ImageUrl string `bson:"image_url" json:"image_url"`
ImageName string `bson:"image_name" json:"image_name"`
ImageNamespace string `bson:"image_namespace" json:"image_namespace"`
ImageTag string `bson:"image_tag" json:"image_tag"`
}

type ServicePackageResult struct {
ServiceName string `json:"service_name"`
Result string `json:"result"`
ErrorMsg string `json:"error_msg"`
ImageData []*ImageData `json:"image_data"`
}

type ArtifactPackage struct {
TaskType config.TaskType `bson:"type" json:"type"`
TaskStatus config.Status `bson:"status" json:"status"`
Expand All @@ -47,7 +32,6 @@ type ArtifactPackage struct {
StartTime int64 `bson:"start_time,omitempty" json:"start_time,omitempty"`
EndTime int64 `bson:"end_time,omitempty" json:"end_time,omitempty"`
LogFile string `bson:"log_file" json:"log_file"`
Progress string `bson:"progress" json:"progress"`

// source images
Images []*models.ImagesByService `bson:"images" json:"images"`
Expand All @@ -64,12 +48,3 @@ func (ri *ArtifactPackage) ToSubTask() (map[string]interface{}, error) {
}
return task, nil
}

func (ri *ArtifactPackage) GetProgress() ([]*ServicePackageResult, error) {
if len(ri.Progress) == 0 {
return nil, nil
}
ret := make([]*ServicePackageResult, 0)
err := json.Unmarshal([]byte(ri.Progress), &ret)
return ret, err
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ type Task struct {
StorageURI string `bson:"storage_uri,omitempty" json:"storage_uri,omitempty"`
// interface{} 为types.TestReport
TestReports map[string]interface{} `bson:"test_reports,omitempty" json:"test_reports,omitempty"`
RwLock sync.Mutex `bson:"-" json:"-"`
ResetImage bool `bson:"resetImage" json:"resetImage"`
TriggerBy *models.TriggerBy `bson:"trigger_by,omitempty" json:"trigger_by,omitempty"`
Features []string `bson:"features" json:"features"`
IsRestart bool `bson:"is_restart" json:"is_restart"`
StorageEndpoint string `bson:"storage_endpoint" json:"storage_endpoint"`
RwLock sync.Mutex `bson:"-" json:"-"`
ResetImage bool `json:"resetImage" bson:"resetImage"`
TriggerBy *models.TriggerBy `json:"trigger_by,omitempty" bson:"trigger_by,omitempty"`
Features []string `bson:"features" json:"features"`
IsRestart bool `bson:"is_restart" json:"is_restart"`
StorageEndpoint string `bson:"storage_endpoint" json:"storage_endpoint"`
}

//type RenderInfo struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ type DeliveryDistributeArgs struct {
ID string `json:"id"`
ReleaseID string `json:"releaseId"`
ServiceName string `json:"serviceName"`
ChartName string `json:"chartName"`
DistributeType config.DistributeType `json:"distributeType"`
}

Expand Down Expand Up @@ -63,7 +62,6 @@ func (c *DeliveryDistributeColl) EnsureIndex(ctx context.Context) error {
Keys: bson.D{
bson.E{Key: "release_id", Value: 1},
bson.E{Key: "service_name", Value: 1},
bson.E{Key: "chart_name", Value: 1},
bson.E{Key: "deleted_at", Value: 1},
},
Options: options.Index().SetUnique(false),
Expand Down Expand Up @@ -117,11 +115,8 @@ func (c *DeliveryDistributeColl) Find(args *DeliveryDistributeArgs) ([]*models.D
}
query := bson.M{"release_id": releaseID, "deleted_at": 0}

if len(args.DistributeType) > 0 {
query["distribute_type"] = string(args.DistributeType)
}
if len(args.ChartName) > 0 {
query["chart_name"] = args.ChartName
if args.DistributeType != "" {
query["distribute_type"] = config.File
}
cursor, err := c.Collection.Find(context.TODO(), query)
if err != nil {
Expand Down
Loading

0 comments on commit 91321d8

Please sign in to comment.