mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 11:47:36 +08:00
support plugin dockerfile username and password
This commit is contained in:
parent
d4a45dd9d1
commit
b1e208b5f8
@ -310,6 +310,8 @@ func (p *PluginAction) buildPlugin(b *api_model.BuildPluginStruct, plugin *dbmod
|
||||
ImageInfo: b.Body.ImageInfo,
|
||||
Repo: b.Body.RepoURL,
|
||||
GitURL: plugin.GitURL,
|
||||
GitUsername: b.Body.Username,
|
||||
GitPassword: b.Body.Password,
|
||||
}
|
||||
taskType := "plugin_image_build"
|
||||
if plugin.BuildModel == "dockerfile" {
|
||||
|
@ -218,6 +218,14 @@ type BuildPluginStruct struct {
|
||||
// in: body
|
||||
// required: false
|
||||
RepoURL string `json:"repo_url" validate:"repo_url"`
|
||||
// git 账户名
|
||||
// in: body
|
||||
// required: false
|
||||
Username string `json:"username"`
|
||||
// git 密码
|
||||
// in: body
|
||||
// required: false
|
||||
Password string `json:"password"`
|
||||
// 版本信息, 协助选择插件版本
|
||||
// in:body
|
||||
// required: true
|
||||
|
@ -90,7 +90,7 @@ func (e *exectorManager) runD(t *model.BuildPluginTaskBody, logger event.Logger)
|
||||
if err := util.CheckAndCreateDir(sourceDir); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := sources.GitClone(sources.CodeSourceInfo{RepositoryURL: t.GitURL, Branch: t.Repo}, sourceDir, logger, 4); err != nil {
|
||||
if _, err := sources.GitClone(sources.CodeSourceInfo{RepositoryURL: t.GitURL, Branch: t.Repo, User: t.GitUsername, Password: t.GitPassword}, sourceDir, logger, 4); err != nil {
|
||||
logger.Error("拉取代码失败", map[string]string{"step": "builder-exector", "status": "failure"})
|
||||
logrus.Errorf("[plugin]git clone code error %v", err)
|
||||
return err
|
||||
|
@ -26,6 +26,8 @@ type BuildPluginTaskBody struct {
|
||||
Operator string `json:"operator"`
|
||||
Repo string `json:"repo"`
|
||||
GitURL string `json:"git_url"`
|
||||
GitUsername string `json:"git_username"`
|
||||
GitPassword string `json:"git_password"`
|
||||
ImageURL string `json:"image_url"`
|
||||
EventID string `json:"event_id"`
|
||||
DeployVersion string `json:"deploy_version"`
|
||||
|
Loading…
Reference in New Issue
Block a user