Add e2e support for setting backend via Policy#630
Merged
mszostok merged 15 commits intocapactio:mainfrom Feb 17, 2022
Merged
Conversation
db40490 to
3879e09
Compare
291ef2c to
99f99f1
Compare
99f99f1 to
c9f0c7f
Compare
e78a8ae to
9848484
Compare
mszostok
commented
Feb 11, 2022
9848484 to
7066856
Compare
05e7b08 to
5a4a9b9
Compare
0e1ff6b to
7c8a5e4
Compare
This was referenced Feb 15, 2022
mszostok
commented
Feb 15, 2022
pkosiec
approved these changes
Feb 16, 2022
cf144d8 to
020110a
Compare
pkosiec
approved these changes
Feb 17, 2022
Collaborator
pkosiec
left a comment
There was a problem hiding this comment.
👍 LGTM - I just posted very last comments as I noticed an improvement with quoting all the names (aliases, type references, etc.).
(remember about switching manifest location to the capactio/hub-manifests#main for make dev-cluster)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Changes proposed in this pull request:
Changes
Logger aware Argo Renderer
Update CRD:
Update Engine GraphQL to show backend information for output TypeInstance
Update Local Hub GraphQL schemas and examples.
TypeInstanceBackendand handle it properly in Cypher. This is a draft implementation but already gives us a huge benefit as it enabled an option to create e2e test and protect current contract. If we rewrite/refactor Local Hub, we can protect ourselves from regressions.Ensure that core storage is registered when Local Hub starts.
Add support for setting backend based on TypeRefs via Global Policy and Action Policy (support custom merging):
Extends workflow syntax with
capact-outputTypeInstance[*].backendUpdate Argo renderer to support backends based on TypeRef or
capact-outputTypeInstance[*].backendalias. Once rendered the delegated backend storage is deterministic as it's "hardcoded" to a given ID.Add integration test for:
Success:
Other:
COMPONENTSandBUILD_IMAGES_LISTenvs. TODO: update dev doc on website.Testing
Integration tests prove that it works but here is also a “manual” opt to run a few examples:
Build Capact CLI:
make build-tool-cliand use for all below commands.Create TypeInstances for update and download:
Create Helm storage TypeInstance:
Scenarios
Success:
Create action with default (built-in) storage as Policy is empty and Implementation doesn't use any
requiredbackend.capact act create cap.interface.capactio.capact.validation.action.passing --name test --type-instances-from-file /tmp/act-input-ti.yaml[ { "backend": { "abstract": true, "id": "318b99bd-9b26-4bc1-8259-0a7ff5dae61c" }, "id": "12d18143-49b9-4604-9a4e-eb407ca76c78", "typeRef": { "path": "cap.type.capactio.capact.validation.upload", "revision": "0.1.0" } }, { "backend": { "abstract": true, "id": "318b99bd-9b26-4bc1-8259-0a7ff5dae61c" }, "id": "b06c97bc-0546-450f-a34d-8f38966dbea0", "typeRef": { "path": "cap.type.capactio.capact.validation.update", "revision": "0.1.0" } } ]Create action with default storage based on
typeinstacePolicy.[ { "backend": { "abstract": false, "id": "e9d424b3-c55d-4b02-9e92-9c736b96f98e" }, "id": "4fd10ff0-5eca-46db-b95e-3c8bab3767ba", "typeRef": { "path": "cap.type.capactio.capact.validation.upload", "revision": "0.1.0" } }, { "backend": { "abstract": true, "id": "318b99bd-9b26-4bc1-8259-0a7ff5dae61c" }, "id": "b06c97bc-0546-450f-a34d-8f38966dbea0", "typeRef": { "path": "cap.type.capactio.capact.validation.update", "revision": "0.1.0" } } ]Create Action with Helm storage, which is enforced in Implementation
requiressection.Create required TypeInstance:
Update Global Policy:
Create Action input:
Run Action
capact act run & capact act watchGet Action output TypeInstances:
Example output:
[ { "backend": { "abstract": false, "id": "e9d424b3-c55d-4b02-9e92-9c736b96f98e" }, "id": "cdf4ff38-f66e-4d03-a6ed-1093f154d3af", "typeRef": { "path": "cap.type.capactio.capact.validation.upload", "revision": "0.1.0" } } ]Check with
capact ti getthatuseswere properly set for a given Storage Backends.Above scenarios can be repeated with Action Policy which will override the Global Policy.
Failures:
Create action with wrong type as storage for TypeRef
Expected output:
Create action without storage injected as requires part
Expected output:
Create action with wrong type as storage injected as requires part
Expected output:
Wrong
capact-outputTypeInstances[].backendtype.injectedin https://github.com/mszostok/os-hub-manifests/blob/policy-syntax/type-instances/manifests/implementation/capactio/capact/validation/action/passing-b.yaml#L73. Next, populate updated manifests.Missing
capact-outputTypeInstances[].backendtype.somethingin https://github.com/mszostok/os-hub-manifests/blob/policy-syntax/type-instances/manifests/implementation/capactio/capact/validation/action/passing-b.yaml#L73. Next, populate updated manifests.Related issue(s)
backend.id(Policy, Workflow, GraphQL) #624