fix(be): use pointer for git branch

This commit is contained in:
Denis Gukov 2024-10-19 19:16:32 +05:00
parent 9c99e6bc9d
commit c4d98b1136
2 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ type Task struct {
Limit string `db:"hosts_limit" json:"limit"`
Secret string `db:"-" json:"secret"`
Arguments *string `db:"arguments" json:"arguments"`
GitBranch string `db:"git_branch" json:"git_branch"`
GitBranch *string `db:"git_branch" json:"git_branch"`
UserID *int `db:"user_id" json:"user_id"`
IntegrationID *int `db:"integration_id" json:"integration_id"`

View File

@ -471,8 +471,8 @@ func (t *LocalJob) prepareRun() error {
}
// Override git branch from task if set
if t.Task.GitBranch != "" {
t.Repository.GitBranch = t.Task.GitBranch
if t.Task.GitBranch != nil && *t.Task.GitBranch != "" {
t.Repository.GitBranch = *t.Task.GitBranch
}
if t.Repository.GetType() == db.RepositoryLocal {