apache / apache/buildstream

Public data in plugin yaml is ignored

Open
#1,964 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
140
Forks
45
Avg merge
1d 3h
Merged PRs (30d)
6

Description

When writing a new plugin e.g.:

my-plugin.py
```
from buildstream import BuildElement

class MyPluginElement(BuildElement):
BST_MIN_VERSION = "2.2"

def setup():
return MyPluginElement
```

my-plugin.yaml
```
variables:
my_var: "some value"

config:
install-commands:
- echo "Installing a file to %{install-root}"
public:
bst:
split-rules:
integration-commands:
- echo "integrating artifacts"
devel:
- /my/custom/development/paths
```

The public section of the YAML is ignored by Buildstream.

Instead it's required to go via the python API:

```python
from buildstream import BuildElement

class MyPluginElement(BuildElement):
BST_MIN_VERSION = "2.2"

def assemble(self, sandbox):
collectdir = super().assemble(sandbox)

bstdata = self.get_public_data("bst")
bstdata["integration-commands"] = [ 'echo "integrating artifacts" ' ]
bstdata["split-rules"] = {
"devel" : [ " /my/custom/development/paths" ]
}
self.set_public_data("bst", bstdata)

return collectdir

def setup():
return MyPluginElement
````

Proposed solutions from @gtristan

It should either (A) Be supported or (B) Trigger a validation error at load time

Contributor guide

Open the contributing guide

Research direction

Compare the public section in my-plugin.yaml with the get_public_data("bst") and set_public_data("bst", ...) path shown in my-plugin.py. Start by loading the example plugin and trace how its YAML is handled. Done means the public YAML is honored, or loading it produces a clear validation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.