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 DeployResourceCommand #301

Merged
merged 8 commits into from
Apr 12, 2022

Conversation

remcowesterhoud
Copy link
Contributor

@remcowesterhoud remcowesterhoud commented Apr 8, 2022

Description

Since Zeebe 8.0.0 the DeployCommand has been deprecated and the DeployResourceCommand has been added. This PR adds support for the new command and makes sure we are defaulting to this in our QA tests.

A refactoring had to be done in order to support both the DeployCommand and the DeployResourceCommand. The commit messages will provide more context on why this was necessary.

Related issues

closes #274
closes #298

Definition of Done

Not all items need to be done depending on the issue and the pull request.

Code changes:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually

Documentation:

  • Javadoc has been written
  • The documentation is updated

@github-actions
Copy link

github-actions bot commented Apr 8, 2022

Unit Test Results

  32 files    32 suites   1m 27s ⏱️
  98 tests   98 ✔️ 0 💤 0
307 runs  307 ✔️ 0 💤 0

Results for commit 45b2973.

♻️ This comment has been updated with latest results.

@remcowesterhoud remcowesterhoud requested a review from korthout April 8, 2022 15:36
@remcowesterhoud
Copy link
Contributor Author

@korthout It was a bit of a challenge adding support for the DeployResourceCommand. Since you know all about this I'd like to see your opinion on it!

@remcowesterhoud remcowesterhoud force-pushed the 298_deploy_resource_command branch from ac314a9 to b80f3c2 Compare April 12, 2022 08:58
Copy link
Member

@korthout korthout left a comment

Choose a reason for hiding this comment

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

LGTM 👍

It was a bit of a challenge adding support for the DeployResourceCommand. Since you know all about this I'd like to see your opinion on it!

I understand the difficulty in that the value type of the records on the log stream didn't change, and the logic to decide what the response type is depended on the value type. I see no other solution than to change that logic. So your solution seems fine to me.

🔧 What I'm still missing is assertions for the deployed decisions and decisions requirements, but I expect that you want to postpone this. I think that's fine.

Apart from that, I have a few nitpicked suggestions.

Nice work altogether 👏

This test checks if all the gateway endpoints are implemented. Since gRPC does not provide an interface which can force this during compile time we are at risk that updating the Zeebe version could result in ZPT not supporting all endpoints that can be triggered from the client. To circumvent this problem this test was created to make sure we implement all the methods gRPC expects us to.
The response mapping has been moved from the GrpcResponseWriter to the GrpcToLogStreamGateway. The writer still contains the mapping functions, but they are called from the gateway.

This change is necessary in order to support both the DeployProcessCommand as the DeployResourceCommand. In the writer we don't have any context about the request available. Therefore it is unknown which request we received, and also which response we should return. The mapping was based on the ValueType of the record which is the same for both of these commands.

By letting the gateway decide which mapper should be used this problem has been resolved. At the point of entry of the request we will also decide which mapper should be used for the response. We nog longer need to decide the mapper base on the ValueType.
DeployProcessCommand is deprecated since Zeebe 8.0.0. In return a new command has been added to the client: DeployResourceCommand. This commit makes it possible to receive this command and return the appropriate response.
DeployCommand has been deprecated since Zeebe 8.0.0. We should use the new DeployResourceCommand as an alternative.
@remcowesterhoud remcowesterhoud force-pushed the 298_deploy_resource_command branch from b80f3c2 to 0c94eae Compare April 12, 2022 13:47
@remcowesterhoud
Copy link
Contributor Author

remcowesterhoud commented Apr 12, 2022

What I'm still missing is assertions for the deployed decisions and decisions requirements, but I expect that you want to postpone this. I think that's fine.

Yes, as of now only the absolute bare minimum has been done regarding DMN so ZPT wouldn't break. No specific assertions are added, nor are they planned. For now users can verify their DMN by checking the result variables.
I can see this changing sometime in the future though 😄

@remcowesterhoud remcowesterhoud merged commit 33acbbc into main Apr 12, 2022
@remcowesterhoud remcowesterhoud deleted the 298_deploy_resource_command branch April 12, 2022 14:02
@github-actions
Copy link

Backport failed for stable/8.0, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin stable/8.0
git worktree add -d .worktree/backport-301-to-stable/8.0 origin/stable/8.0
cd .worktree/backport-301-to-stable/8.0
git checkout -b backport-301-to-stable/8.0
ancref=$(git merge-base 7fd433083f5a0eb017e8658c604e0c8812f5316e 45b29737242f3e9ef2ae3b80a885ebe5b924d14e)
git cherry-pick -x $ancref..45b29737242f3e9ef2ae3b80a885ebe5b924d14e

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.

DeployResourceCommand fails Modify deploy method in Utilities to use the DeployResource command
2 participants