Skip to content

Plugin initialization and configuration#408

Merged
thomas-fossati merged 2 commits intomainfrom
setrofim/plugin
Apr 9, 2026
Merged

Plugin initialization and configuration#408
thomas-fossati merged 2 commits intomainfrom
setrofim/plugin

Conversation

@setrofim
Copy link
Copy Markdown
Collaborator

@setrofim setrofim commented Apr 9, 2026

Add an Init() method to IPluggable. This gets invoked immediately after a plugin is first loaded, giving opportunity for early one-time initialization. This method takes a Parameters object that contain configuration for the plugin.

SchemeImplementationWrapper has been updated to provide a default implementation, so implementing Init() is optional for attestation schemes.

Also, update the lint Makefile target to download and use a local version of golangci-lint to avoid possible compatibility issues with the system-installed version.

Install a specific version of golangci-lint as part of the lint Makefile
target, and use that version for linting.

There are often incompatible changes from version to version of
golangci-lint. Some linters become deprecated, replaced by new onces.
Occasionally, .golangci.yml format changes.

This means we often need to deal with unrelated linter issues before we
can submit pull requests. Moreover, different projects may expect
different linter versions, further necessitating upgrading/downgrading
of the system-installed binary.

To get around this, install a repo-local binary of specific version
automatically as a precondition to running the lint Makefile target. The
version can then be upgrading in a controlled way, independent of other
changes, without impacting other projects.

Signed-off-by: Sergei Trofimov <sergei.trofimov@arm.com>
Comment thread plugin/parameters.go Outdated
Comment thread plugin/parameters.go
// SetString sets the specified key to the specified string value and returns a
// pointer to the Parameters object. If the key already exists, it is
// overwritten.
func (o *Parameters) SetString(key, value string) *Parameters {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am little confused, as to why you need functions on line 138, 145, 152, 159, 166???

Shouldn't the function Set(key string, val any) is enough to handle supported types?

Copy link
Copy Markdown
Collaborator Author

@setrofim setrofim Apr 9, 2026

Choose a reason for hiding this comment

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

Set() may return an error if you give it an unsupported type. The typed SetXXX() methods cannot error, and so can return *Paremeters, allowing chaining, which allows for a more convenient construction of Parameters (e.g. see test code); or, alternatively, you can just ignore the return value since you don't have to worry about error checking.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not sure, providing alternative methods to accomplish the same objective is a great idea. The documentation on // Set() can be improved to state clearly of the supported types and indicating an erroneous results (if passed with un-supported types) thus setting the correct expectations.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not sure, providing alternative methods to accomplish the same objective is a great idea.

Why not? The typed SetXXX() methods are more convenient, and what you would typically want to use if you know the type of what you're putting into parameters since you don't have to do (superfluous) error checking. Set() is more flexible and more convenient when you don't know the type of you're putting in, since you don't have to resolve the type beforehand.

Set() can be improved to state clearly of the supported types and indicating an erroneous results (if passed with un-supported types) thus setting the correct expectations

Done.

Copy link
Copy Markdown
Collaborator

@yogeshbdeshpande yogeshbdeshpande left a comment

Choose a reason for hiding this comment

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

left some comments, will complete review by tomorrow (10/04)

@setrofim setrofim force-pushed the setrofim/plugin branch 2 times, most recently from 402da78 to d69aafd Compare April 9, 2026 14:14
Copy link
Copy Markdown
Collaborator

@jraman567 jraman567 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @setrofim ! It looks good to me.

Just to summarize, the PR addresses two of the issues we were discussing about scheme initialization/loading.

  • If scheme's Init fails, this PR skips that scheme without crashing the process
  • It also supplies scheme-specific parameters

I understand @yogeshbdeshpande is still reviewing, so I'd wait for his approval also. Thank you!

Comment thread vts/cmd/vts-service/README.md Outdated
Copy link
Copy Markdown
Collaborator

@yogeshbdeshpande yogeshbdeshpande left a comment

Choose a reason for hiding this comment

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

LGTM

Add an Init() method to IPluggable. This gets invoked immediately after
a plugin is first loaded, giving opportunity for early one-time
initialization. This method takes a Parameters object that contain
configuration for the plugin.

SchemeImplementationWrapper has been updated to provide a default
implementation, so implementing Init() is optional for attestation
schemes.

Note: as of this commit, the feature is currently unused as none of the
existing attestation schemes require initialization or configuration.

Signed-off-by: Sergei Trofimov <sergei.trofimov@arm.com>
Copy link
Copy Markdown
Contributor

@thomas-fossati thomas-fossati left a comment

Choose a reason for hiding this comment

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

Both commits LGTM, thanks!

@thomas-fossati thomas-fossati merged commit 4a651eb into main Apr 9, 2026
9 checks passed
@setrofim setrofim deleted the setrofim/plugin branch April 9, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants