Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add GetCommonParams for task #3664

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: Add GetCommonParams for task
adevjoe committed Jan 7, 2025
commit 1d1afc6aceb7ad0950a120e1a83f3b632cd871da
5 changes: 5 additions & 0 deletions bcs-common/common/task/steps/iface/context.go
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions bcs-common/common/task/types/task.go
Original file line number Diff line number Diff line change
@@ -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 {