Fix plugin secrets in config#6249
Conversation
✅ Deploy Preview for nextflow-docs-staging canceled.
|
|
Here is how I've been testing:
However, it's not loading the It's at least loading |
|
I wonder if the issue is that I'm using the dist release instead of the standard release |
pditommaso
left a comment
There was a problem hiding this comment.
This looks smart. Moving to draft until the problem with the plugins is addressed. Also unit test and integration test should be added (it may be convenience setup a test GH repo for this)
|
It turns out the issue was that I was using the single-VM CE, which doesn't support AWS secrets. It works with AWS Batch. Regarding testing, I don't think we'll need a git repo unless you want to do an e2e test with platform. I'll add a local e2e test that just tests the detection of config secrets -> config reloading. |
|
One minor issue with this double-loading approach is that you can't use secrets in a config include (#5312). On the first load, the secret will be null and the include will likely fail, which means the run will fail However, you should be able to work around this using a dynamic include: includeConfig secrets.GITHUB_TOKEN
? "https://raw.githubusercontent.com/markpanganiban/nf-test/master/ubuntu.config?token=${secrets.GITHUB_TOKEN}"
: '/dev/null'On the first load, it will access the secret, triggering a reload, but won't attempt to include the secured config. On the second load it will include the config. I will add this to the docs on config secrets |
e8f25b9 to
5d5ef8a
Compare
5d5ef8a to
f03a097
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
dd8a536 to
3cb54c2
Compare
3cb54c2 to
2012d05
Compare
2012d05 to
0ba2507
Compare
christopher-hakkaart
left a comment
There was a problem hiding this comment.
Some very minor suggestions. Feel free to ignore if the meaning changes.
|
@bentsherman can you have a look at the conflicts? I've tried but not sure how address them |
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
ef31401 to
59dfb0f
Compare
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
|
@claude review |
|
Claude finished @pditommaso's task —— View job Code Review AnalysisI'll review this PR that implements plugin secrets support in config by introducing a two-stage config loading approach. Todo List:
Review SummaryThis is a well-designed solution for a complex problem. The two-stage config loading approach using a "shim" secrets provider is elegant and minimizes performance impact. ✅ Strengths
🔍 Areas for Consideration1. Error Handling (
|
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
|
Ok, thread safety is not relevant because this code is not expected to run in parallel manner. Added more docs and renamed |
|
This is great! A huge bonus is that now we can do plugins { id 'nf-amazon' }
// Force Phase 2 reload by accessing a secret (even if it doesn't exist)
params.dummy = secrets.DUMMY_SECRET ?: 'default'
// Use conditional to defer S3 access until Phase 2 when plugins are loaded
includeConfig nextflow.plugin.Plugins.getManager()
? 's3://my-bucket/path/to/nextflow.config'
: '/dev/null'Is there a more elegant way to force that second reload of configuration? |
|
I was mainly thinking about config includes that reference a secret like the github token. If you don't actually need a secret then you'll need to use a dummy as in your example. But you can use that to simplify your include: includeConfig secrets.DUMMY_SECRET
? 's3://my-bucket/path/to/nextflow.config'
: '/dev/null'Accessing internal classes like that probably shouldn't be allowed anyway |
|
This is great. We can store the S3 path in a workspace secret and then just have configuration: includeConfig secrets.WORKSPACE_CONFIG ?: '/dev/null' |
Fix #5494 #5943
This PR fixes support for plugin secrets (i.e. AWS secrets) in the config by loading the config before resolving plugins. If the config attempts to use secrets, it will be reloaded with the complete set of secrets providers.
This is possible because plugin config must be static, unlike other config which can be dynamic and reference secrets. Therefore, we can simply load the config to extract the list of plugins (and other config settings like
tower.enabledandprocess.executorwhich can trigger additional core plugins.To minimize the impact of loading the config twice, we only reload the config if we detect that secrets were used by the config on the first load. This way, the double config load should only affect users who want to use secrets in the config.
In summary: