-
Notifications
You must be signed in to change notification settings - Fork 32
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
Registry API: Supporting artifacts on resource revisions #774
Comments
I assume this applies higher in the path hierarchy as well? So taking the above heuristic, I might expect that this path:
would obey the above rule: "A list request without the revision ID, projects/demo/locations/global/versions/v1/specs/openapi.yaml/artifacts/- should list artifacts under the latest revision of that spec." I believe that implies that that request must list only the artifacts under the latest revision of every spec? Whereas, to list the all artifacts of all the revisions, one would request this path:
Is this correct? @shrutiparabgoogle @timburks |
Yes, that sounds correct @theganyo |
I agree - that seems like a good interpretation. |
Given this change, I wonder... What was the reason for considering Spec and SpecRevision as separate entities? Would merging these into a Spec (with an optional revision field) be a reasonable simplification? Or would this potentially cause more issues than it solves? |
Discussion on merging Spec and SpecRevision here: #782 |
(Note: Scrapping the above idea of changing naming entities.) Question related to SpecRevision and DeploymentRevision: Are these entities something that the controller needs to support explicitly? For example, listResources can now return artifacts who's parents are SpecRevisions: registry/cmd/registry/controller/controller.go Lines 192 to 201 in 3aacfd1
This won't work properly with the controller as it exists as it expects to work with Specs. As such, we could either add support SpecRevisions as targets or translate the SpecRevisions to Specs. Thoughts, @shrutiparabgoogle ? |
Maybe I can clarify a bit with an example: Basically, I'm trying to clarify a test such as this: https://github.com/apigee/registry/blob/main/cmd/registry/scoring/score_test.go#L200. We've said that we should transparently assume the latest SpecRevision for a Spec. So, in this test, it's all operating at the Spec level. It gets artifacts (retrieved from the latest Spec revision) which are scored and a related artifact is set (on the latest Spec revision). So is this test (basically) still correct? And is the scoring as it exists correct - where it ignores the actual SpecRevision on both for the input and output side when processing Artifacts? Or do we need the scoring resolve a specific SpecRevision for its artifacts after processing the inputs and maintain that through to the output? |
Ok, I discussed a bit with @shrutiparabgoogle and I'm going to try to make the controller's patterns.SpecName resource bridge the gap between the names package names.Spec and names.SpecRevision. And likewise, for Deployment and DeploymentRevision. This should allow the controller to continue to work like the API (which doesn't differentiate between Spec and SpecRevision or Deployment and DeploymentRevision). Then, if we want to refactor the names package to better address this impedance, we can do that later. |
Sounds good. The controller currently doesn't have support for deployments. Once we figure out the SpecRevisions, we can implement the Deployments in the same way. |
I think it's high time I add some detailed explanation on how the controller works currently and what is expected out of it after the revisions change: Take an example of a sample manifest here:
The controller will process the above manifest in two different scenarios: The target resource needs an updateCurrent behavior:
Expected behavior with revisions:
The target resource doesn't exist yet, needs creationCurrent behavior:
Expected behavior with revisions:
For each identified resource above,
@theganyo @timburks Let me know if this sounds okay. The explanations mentioned above don't require any change in the definition of the controller's manifest, thus no user facing change. If we decide to separate out |
Thanks for the clarification. This makes sense to me. |
One issue that remains is to determine how the compute commands that the controller relies on will operate (eg. |
As per the discussion with Tim and Scott, we all concluded that we need to support optional spec revisions in the registry tool commands. The current behavior of the API has an optional use of revisionID, example:
We have a couple of commands in the registry tool which take as input a spec and generates an artifact. The current and expected behavior of such commands should be as follows: 1. Spec Collection Input: 2. Spec Input: 3. SpecRevision Collection Input: 4. SpecRevision Input: The list of commands which will need the update mentioned above:
|
This discussion started when we were thinking about supporting a history of Scores. As we are building more UI features, it is getting more and more difficult to keep track of which spec revision a particular artifact (conformance report, Score, scorecard) belongs to. This is a limitation in conveying the correct information.
Can we evaluate the option of attaching artifacts to a resource's revision?
Motivation:
In our case, we will attach artifacts to SpecRevisions and DeploymentRevisions and keep Apis, Versions, Project as is (resources with no revisions).
This goes in line with our data model, the artifacts that get generated for specs are usually properties of a particular revision (lint reports, scores, etc), same with deployments (security analysis of a particular deployed state). The changes to these artifacts are also usually governed by changes in the revision.
For other generic properties, like Related links, Source code repo, those are usually higher level properties outside the scope of a spec/deployment which will normally get attached to an API. For an API, spec becomes the implementation detail of that API (and deployment becomes an operational detail), hence we predict that most of the characteristics related artifacts will be attached at the API level since that is the unit that users are managing in the registry.
Such artifacts at API level will not have to worry about revisions, they will be one time artifacts which will be preserved whereas for Specs and Deployments, artifacts will need a regeneration every time a new revision gets created.
Following AIP-162, the implementation will look like this:
The example is for Specs here, deployments will also have a similar behavior:
projects/demo/locations/global/apis/petstore/versions/v1/specs/openapi.yaml@0000/artifacts/conformance-report
projects/demo/locations/global/versions/v1/specs/openapi.yaml@0000/artifacts/-
should list all artifactsunder the specified revision.
projects/demo/locations/global/versions/v1/specs/openapi.yaml/artifacts/-
should listartifacts under the latest revision of that spec.
projects/demo/locations/global/versions/v1/specs/openapi.yaml@-/artifacts/-
should list all artifacts under all revisions of that spec.The above implementation is inline with the second scenario explained here
Some caveats to call out:
The text was updated successfully, but these errors were encountered: