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

Add support for dynamic template data computation in template rendering action #1527

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lburgazzoli
Copy link
Contributor

@lburgazzoli lburgazzoli commented Jan 20, 2025

Description

When creating a template rendering action, is is now possible to compute dynamic data based on the current ReconciliationRequest:

action := template.NewAction(
  template.WithData(map[string]any{
	  "ID": id,
	  "SMM": map[string]any{
		  "Name": name,
	  },
	  "Foo": "bar",
  }),
  template.WithDataFn(func(_ context.Context, rr *types.ReconciliationRequest) (map[string]any, error) {
	  return map[string]any{
		  "Foo": "bar",
		  "UID": rr.Instance.GetUID(),
	  }, nil
  }),
)

How Has This Been Tested?

Screenshot or short clip

Merge criteria

  • You have read the contributors guide.
  • Commit messages are meaningful - have a clear and concise summary and detailed explanation of what was changed and why.
  • Pull Request contains a description of the solution, a link to the JIRA issue, and to any dependent or related Pull Request.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Copy link

openshift-ci bot commented Jan 20, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from lburgazzoli. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@lburgazzoli lburgazzoli force-pushed the template-rendering-data branch from 1074a04 to beea74d Compare January 20, 2025 11:27
Copy link

codecov bot commented Jan 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 19.80%. Comparing base (3e897ce) to head (beea74d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1527      +/-   ##
==========================================
+ Coverage   19.69%   19.80%   +0.10%     
==========================================
  Files         161      161              
  Lines       11102    11113      +11     
==========================================
+ Hits         2187     2201      +14     
+ Misses       8683     8681       -2     
+ Partials      232      231       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lburgazzoli lburgazzoli requested a review from grdryn January 20, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

1 participant