adaptor

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2021 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AADAPTOR_CICD_CRON_LIST = apis.ApiSpec{
	Path:         "/api/cicd-crons",
	BackendPath:  "/api/cicd-crons",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.PipelineCronListResponse{},
	Doc:          "summary: 定时 pipeline 列表",
}
View Source
var ADAPTOR_CICD_BRANCHES_ALL_VALID = apis.ApiSpec{
	Path:         "/api/cicds/actions/app-all-valid-branch-workspaces",
	BackendPath:  "/api/cicds/actions/app-all-valid-branch-workspaces",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.PipelineAppAllValidBranchWorkspaceResponse{},
	Doc:          "summary: 获取应用下所有符合 gitflow 规范的分支列表,以及每个分支对应的 workspace",
}
View Source
var ADAPTOR_CICD_CANCEL = apis.ApiSpec{
	Path:         "/api/cicds/<pipelineID>/actions/cancel",
	BackendPath:  "/api/cicds/<pipelineID>/actions/cancel",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodPost,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.PipelineCancelResponse{},
	Doc:          "summary: 取消 pipeline",
	Audit: func(ctx *spec.AuditContext) error {
		pipelineId, err := ctx.GetParamUInt64("pipelineID")
		if err != nil {
			return err
		}
		pipelineDTO, err := ctx.Bundle.GetPipeline(pipelineId)
		if err != nil {
			return err
		}
		return ctx.CreateAudit(&apistructs.Audit{
			Context: map[string]interface{}{
				"projectId":   strconv.FormatUint(pipelineDTO.ProjectID, 10),
				"appId":       strconv.FormatUint(pipelineDTO.ApplicationID, 10),
				"projectName": pipelineDTO.ProjectName,
				"appName":     pipelineDTO.ApplicationName,
				"pipelineId":  strconv.FormatUint(pipelineDTO.ID, 10),
			},
			ProjectID:    pipelineDTO.ProjectID,
			AppID:        pipelineDTO.ApplicationID,
			ScopeType:    "app",
			TemplateName: apistructs.CancelPipelineTemplate,
			ScopeID:      pipelineDTO.ApplicationID,
		})
	},
}
View Source
var ADAPTOR_CICD_CONFIG_DEL = apis.ApiSpec{
	Path:        "/api/cicds/configs",
	BackendPath: "/api/cicds/configs",
	Host:        "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:      "http",
	Method:      "DELETE",
	CheckLogin:  true,
	Doc:         "summary: 删除Pipeline指定命名空间下的某个配置",
	Audit: func(ctx *spec.AuditContext) error {
		appID := ctx.Request.URL.Query().Get("appID")
		namespaceName := ctx.Request.URL.Query().Get("namespace_name")
		key := ctx.Request.URL.Query().Get("key")
		appDTO, err := ctx.GetApp(appID)
		if err != nil {
			return err
		}
		return ctx.CreateAudit(&apistructs.Audit{
			Context: map[string]interface{}{
				"projectId":   strconv.FormatUint(appDTO.ProjectID, 10),
				"appId":       strconv.FormatUint(appDTO.ID, 10),
				"projectName": appDTO.ProjectName,
				"appName":     appDTO.Name,
				"namespace":   namespaceName,
				"key":         key,
			},
			ProjectID:    appDTO.ProjectID,
			AppID:        appDTO.ID,
			ScopeType:    "app",
			ScopeID:      appDTO.ID,
			TemplateName: apistructs.DeletePipelineKeyTemplate,
		})
	},
}
View Source
var ADAPTOR_CICD_CONFIG_GET = apis.ApiSpec{
	Path:        "/api/cicds/multinamespace/configs",
	BackendPath: "/api/cicds/multinamespace/configs",
	Host:        "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	Doc:         "summary: 获取Pipeline指定命名空间的所有配置",
}
View Source
var ADAPTOR_CICD_CONFIG_NAMESPACES = apis.ApiSpec{
	Path:         "/api/cicds/actions/fetch-config-namespaces",
	BackendPath:  "/api/cicds/actions/fetch-config-namespaces",
	Host:         "gittar-adaptor.default.svc.cluster.local:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.PipelineConfigNamespacesFetchResponse{},
	Doc:          "summary: 获取应用级别的配置的命名空间",
}
View Source
var ADAPTOR_CICD_CONFIG_PUT = apis.ApiSpec{
	Path:        "/api/cicds/configs",
	BackendPath: "/api/cicds/configs",
	Host:        "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	RequestType: &apistructs.EnvConfigAddOrUpdateRequest{},
	Doc:         "summary: 修改Pipeline指定命名空间下的一个或多个配置",
	Audit: func(ctx *spec.AuditContext) error {
		appID := ctx.Request.URL.Query().Get("appID")
		namespaceName := ctx.Request.URL.Query().Get("namespace_name")
		var req apistructs.EnvConfigAddOrUpdateRequest
		err := ctx.BindRequestData(&req)
		if err != nil {
			return err
		}
		appDTO, err := ctx.GetApp(appID)
		if err != nil {
			return err
		}
		keys := []string{}
		for _, config := range req.Configs {
			keys = append(keys, config.Key)
		}
		return ctx.CreateAudit(&apistructs.Audit{
			Context: map[string]interface{}{
				"projectId":   strconv.FormatUint(appDTO.ProjectID, 10),
				"appId":       strconv.FormatUint(appDTO.ID, 10),
				"projectName": appDTO.ProjectName,
				"appName":     appDTO.Name,
				"namespace":   namespaceName,
				"key":         strings.Join(keys, ","),
			},
			ProjectID:    appDTO.ProjectID,
			AppID:        appDTO.ID,
			ScopeType:    "app",
			ScopeID:      appDTO.ID,
			TemplateName: apistructs.UpdatePipelineKeyTemplate,
		})
	},
}
View Source
var ADAPTOR_CICD_CONFIG_WORKSPACES = apis.ApiSpec{
	Path:         "/api/cicds/actions/list-workspaces",
	BackendPath:  "/api/cicds/actions/list-workspaces",
	Host:         "gittar-adaptor.default.svc.cluster.local:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.PipelineConfigNamespacesFetchResponse{},
	Doc:          "summary: 获取应用级别的配置的环境名称",
}
View Source
var ADAPTOR_CICD_CREATE = apis.ApiSpec{
	Path:         "/api/cicds",
	BackendPath:  "/api/cicds",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodPost,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	RequestType:  apistructs.PipelineCreateRequest{},
	ResponseType: apistructs.PipelineCreateResponse{},
	Doc:          "summary: 创建 pipeline",
	Audit: func(ctx *spec.AuditContext) error {
		var resp apistructs.PipelineCreateResponse
		err := ctx.BindResponseData(&resp)
		if err != nil {
			return err
		}
		pipelineDTO := resp.Data
		return ctx.CreateAudit(&apistructs.Audit{
			Context: map[string]interface{}{
				"projectId":   strconv.FormatUint(pipelineDTO.ProjectID, 10),
				"appId":       strconv.FormatUint(pipelineDTO.ApplicationID, 10),
				"projectName": pipelineDTO.ProjectName,
				"appName":     pipelineDTO.ApplicationName,
				"pipelineId":  strconv.FormatUint(pipelineDTO.ID, 10),
				"branch":      pipelineDTO.Branch,
			},
			ProjectID:    pipelineDTO.ProjectID,
			AppID:        pipelineDTO.ApplicationID,
			ScopeType:    "app",
			TemplateName: apistructs.CreatePipelineTemplate,
			ScopeID:      pipelineDTO.ApplicationID,
		})
	},
}
View Source
var ADAPTOR_CICD_CRON_START = apis.ApiSpec{
	Path:         "/api/cicd-crons/<cronID>/actions/start",
	BackendPath:  "/api/cicd-crons/<cronID>/actions/start",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodPut,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.PipelineCronStartResponse{},
	Doc:          "summary: 开始定时 pipeline",
	Audit: func(ctx *spec.AuditContext) error {
		var res apistructs.PipelineCronStartResponse
		err := ctx.BindResponseData(&res)
		if err != nil {
			return err
		}
		cronDTO := res.Data
		app, err := ctx.GetApp(cronDTO.ApplicationID)
		if err != nil {
			return err
		}
		return ctx.CreateAudit(&apistructs.Audit{
			Context: map[string]interface{}{
				"projectId":   strconv.FormatUint(app.ProjectID, 10),
				"appId":       strconv.FormatUint(app.ID, 10),
				"projectName": app.ProjectName,
				"appName":     app.Name,
				"pipelineId":  strconv.FormatUint(cronDTO.BasePipelineID, 10),
				"branch":      cronDTO.Branch,
			},
			ProjectID:    app.ProjectID,
			AppID:        app.ID,
			ScopeType:    "app",
			TemplateName: apistructs.StartPipelineTimerTemplate,
			ScopeID:      app.ID,
		})
	},
}
View Source
var ADAPTOR_CICD_CRON_STOP = apis.ApiSpec{
	Path:         "/api/cicd-crons/<cronID>/actions/stop",
	BackendPath:  "/api/cicd-crons/<cronID>/actions/stop",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodPut,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.PipelineCronStopResponse{},
	Doc:          "summary: 停止定时 pipeline",
	Audit: func(ctx *spec.AuditContext) error {
		var res apistructs.PipelineCronStopResponse
		err := ctx.BindResponseData(&res)
		if err != nil {
			return err
		}
		cronDTO := res.Data
		app, err := ctx.GetApp(cronDTO.ApplicationID)
		if err != nil {
			return err
		}
		return ctx.CreateAudit(&apistructs.Audit{
			Context: map[string]interface{}{
				"projectId":   strconv.FormatUint(app.ProjectID, 10),
				"appId":       strconv.FormatUint(app.ID, 10),
				"projectName": app.ProjectName,
				"appName":     app.Name,
				"pipelineId":  strconv.FormatUint(cronDTO.BasePipelineID, 10),
				"branch":      cronDTO.Branch,
			},
			ProjectID:    app.ProjectID,
			AppID:        app.ID,
			ScopeType:    "app",
			TemplateName: apistructs.StopPipelineTimerTemplate,
			ScopeID:      app.ID,
		})
	},
}
View Source
var ADAPTOR_CICD_FETCH_PIPELINE_ID = apis.ApiSpec{
	Path:        "/api/cicds/actions/fetch-pipeline-id",
	BackendPath: "/api/cicds/actions/fetch-pipeline-id",
	Host:        "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:      "http",
	Method:      http.MethodGet,
	IsOpenAPI:   true,
	CheckLogin:  true,
	CheckToken:  true,
	Doc:         "summary: 根据 branch & appID 获取 pipelineID",
}
View Source
var ADAPTOR_CICD_FILETREE_CREATE = apis.ApiSpec{
	Path:         "/api/cicd-pipeline/filetree",
	BackendPath:  "/api/cicd-pipeline/filetree",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodPost,
	IsOpenAPI:    true,
	CheckLogin:   true,
	ResponseType: apistructs.UnifiedFileTreeNodeCreateRequest{},
	Doc:          "summary: 创建节点",
}
View Source
var ADAPTOR_CICD_FILETREE_DELETE = apis.ApiSpec{
	Path:         "/api/cicd-pipeline/filetree/<inode>",
	BackendPath:  "/api/cicd-pipeline/filetree/<inode>",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodDelete,
	IsOpenAPI:    true,
	CheckLogin:   true,
	ResponseType: apistructs.UnifiedFileTreeNodeDeleteRequest{},
	Doc:          "summary: 删除节点",
}
View Source
var ADAPTOR_CICD_FILETREE_FIND_ANCESTORS = apis.ApiSpec{
	Path:         "/api/cicd-pipeline/filetree/<inode>/actions/find-ancestors",
	BackendPath:  "/api/cicd-pipeline/filetree/<inode>/actions/find-ancestors",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.UnifiedFileTreeNodeFindAncestorsRequest{},
	Doc:          "summary: 查询所有父节点",
}
View Source
var ADAPTOR_CICD_FILETREE_FUZZY_SEARCH = apis.ApiSpec{
	Path:         "/api/cicd-pipeline/filetree/actions/fuzzy-search",
	BackendPath:  "/api/cicd-pipeline/filetree/actions/fuzzy-search",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.UnifiedFileTreeNodeFuzzySearchRequest{},
	Doc:          "summary: 模糊搜索节点",
}
View Source
var ADAPTOR_CICD_FILETREE_GET = apis.ApiSpec{
	Path:         "/api/cicd-pipeline/filetree/<inode>",
	BackendPath:  "/api/cicd-pipeline/filetree/<inode>",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.UnifiedFileTreeNodeGetRequest{},
	Doc:          "summary: 查询节点详情",
}
View Source
var ADAPTOR_CICD_FILETREE_GET_PIPELINE_FILETREE = apis.ApiSpec{
	Path:        "/api/cicd-pipeline/filetree/actions/get-inode-by-pipeline",
	BackendPath: "/api/cicd-pipeline/filetree/actions/get-inode-by-pipeline",
	Host:        "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:      "http",
	Method:      http.MethodGet,
	IsOpenAPI:   true,
	CheckLogin:  true,
	CheckToken:  true,
	Doc:         "summary: 根据 pipeline id 查询流水线",
}
View Source
var ADAPTOR_CICD_FILETREE_LIST = apis.ApiSpec{
	Path:         "/api/cicd-pipeline/filetree",
	BackendPath:  "/api/cicd-pipeline/filetree",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.UnifiedFileTreeNodeListRequest{},
	Doc:          "summary: 查询子节点列表",
}
View Source
var ADAPTOR_CICD_GET_BRANCH_RULE = apis.ApiSpec{
	Path:         "/api/cicds/<pipelineid>/actions/get-branch-rule",
	BackendPath:  "/api/cicds/<pipelineid>/actions/get-branch-rule",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.PipelineGetBranchRuleResponse{},
	Doc:          "获取pipeline对应的分支规则",
}
View Source
var ADAPTOR_CICD_INVOKED_COMBO = apis.ApiSpec{
	Path:         "/api/cicds/actions/app-invoked-combos",
	BackendPath:  "/api/cicds/actions/app-invoked-combos",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	RequestType:  apistructs.PipelineInvokedComboRequest{},
	ResponseType: apistructs.PipelineInvokedComboResponse{},
	Doc:          "summary: pipeline 侧边栏 combo",
}
View Source
var ADAPTOR_CICD_LIST = apis.ApiSpec{
	Path:         "/api/cicds",
	BackendPath:  "/api/cicds",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	RequestType:  apistructs.PipelinePageListRequest{},
	ResponseType: apistructs.PipelinePageListResponse{},
	Doc:          "summary: pipeline 列表",
}
View Source
var ADAPTOR_CICD_OPERATE = apis.ApiSpec{
	Path:         "/api/cicds/<pipelineID>",
	BackendPath:  "/api/cicds/<pipelineID>",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodPut,
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	RequestType:  apistructs.PipelineOperateRequest{},
	ResponseType: apistructs.PipelineOperateResponse{},
	Doc:          "summary: 操作 pipeline",
	Audit: func(ctx *spec.AuditContext) error {
		pipelineId, err := ctx.GetParamUInt64("pipelineID")
		if err != nil {
			return err
		}
		var req apistructs.PipelineOperateRequest
		err = ctx.BindRequestData(&req)
		if err != nil {
			return err
		}
		pipelineDTO, err := ctx.Bundle.GetPipeline(pipelineId)
		if err != nil {
			return err
		}
		taskName := ""
		for _, operate := range req.TaskOperates {
			task, err := ctx.Bundle.GetPipelineTask(pipelineDTO.ID, operate.TaskID)
			if err != nil {
				return err
			}
			taskName = task.Name
		}
		return ctx.CreateAudit(&apistructs.Audit{
			Context: map[string]interface{}{
				"projectId":   strconv.FormatUint(pipelineDTO.ProjectID, 10),
				"appId":       strconv.FormatUint(pipelineDTO.ApplicationID, 10),
				"projectName": pipelineDTO.ProjectName,
				"appName":     pipelineDTO.ApplicationName,
				"pipelineId":  strconv.FormatUint(pipelineDTO.ID, 10),
				"taskName":    taskName,
			},
			ProjectID:    pipelineDTO.ProjectID,
			AppID:        pipelineDTO.ApplicationID,
			ScopeType:    "app",
			TemplateName: apistructs.TogglePipelineTaskTemplate,
			ScopeID:      pipelineDTO.ApplicationID,
		})
	},
}
View Source
var ADAPTOR_CICD_PIPELINE_YML_LIST = apis.ApiSpec{
	Path:         "/api/cicds/actions/pipelineYmls",
	BackendPath:  "/api/cicds/actions/pipelineYmls",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodGet,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	RequestType:  apistructs.CICDPipelineYmlListRequest{},
	ResponseType: apistructs.CICDPipelineYmlListResponse{},
	Doc:          "summary: pipeline yml列表",
}
View Source
var ADAPTOR_CICD_PROJECT_CREATE = apis.ApiSpec{
	Path:        "/api/cicds-project",
	BackendPath: "/api/cicds-project",
	Host:        "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:      "http",
	Method:      http.MethodPost,
	IsOpenAPI:   true,
	CheckLogin:  true,
	CheckToken:  true,
}
View Source
var ADAPTOR_CICD_RERUN = apis.ApiSpec{
	Path:         "/api/cicds/<pipelineID>/actions/rerun",
	BackendPath:  "/api/cicds/<pipelineID>/actions/rerun",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodPost,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.PipelineRerunResponse{},
	Doc:          "summary: pipeline 全流程重试",
	Audit: func(ctx *spec.AuditContext) error {
		pipelineId, err := ctx.GetParamUInt64("pipelineID")
		if err != nil {
			return err
		}
		pipelineDTO, err := ctx.Bundle.GetPipeline(pipelineId)
		if err != nil {
			return err
		}
		return ctx.CreateAudit(&apistructs.Audit{
			Context: map[string]interface{}{
				"projectId":   strconv.FormatUint(pipelineDTO.ProjectID, 10),
				"appId":       strconv.FormatUint(pipelineDTO.ApplicationID, 10),
				"projectName": pipelineDTO.ProjectName,
				"appName":     pipelineDTO.ApplicationName,
				"pipelineId":  strconv.FormatUint(pipelineDTO.ID, 10),
			},
			ProjectID:    pipelineDTO.ProjectID,
			AppID:        pipelineDTO.ApplicationID,
			ScopeType:    "app",
			TemplateName: apistructs.RerunPipelineTemplate,
			ScopeID:      pipelineDTO.ApplicationID,
		})
	},
}
View Source
var ADAPTOR_CICD_RERUN_FAILED = apis.ApiSpec{
	Path:        "/api/cicds/<pipelineID>/actions/rerun-failed",
	BackendPath: "/api/cicds/<pipelineID>/actions/rerun-failed",
	Host:        "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:      "http",
	Method:      http.MethodPost,
	IsOpenAPI:   true,
	CheckLogin:  true,
	CheckToken:  true,
	RequestType: apistructs.PipelineRerunFailedResponse{},
	Doc:         "summary: pipeline 从失败节点处开始重试",
	Audit: func(ctx *spec.AuditContext) error {
		pipelineId, err := ctx.GetParamUInt64("pipelineID")
		if err != nil {
			return err
		}
		pipelineDTO, err := ctx.Bundle.GetPipeline(pipelineId)
		if err != nil {
			return err
		}
		return ctx.CreateAudit(&apistructs.Audit{
			Context: map[string]interface{}{
				"projectId":   strconv.FormatUint(pipelineDTO.ProjectID, 10),
				"appId":       strconv.FormatUint(pipelineDTO.ApplicationID, 10),
				"projectName": pipelineDTO.ProjectName,
				"appName":     pipelineDTO.ApplicationName,
				"pipelineId":  strconv.FormatUint(pipelineDTO.ID, 10),
			},
			ProjectID:    pipelineDTO.ProjectID,
			AppID:        pipelineDTO.ApplicationID,
			ScopeType:    "app",
			TemplateName: apistructs.RetryPipelineTemplate,
			ScopeID:      pipelineDTO.ApplicationID,
		})
	},
}
View Source
var ADAPTOR_CICD_RUN = apis.ApiSpec{
	Path:         "/api/cicds/<pipelineID>/actions/run",
	BackendPath:  "/api/cicds/<pipelineID>/actions/run",
	Host:         "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:       "http",
	Method:       http.MethodPost,
	IsOpenAPI:    true,
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.PipelineRunResponse{},

	Doc: "summary: 开始 pipeline",
	Audit: func(ctx *spec.AuditContext) error {
		pipelineId, err := ctx.GetParamUInt64("pipelineID")
		if err != nil {
			return err
		}
		pipelineDTO, err := ctx.Bundle.GetPipeline(pipelineId)
		if err != nil {
			return err
		}
		return ctx.CreateAudit(&apistructs.Audit{
			Context: map[string]interface{}{
				"projectId":   strconv.FormatUint(pipelineDTO.ProjectID, 10),
				"appId":       strconv.FormatUint(pipelineDTO.ApplicationID, 10),
				"projectName": pipelineDTO.ProjectName,
				"appName":     pipelineDTO.ApplicationName,
				"pipelineId":  strconv.FormatUint(pipelineDTO.ID, 10),
			},
			ProjectID:    pipelineDTO.ProjectID,
			AppID:        pipelineDTO.ApplicationID,
			ScopeType:    "app",
			TemplateName: apistructs.StartPipelineTemplate,
			ScopeID:      pipelineDTO.ApplicationID,
		})
	},
}
View Source
var ADAPTOR_CICD_TASK_LOG = apis.ApiSpec{
	Path:        "/api/cicd/<pipelineID>/tasks/<taskID>/logs",
	BackendPath: "/api/cicd/<pipelineID>/tasks/<taskID>/logs",
	Host:        "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	CheckToken:  true,
	Doc:         "summary: cicd 获取任务日志",
}
View Source
var ADAPTOR_CICD_TASK_LOG_DOWNLOAD = apis.ApiSpec{
	Path:        "/api/cicd/<pipelineID>/tasks/<taskID>/logs/actions/download",
	BackendPath: "/api/cicd/<pipelineID>/tasks/<taskID>/logs/actions/download",
	Host:        "gittar-adaptor.marathon.l4lb.thisdcos.directory:1086",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	CheckToken:  true,
	ChunkAPI:    true,
	Doc:         "summary: cicd 下载任务日志",
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL