-
Notifications
You must be signed in to change notification settings - Fork 22
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
simple plugin concept #169
Conversation
547dac0
to
2dfade5
Compare
Makefile
Outdated
go build -ldflags "-s -w \ | ||
-X github.com/open-component-model/ocm/pkg/version.gitVersion=$(EFFECTIVE_VERSION) \ | ||
-X github.com/open-component-model/ocm/pkg/version.gitTreeState=$(GIT_TREE_STATE) \ | ||
-X github.com/open-component-model/ocm/pkg/version.gitCommit=$(COMMIT) \ | ||
-X github.com/open-component-model/ocm/pkg/version.buildDate=$(shell date --rfc-3339=seconds | sed 's/ /T/')" \ | ||
-o bin/helminstaller \ | ||
./cmds/helminstaller | ||
go build -ldflags "-s -w \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we refactor the whole build target to be less chaotic, for example:
NOW := $(shell date --rfc-3339=seconds | sed 's/ /T/')
BUILD_FLAGS := "-s -w \
-X github.com/open-component-model/ocm/pkg/version.gitVersion=$(EFFECTIVE_VERSION) \
-X github.com/open-component-model/ocm/pkg/version.gitTreeState=$(GIT_TREE_STATE) \
-X github.com/open-component-model/ocm/pkg/version.gitCommit=$(COMMIT) \
-X github.com/open-component-model/ocm/pkg/version.buildDate=$(NOW)"
build: ${SOURCES}
mkdir -p bin
go build -ldflags $(BUILD_FLAGS) -o bin/ocm ./cmds/ocm
go build -ldflags $(BUILD_FLAGS) -o bin/helminstaller ./cmds/helminstaller
go build -ldflags $(BUILD_FLAGS) -o bin/demo ./cmds/demoplugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Alpha version Using plugins it is possible now to provide additional access methods by separate executables found in a ocm plugin directory. The plugin executable must implement a set of commands: - info <spec> The info command must return a JSON object describing the plugin and its capabilities. So far, it might only provide access methods. It is intended to extend this by downloader and uploader implementations. - accessmethod all access relevant capabilities are available as sub commands for the accessmethod command - validate <spec> a given access specification is validated. It returns additional derived metadata for the given specification - a human readable info text - the consumer id required to determine optional credentials. - the media type, either derived from the spec or a constant. - a hint usable as reference name for local blobs to reconstruct a useful name for exploded imports. - get -c <creds> <spec> dump the provided content to stdout - put -c <creds> -m <mediatype> -h <hint> <access type> not yet used, intended for the uploader support It reads the data from stdin and puts a resulting access spec as JSON on stdout The library now provides a command line frame for a plugin implementation, which must implement a plugin and accessmethod interface. The ocm CLI now provides information about configured plugins. The OCM context can be configured to register the capabilities of detected plugins, which make the addutional extensions available for the regular API usage.
To speed up ocm context creation with plugins, the evaluation of a plugin dir is put into a separate cache now. Context creation then just reuses known plugin dir setup to create a context binding without calling all the plugins.
Unfortunately the pflag string-to-string is not compatible with my StringMap option variant. I had to fix something after the rebase. |
Alpha version
Using plugins it is possible now to provide additional access methods by separate executables found in a ocm plugin directory.
The plugin exectutable must implement a set of commands:
info
The info command must return a JSON object describing the the plugin and its capabilities. So far, it might only provide access methods. It is intended to extend this by downloader and uploader implementations.accessmethod
all access relevant commands are available as sub commands for the accessmethod commandvalidate <spec>
a given access specification is validated. It returns additional derived metadata for the given specificationget -c <creds> <spec>
dump the provided content to stdoutupload
(not yet used) all upload relevant commands are available as sub commands for the upload commandvalidate <name> <repo spec>
a given target specification is validated. It returns additional derived metadata for the given specificationput -c <creds> -a <artifacttype> -m <mediatype> -h <hint> <name> <repo spec>
intended for the uploader support It reads the data from stdin and puts a resulting access spec as JSON on stdoutThe library now provides a command line frame for a plugin implementation, which must implement a plugin and accessmethod interface.
The ocm CLI now provides information about configured plugins.
The OCM context can be configured to register the capabilities of detected plugins, which make the additional extensions available for the regular API usage.
The help command also reflects extensions provided by plugins, now.
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Release note: