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

Extend plugin API to support transfer handlers #937

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

mandelsoft
Copy link
Contributor

@mandelsoft mandelsoft commented Sep 23, 2024

What this PR does / why we need it

The OCM library already provides an extension point to provide transfer handlers
controlling the transport of component versions from one environment into another one.

A transfer handler controls:

  • how to handle changes in component versions when re-transporting them
  • how to resolve component references and whether they should be transported, also
  • whether sources and resources should be transported by value or by reference.

So far, there were two implementations:

  • a standard implementation working on the standard transfer options, like --recursive or --copy-resources
  • a spiff++ based implementation based on the standard handler adding the capability to influence
    the behaviour based on a spiff script.

On the command line interface always the spiff handler was used which works like the standard handler if no script
is configured.

This PR adds three new features:

  • it supports a hierarchical naming scheme to denote transfer handlers (like for download and upload handlers),
    which can be used un the command line to select and configure supported transfer handler types.
  • it extends the Plugin API to support transfer handler. This way a plugin may implement the transfer handler interface to
    provide an arbitrary rule set controlling the transport process.
  • A general configuration option for handlers allows for passing additional handler configuration

Similar to the uploaders and downloaders the naming scheme for transfer handlers looks as follows:

  • ocm/<builtin handlers>: used for the already existing standard and spiff handlers.
    Additional handlers may now add themselves to appropriate names to be usable from the command line.
  • plugin/' A dedicated handler maps plugin provided transfer handlers into the naming scheme.
    It uses the sub scheme <plugin name>[/<handler name>]. A plugin may provide multiple (named) handlers.

Which issue(s) this PR fixes

Comment on lines 183 to 192
type testDH struct {
DecisionHandlerBase
}

func (d *testDH) DecideOn(p Plugin, question interface{}) (bool, error) {
panic("just a type test")
}

var _ DecisionHandler = (*testDH)(nil)

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
type testDH struct {
DecisionHandlerBase
}
func (d *testDH) DecideOn(p Plugin, question interface{}) (bool, error) {
panic("just a type test")
}
var _ DecisionHandler = (*testDH)(nil)

remove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In Progress
Development

Successfully merging this pull request may close these issues.

3 participants