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

pipeline: add render predefined task func #545

Merged
merged 2 commits into from
Jan 10, 2024

Conversation

Xieql
Copy link
Contributor

@Xieql Xieql commented Jan 9, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:
part of #493

Copy link

netlify bot commented Jan 9, 2024

Deploy Preview for kurator-dev canceled.

Name Link
🔨 Latest commit 420f129
🔍 Latest deploy log https://app.netlify.com/sites/kurator-dev/deploys/659df44cadd0ef000819cc4b

Copy link
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find some function definition

pkg/fleet-manager/pipeline/render/predefined_task.go Outdated Show resolved Hide resolved
pkg/fleet-manager/pipeline/render/predefined_task.go Outdated Show resolved Hide resolved
}

var predefinedTaskTemplates = map[string]string{
GitCloneTask: GitCloneTaskContent,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where are these? A follow up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is very useful for locating the actual pre-task tpl content to be used based on the user's task name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be used in

// RenderPredefinedTask takes a PredefinedTaskConfig object and generates YAML byte array configuration representing the PredefinedTask configuration.
func RenderPredefinedTask(cfg PredefinedTaskConfig) ([]byte, error) {
	templateContent, ok := predefinedTaskTemplates[cfg.TemplateName]
	if !ok {
		return nil, fmt.Errorf("predefinedTask template content named '%s' not found", cfg.TemplateName)
	}

	return renderTemplate(templateContent, generateTaskTemplateName(cfg.TemplateName), cfg)
}

pkg/fleet-manager/pipeline/render/predefined_task.go Outdated Show resolved Hide resolved
@Xieql
Copy link
Contributor Author

Xieql commented Jan 9, 2024

/label tide/merge-method-squash

@Xieql Xieql closed this Jan 9, 2024
@Xieql Xieql reopened this Jan 9, 2024
@Xieql Xieql closed this Jan 10, 2024
@Xieql Xieql reopened this Jan 10, 2024
@Xieql Xieql closed this Jan 10, 2024
@Xieql Xieql reopened this Jan 10, 2024
Signed-off-by: Xieql <[email protected]>
Copy link
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@kurator-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kurator-bot kurator-bot merged commit f28365a into kurator-dev:main Jan 10, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants