Skip to content

Gitops promotion hooks #1277

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

Merged
merged 34 commits into from
May 14, 2025
Merged

Gitops promotion hooks #1277

merged 34 commits into from
May 14, 2025

Conversation

NimRegev
Copy link
Contributor

@NimRegev NimRegev commented Apr 9, 2025

First dart of promotion hooks

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

export JIRA_ISSUE_BASE_URL="{{inputs.parameters.JIRA_BASE_URL}}"
export JIRA_ISSUE_SOURCE_FIELD="{{inputs.parameters.JIRA_ISSUE_SOURCE_FIELD}}"
PROMOTION_CONTEXT=$(echo "{\"JIRA_ISSUE_URL\": \"${JIRA_ISSUE_BASE_URL}/browse/${JIRA_ISSUE_SOURCE_FIELD}\"}")
echo "$PROMOTION_CONTEXT" > /tmp/promotion-context.txt

Choose a reason for hiding this comment

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

again here the important part is the output param, need to add it to the example yaml as well

Expose the file with the promotion context as an output parameter to make it available to promotion mechanism.
* Add `PROMOTION_CONTEXT` as the `name` to `outputs.parameters`. _The name must not be changed_.
* Add the `globalName` attribute to make it available globally. The value must be identical to the name of the promotion context.
* `valueFrom` attribute to reference the file path

Choose a reason for hiding this comment

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

potentially they can take it wherever they want from

Edits after feedback from Dev
@codefresh-git-integration
Copy link

Added draft diagram for promotion context behavior and content updates
@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

Added walkthrough example for promotion context
@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

Copy link
Contributor

@scme0 scme0 left a comment

Choose a reason for hiding this comment

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

Just one minor comment from me. Looks good!

Added example template to define promotion context and use in  promotion hook
@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

1 similar comment
@codefresh-git-integration
Copy link

* **Use a custom service account**
Use your own service account, and bind it to the default service role, `cf-default-promotion-workflows-role`.

## Example of service account and service role
Copy link
Contributor

Choose a reason for hiding this comment

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

Example of a Service Account and a Role

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above; fixed the role but leaving in lowercase

Explore examples in [Codefresh Hub for Argo](https://codefresh.io/argohub/){:target="\_blank"}.

##### Arguments in promotion hooks
A default set of arguments are available to all Promotion Workflows with hooksd. See [Default arguments in Promotion Workflows with hooks](#default-arguments-for-promotion-hooks).
Copy link
Contributor

Choose a reason for hiding this comment

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

hooksd --> hooks

Explore examples in [Codefresh Hub for Argo](https://codefresh.io/argohub/){:target="\_blank"}.

##### Arguments in promotion hooks
A default set of arguments are available to all Promotion Workflows with hooksd. See [Default arguments in Promotion Workflows with hooks](#default-arguments-for-promotion-hooks).
Copy link
Contributor

Choose a reason for hiding this comment

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

This link:
[Default arguments in Promotion Workflows with hooks](#default-arguments-for-promotion-hooks).
doesn't work for me


The table lists key differences between Promotion Workflows containing hooks and Promotion (Pre- and Post-Action) Workflows.

| **Feature** | **Promotion Hooks in Workflows** | **Pre- and Post-Action Workflows** |
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that if we're making reference to "Pre- and Post-Action Workflows", then the second column should be "Promotion Hooks Workflows" (without the in)

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, I had that in the beginning but changed it later. I think I'll add a heading Promotion Workflows and then two column headings below Promotion Hooks and Pre-and Post-Action

Implemented feedback from Francisco's review
@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@codefresh-git-integration
Copy link

@NimRegev NimRegev merged commit e643444 into master May 14, 2025
1 check passed
@NimRegev NimRegev deleted the gitops-auto-promotion-req branch May 14, 2025 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants