Skip to content

Commit

Permalink
feat: Add GetCommonParams for task
Browse files Browse the repository at this point in the history
  • Loading branch information
adevjoe committed Jan 7, 2025
1 parent eab6bc2 commit 1d1afc6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bcs-common/common/task/steps/iface/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ func (c *Context) GetTaskStatus() string {
return c.task.GetStatus()
}

// GetCommonParams get task common params
func (c *Context) GetCommonParams() map[string]string {
return c.task.GetCommonParams()
}

// GetCommonParam get current task param
func (c *Context) GetCommonParam(key string) (string, bool) {
return c.task.GetCommonParam(key)
Expand Down
8 changes: 8 additions & 0 deletions bcs-common/common/task/types/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ func (t *Task) AddStep(step *Step) *Task {
return t
}

// GetCommonParams return all common params
func (t *Task) GetCommonParams() map[string]string {
if t.CommonParams == nil {
t.CommonParams = make(map[string]string, 0)
}
return t.CommonParams
}

// GetCommonParam get common params
func (t *Task) GetCommonParam(key string) (string, bool) {
if t.CommonParams == nil {
Expand Down

0 comments on commit 1d1afc6

Please sign in to comment.