Allow specifying environment variables when installing an engine plugin as a Swarm service#38441
Conversation
b3df338 to
37c3828
Compare
Codecov Report
@@ Coverage Diff @@
## master #38441 +/- ##
==========================================
- Coverage 36.89% 36.87% -0.03%
==========================================
Files 613 613
Lines 45421 45435 +14
==========================================
- Hits 16760 16754 -6
- Misses 26370 26389 +19
- Partials 2291 2292 +1 |
ae17882 to
cf4c4df
Compare
|
@thaJeztah I've incorporated your suggested change. I could not find any existing tests covering the WithSwarmService adjacent to my WithEnv function. |
|
Can you add a test for this (or modify the swarm plugin create test?) |
|
@cpuguy Sure thing, thanks for the pointer, I'll see if I can add it to the right place in that test. |
|
@cpuguy83 Currently there's no way for the Docker engine to tell what tasks exist for a plugin Swarm service, since they are in a different namespace. Please advise on how to continue writing a test in integration/service/plugin_test.go when the goal should be to verify the task/container for the plugin has the correct environment variables set. |
|
@sirlatrom You should be able to query the tasks API with the service ID as the filter. |
|
@cpuguy83 That works for regular Docker tasks, but the /tasks endpoint only returns tasks that have a |
|
More specifically, it is this bit of code that restricts the runtime of the returned tasks: Lines 42 to 46 in 489b8ed I'll extend the test helper for task listing to allow additional filters, including the |
e16a0de to
11fb7d1
Compare
|
Flaky test is flaky. |
11fb7d1 to
7f6a6d3
Compare
|
I force pushed to get checks to pass, but windowsRS1 still fails. @cpuguy83 Is that test unrelated? I feel like it is. |
7f6a6d3 to
ab32aec
Compare
|
(reserved for my derek commands) |
6c8266f to
8908c31
Compare
399a198 to
7ac049a
Compare
|
Rebased on moby/moby master. |
|
Looks like experimental build fails because of this CRIU test, which I hope is unrelated: The tests failing for z are I don't even know why the Windows tests are failing, but I'm hoping it's also unrelated. |
9f37ce8 to
32bf388
Compare
Allow specifying environment variables when installing an engine plugin as a Swarm service. Invalid environment variable entries (without an equals (`=`) char) will be ignored. Signed-off-by: Sune Keller <[email protected]>
32bf388 to
fca5ee3
Compare
|
@thaJeztah Any chance the "experimental" build could be retried? |
|
Restarted 👍 |
|
Thanks @thaJeztah, looks like it passed the flaky tests this time 😅 Any chance the appropriate maintainers will give this their final judgement? |
|
LGTM |
- What I did
I enabled specifying environment variables when installing a plugin through a Swarm service.
- How I did it
Env []stringfield to thePluginSpectype by modifying its protobuf file, allowing environment variables (and values) to be specified when a plugin is to be installed as a Swarm service.- How to verify it
a) Specify
Env: []string{"MY_ENV_VAR=my-env-value"}in theTaskTemplate.PluginSpecobject of theswarm.ServiceSpecwhen calling the service/create endpoint.Example:
b) The test
TestServicePlugininintegration/service/plugin_test.gonow covers the changed code.- Description for the changelog
Allow specifying environment variables when installing an engine plugin as a Swarm service.
- A picture of a cute animal (not mandatory but encouraged)
