Skip to content

Conversation

@javirln
Copy link
Member

@javirln javirln commented Dec 16, 2024

This patch creates a new event type WorkflowContract and a few types associated with it. Instruments the code base to be able to send events related to that resource.

Ref #1628

@javirln javirln requested review from jiparis and migmartri December 16, 2024 11:27
@javirln javirln self-assigned this Dec 16, 2024
)

// WorkflowContractBase is the base struct for workflow contract events
type WorkflowContractBase struct {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks @javirln!

BTW, I am curious to see what's your take on the testing framework I put here for the generation of events, let me know what you think.

Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln javirln force-pushed the feat/1628-contracts branch from 23f8f64 to 3e4f441 Compare December 16, 2024 12:11
{
"ActionType": "WorkflowContractContractAttached",
"TargetType": "WorkflowContract",
"TargetID": "1089bb36-e27b-428b-8009-d015c8737c54",
Copy link
Member

Choose a reason for hiding this comment

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

nice!

// or if it has been attached or detached
if opts.ContractID != nil {
if preUpdateWorkflow.ContractID != uuid.Nil {
uc.dispatchContractEvent(ctx, orgID, preUpdateWorkflow.ContractID, preUpdateWorkflow.ContractName, wf.ID, wf.Name, false)
Copy link
Member

Choose a reason for hiding this comment

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

ok, so this is detaching the previous contract and attaching it to a new one?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, in case of a change of contract it sends the detach and attach. See for example when we create a new workflow, we send the event of a new contract attached

Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln javirln merged commit 84f2ec6 into chainloop-dev:main Dec 16, 2024
13 checks passed
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.

2 participants