community.general
community.general copied to clipboard
New module: Jenkins node management
SUMMARY
Add jenkins_node module for managing Jenkins nodes via python-jenkins REST-API package a la the other jenkins_... modules.
Implement basic states of present (create), absent (delete), disabled (offline), enabled (online).
Implement idempotent configuration of
- Almost fully, top-level node options including environment variables and tool locations
- Almost fully, SSH launcher options
- Some JNLP launcher options
After node creation all configuration is done by updating config.xml by the REST API.
All configuration is opt-in - only options specified will be changed on the Jenkins node.
Best effort taken to only issue a configuration change if we believe we have changed a value.
Where options configure plugins e.g. choice of launcher, API is designed to be extensible. See examples - SSH launcher and SSH host key validation. Some advice on how to document parameters beyond the top-level would be appreciated. Best I could figure so far was to show everything in examples.
Tests pending, but all working as intended against local Jenkins instance - submitting for some initial feedback before I get too far into the tests.
ISSUE TYPE
- New Module/Plugin Pull Request
COMPONENT NAME
jenkins_node
ADDITIONAL INFORMATION
The test extra-docs failed with 4 errors:
plugins/modules/jenkins_node.py:0:0: 1 validation error for ModuleDocSchema
doc -> options -> labels -> type:0:0:
string does not match regex "^(any|bits|bool|bytes|dict|float|int|json|jsonarg|list|path|raw|sid|str|tmppath|pathspec|pathlist)$" (type=value_error.str.regex; pattern=^(any|bits|bool|bytes|dict|float|int|json|jsonarg|list|path|raw|sid|str|tmppath|pathspec|pathlist)$):0:0:
plugins/modules/jenkins_node.py:0:0: Did not return correct DOCUMENTATION
The test botmeta failed with 2 errors:
.github/BOTMETA.yml:0:0: Author phyrwork not mentioned as active or inactive maintainer for plugins/modules/jenkins_node.py (mentioned are: )
.github/BOTMETA.yml:0:0: No (active or inactive) maintainer mentioned for plugins/modules/jenkins_node.py
The test ansible-test sanity --test no-assert [explain] failed with 2 errors:
plugins/modules/jenkins_node.py:634:9: raise AssertionError instead of: assert
plugins/modules/jenkins_node.py:1016:13: raise AssertionError instead of: assert
The test ansible-test sanity --test import --python 3.5 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test compile --python 3.5 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: SyntaxError: **_kwargs,
The test ansible-test sanity --test compile --python 2.7 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: SyntaxError: **_kwargs,
The test ansible-test sanity --test no-assert [explain] failed with 2 errors:
plugins/modules/jenkins_node.py:634:9: raise AssertionError instead of: assert
plugins/modules/jenkins_node.py:1016:13: raise AssertionError instead of: assert
The test ansible-test sanity --test import --python 3.5 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test compile --python 3.5 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: SyntaxError: **_kwargs,
The test ansible-test sanity --test compile --python 2.7 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: SyntaxError: **_kwargs,
The test ansible-test sanity --test pylint [explain] failed with 1 error:
plugins/modules/jenkins_node.py:456:29: ansible-format-automatic-specification: Format string contains automatic field numbering specification
The test ansible-test sanity --test no-assert [explain] failed with 2 errors:
plugins/modules/jenkins_node.py:634:9: raise AssertionError instead of: assert
plugins/modules/jenkins_node.py:1016:13: raise AssertionError instead of: assert
The test ansible-test sanity --test import --python 3.5 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test compile --python 3.5 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: SyntaxError: **_kwargs,
The test ansible-test sanity --test compile --python 2.7 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: SyntaxError: **_kwargs,
The test ansible-test sanity --test no-assert [explain] failed with 2 errors:
plugins/modules/jenkins_node.py:634:9: raise AssertionError instead of: assert
plugins/modules/jenkins_node.py:1016:13: raise AssertionError instead of: assert
The test ansible-test sanity --test import --python 2.7 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: traceback: SyntaxError: invalid syntax
The test ansible-test sanity --test compile --python 2.7 [explain] failed with 1 error:
plugins/modules/jenkins_node.py:371:18: SyntaxError: **_kwargs,
The test ansible-test sanity --test validate-modules [explain] failed with 28 errors:
plugins/modules/jenkins_node.py:0:0: doc-choices-do-not-match-spec: Argument 'type' in argument_spec found in launcher defines choices as (['ssh', 'jnlp']) but documentation defines choices as ([])
plugins/modules/jenkins_node.py:0:0: doc-default-does-not-match-spec: Argument 'args' in argument_spec found in launcher defines default as ({}) but documentation defines default as (None)
plugins/modules/jenkins_node.py:0:0: doc-default-does-not-match-spec: Argument 'mode' in argument_spec defines default as ('normal') but documentation defines default as (None)
plugins/modules/jenkins_node.py:0:0: doc-elements-mismatch: Argument 'labels' in argument_spec specifies elements as str,but elements is not documented
plugins/modules/jenkins_node.py:0:0: doc-elements-mismatch: Argument 'tools' in argument_spec specifies elements as dict,but elements is not documented
plugins/modules/jenkins_node.py:0:0: doc-missing-type: Argument 'mode' in argument_spec uses default type ('str') but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: doc-missing-type: Argument 'type' in argument_spec found in launcher uses default type ('str') but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'home' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'name' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'type' in argument_spec found in launcher is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'type' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-type-does-not-match-spec: Argument 'labels' in argument_spec defines type as 'list' but documentation defines type as 'list[str]'
plugins/modules/jenkins_node.py:0:0: doc-type-does-not-match-spec: Argument 'tools' in argument_spec defines type as 'list' but documentation defines type as 'dict'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.name.str: extra keys not allowed @ data['argument_spec']['name']['str']. Got 'str'
plugins/modules/jenkins_node.py:0:0: invalid-documentation: DOCUMENTATION.options.labels.type: not a valid value for dictionary value @ data['options']['labels']['type']. Got 'list[str]'
plugins/modules/jenkins_node.py:0:0: missing-suboption-docs: Argument 'launcher' in argument_spec has sub-options but documentation does not define it
plugins/modules/jenkins_node.py:0:0: missing-suboption-docs: Argument 'tools' in argument_spec has sub-options but documentation does not define it
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'args' in argument_spec found in launcher defines type as 'dict' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'description' in argument_spec defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'home' in argument_spec found in tools defines type as 'path' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'name' in argument_spec found in tools defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'type' in argument_spec found in tools defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'args' found in launcher is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'description' is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'home' found in tools is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'name' found in tools is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'type' found in launcher is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'type' found in tools is listed in the argument_spec, but not documented in the module documentation
The test ansible-test sanity --test validate-modules [explain] failed with 27 errors:
plugins/modules/jenkins_node.py:0:0: doc-choices-do-not-match-spec: Argument 'type' in argument_spec found in launcher defines choices as (['ssh', 'jnlp']) but documentation defines choices as ([])
plugins/modules/jenkins_node.py:0:0: doc-default-does-not-match-spec: Argument 'mode' in argument_spec defines default as ('normal') but documentation defines default as (None)
plugins/modules/jenkins_node.py:0:0: doc-elements-mismatch: Argument 'labels' in argument_spec specifies elements as str,but elements is not documented
plugins/modules/jenkins_node.py:0:0: doc-elements-mismatch: Argument 'tools' in argument_spec specifies elements as dict,but elements is not documented
plugins/modules/jenkins_node.py:0:0: doc-missing-type: Argument 'mode' in argument_spec uses default type ('str') but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: doc-missing-type: Argument 'type' in argument_spec found in launcher uses default type ('str') but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'home' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'name' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'type' in argument_spec found in launcher is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'type' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-type-does-not-match-spec: Argument 'labels' in argument_spec defines type as 'list' but documentation defines type as 'list[str]'
plugins/modules/jenkins_node.py:0:0: doc-type-does-not-match-spec: Argument 'tools' in argument_spec defines type as 'list' but documentation defines type as 'dict'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.name.str: extra keys not allowed @ data['argument_spec']['name']['str']. Got 'str'
plugins/modules/jenkins_node.py:0:0: invalid-documentation: DOCUMENTATION.options.labels.type: not a valid value for dictionary value @ data['options']['labels']['type']. Got 'list[str]'
plugins/modules/jenkins_node.py:0:0: missing-suboption-docs: Argument 'launcher' in argument_spec has sub-options but documentation does not define it
plugins/modules/jenkins_node.py:0:0: missing-suboption-docs: Argument 'tools' in argument_spec has sub-options but documentation does not define it
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'args' in argument_spec found in launcher defines type as 'dict' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'description' in argument_spec defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'home' in argument_spec found in tools defines type as 'path' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'name' in argument_spec found in tools defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'type' in argument_spec found in tools defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'args' found in launcher is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'description' is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'home' found in tools is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'name' found in tools is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'type' found in launcher is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'type' found in tools is listed in the argument_spec, but not documented in the module documentation
The test ansible-test sanity --test validate-modules [explain] failed with 28 errors:
plugins/modules/jenkins_node.py:0:0: doc-choices-do-not-match-spec: Argument 'type' in argument_spec found in launcher defines choices as (['ssh', 'jnlp']) but documentation defines choices as ([])
plugins/modules/jenkins_node.py:0:0: doc-default-does-not-match-spec: Argument 'args' in argument_spec found in launcher defines default as ({}) but documentation defines default as (None)
plugins/modules/jenkins_node.py:0:0: doc-default-does-not-match-spec: Argument 'mode' in argument_spec defines default as ('normal') but documentation defines default as (None)
plugins/modules/jenkins_node.py:0:0: doc-elements-mismatch: Argument 'labels' in argument_spec specifies elements as str,but elements is not documented
plugins/modules/jenkins_node.py:0:0: doc-elements-mismatch: Argument 'tools' in argument_spec specifies elements as dict,but elements is not documented
plugins/modules/jenkins_node.py:0:0: doc-missing-type: Argument 'mode' in argument_spec uses default type ('str') but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: doc-missing-type: Argument 'type' in argument_spec found in launcher uses default type ('str') but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'home' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'name' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'type' in argument_spec found in launcher is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'type' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-type-does-not-match-spec: Argument 'labels' in argument_spec defines type as 'list' but documentation defines type as 'list[str]'
plugins/modules/jenkins_node.py:0:0: doc-type-does-not-match-spec: Argument 'tools' in argument_spec defines type as 'list' but documentation defines type as 'dict'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.name.str: extra keys not allowed @ data['argument_spec']['name']['str']. Got 'str'
plugins/modules/jenkins_node.py:0:0: invalid-documentation: DOCUMENTATION.options.labels.type: not a valid value for dictionary value @ data['options']['labels']['type']. Got 'list[str]'
plugins/modules/jenkins_node.py:0:0: missing-suboption-docs: Argument 'launcher' in argument_spec has sub-options but documentation does not define it
plugins/modules/jenkins_node.py:0:0: missing-suboption-docs: Argument 'tools' in argument_spec has sub-options but documentation does not define it
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'args' in argument_spec found in launcher defines type as 'dict' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'description' in argument_spec defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'home' in argument_spec found in tools defines type as 'path' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'name' in argument_spec found in tools defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'type' in argument_spec found in tools defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'args' found in launcher is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'description' is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'home' found in tools is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'name' found in tools is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'type' found in launcher is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'type' found in tools is listed in the argument_spec, but not documented in the module documentation
The test ansible-test sanity --test validate-modules [explain] failed with 27 errors:
plugins/modules/jenkins_node.py:0:0: doc-choices-do-not-match-spec: Argument 'type' in argument_spec found in launcher defines choices as (['ssh', 'jnlp']) but documentation defines choices as ([])
plugins/modules/jenkins_node.py:0:0: doc-default-does-not-match-spec: Argument 'mode' in argument_spec defines default as ('normal') but documentation defines default as (None)
plugins/modules/jenkins_node.py:0:0: doc-elements-mismatch: Argument 'labels' in argument_spec specifies elements as str,but elements is not documented
plugins/modules/jenkins_node.py:0:0: doc-elements-mismatch: Argument 'tools' in argument_spec specifies elements as dict,but elements is not documented
plugins/modules/jenkins_node.py:0:0: doc-missing-type: Argument 'mode' in argument_spec uses default type ('str') but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: doc-missing-type: Argument 'type' in argument_spec found in launcher uses default type ('str') but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'home' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'name' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'type' in argument_spec found in launcher is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-required-mismatch: Argument 'type' in argument_spec found in tools is required, but is not documented as being required
plugins/modules/jenkins_node.py:0:0: doc-type-does-not-match-spec: Argument 'labels' in argument_spec defines type as 'list' but documentation defines type as 'list[str]'
plugins/modules/jenkins_node.py:0:0: doc-type-does-not-match-spec: Argument 'tools' in argument_spec defines type as 'list' but documentation defines type as 'dict'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.name.str: extra keys not allowed @ data['argument_spec']['name']['str']. Got 'str'
plugins/modules/jenkins_node.py:0:0: invalid-documentation: DOCUMENTATION.options.labels.type: not a valid value for dictionary value @ data['options']['labels']['type']. Got 'list[str]'
plugins/modules/jenkins_node.py:0:0: missing-suboption-docs: Argument 'launcher' in argument_spec has sub-options but documentation does not define it
plugins/modules/jenkins_node.py:0:0: missing-suboption-docs: Argument 'tools' in argument_spec has sub-options but documentation does not define it
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'args' in argument_spec found in launcher defines type as 'dict' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'description' in argument_spec defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'home' in argument_spec found in tools defines type as 'path' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'name' in argument_spec found in tools defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: parameter-type-not-in-doc: Argument 'type' in argument_spec found in tools defines type as 'str' but documentation doesn't define type
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'args' found in launcher is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'description' is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'home' found in tools is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'name' found in tools is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'type' found in launcher is listed in the argument_spec, but not documented in the module documentation
plugins/modules/jenkins_node.py:0:0: undocumented-parameter: Argument 'type' found in tools is listed in the argument_spec, but not documented in the module documentation
The test ansible-test sanity --test pylint [explain] failed with 1 error:
plugins/modules/jenkins_node.py:456:29: ansible-format-automatic-specification: Format string contains automatic field numbering specification
Thanks for your contribution! In case you haven't, please check out the section on adding new modules in CONTRIBUTING.md: https://github.com/ansible-collections/community.general/blob/main/CONTRIBUTING.md#creating-new-modules-or-plugins
Some advice on how to document parameters beyond the top-level would be appreciated.
Grep for "suboptions:". You can use it when type=dict or type=list and elements=dict, for example like this: https://github.com/ansible-collections/community.general/blob/main/plugins/modules/nmcli.py#L129-L164
Grep for "suboptions:". You can use it when
type=dictortype=listandelements=dict, for example like this: https://github.com/ansible-collections/community.general/blob/main/plugins/modules/nmcli.py#L129-L164
Thanks, that will get me some of the way there.
However some of my options e.g. launcher select and configure Jenkins plugin types with different sets of args.
e.g. from the docs (and then expanded a bit to make the point)
- name: Use known hosts file for host key verification when connecting to a node by SSH
community.general.jenkins_node:
name: my-agent
launcher:
type: ssh
args:
host: my-agent.test
port: 22
credentials_id: 0bf9599f-b551-4afe-abae-cde7b14a406c
host_key_verify:
type: content
args:
algorithm: ssh-rsa
key: AAAAB3NzaC1yc2EAAAADAQABAAABgQC...
- name: Set Jenkins node to launch by connecting it to the controller
community.general.jenkins_node:
name: my-agent
launcher:
type: jnlp
args:
data_dir: remoting
work_dir: custom
disable_work_dir: yes
assert_work_dir: no
use_web_socket: no
Internally there are separate ArgumentSpecValidators for each args set, so that at the top-level the args type can just be dict, but of course the types need enumerating and their options documented in full somewhere.
Can you suggest how I could do this?
However some of my options e.g.
launcherselect and configure Jenkins plugintypes with different sets ofargs.e.g. from the docs (and then expanded a bit to make the point)
There is no way to properly document this, except by using examples and annotating them with comments.
What one usually does is provide one sub-option for every type, like args_ssh, args_jnlp. Then you can require args_ssh if type=ssh, require args_jnlp if tpye=jnlp, and make args_ssh and args_jnlp mutually exclusive. See for example https://docs.ansible.com/ansible/latest/collections/community/hrobot/boot_module.html#parameters with the various install_* options (there, type is implicitly set by "which install_* option is set?").
Gradually chipping away at the unit tests when I have time...
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/jenkins_node.py:116:19: W291: trailing whitespace
tests/unit/plugins/modules/test_jenkins_node.py:189:5: E303: too many blank lines (2)
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/jenkins_node.py:116:19: W291: trailing whitespace
tests/unit/plugins/modules/test_jenkins_node.py:189:5: E303: too many blank lines (2)
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/jenkins_node.py:116:19: W291: trailing whitespace
tests/unit/plugins/modules/test_jenkins_node.py:189:5: E303: too many blank lines (2)
The test ansible-test sanity --test pep8 [explain] failed with 2 errors:
plugins/modules/jenkins_node.py:116:19: W291: trailing whitespace
tests/unit/plugins/modules/test_jenkins_node.py:189:5: E303: too many blank lines (2)
The test ansible-test sanity --test validate-modules [explain] failed with 8 errors:
plugins/modules/jenkins_node.py:0:0: attributes-check-mode: The module does declare support for check mode, but the check_mode attribute's support value is 'none'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.0: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][0]. Got 'host_key_verify_none'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.1: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][1]. Got 'host_key_verify_known_hosts'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.2: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][2]. Got 'host_key_verify_provided'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.3: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][3]. Got 'host_key_verify_trusted'
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'host_key_verify_provided' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'host_key_verify_trusted' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'key' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh -> host_key_verify_provided
The test ansible-test sanity --test validate-modules [explain] failed with 7 errors:
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.0: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][0]. Got 'host_key_verify_none'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.1: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][1]. Got 'host_key_verify_known_hosts'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.2: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][2]. Got 'host_key_verify_provided'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.3: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][3]. Got 'host_key_verify_trusted'
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'host_key_verify_provided' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'host_key_verify_trusted' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'key' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh -> host_key_verify_provided
The test ansible-test sanity --test validate-modules [explain] failed with 8 errors:
plugins/modules/jenkins_node.py:0:0: attributes-check-mode: The module does declare support for check mode, but the check_mode attribute's support value is 'none'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.0: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][0]. Got 'host_key_verify_none'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.1: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][1]. Got 'host_key_verify_known_hosts'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.2: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][2]. Got 'host_key_verify_provided'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.3: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][3]. Got 'host_key_verify_trusted'
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'host_key_verify_provided' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'host_key_verify_trusted' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'key' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh -> host_key_verify_provided
The test ansible-test sanity --test validate-modules [explain] failed with 7 errors:
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.0: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][0]. Got 'host_key_verify_none'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.1: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][1]. Got 'host_key_verify_known_hosts'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.2: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][2]. Got 'host_key_verify_provided'
plugins/modules/jenkins_node.py:0:0: invalid-ansiblemodule-schema: AnsibleModule.argument_spec.launch_ssh.mutually_exclusive.3: expected list @ data['argument_spec']['launch_ssh']['mutually_exclusive'][3]. Got 'host_key_verify_trusted'
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'host_key_verify_provided' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'host_key_verify_trusted' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh
plugins/modules/jenkins_node.py:0:0: no-log-needed: Argument 'key' in argument_spec could be a secret, though doesn't have `no_log` set found in launch_ssh -> host_key_verify_provided
Ping @phyrwork
needs_info
@phyrwork This pullrequest is waiting for your response. Please respond or the pullrequest will be closed.
Hey. I haven't been able to work on this for some time now and am unlikely to again for a while.
What is missing is unit test coverage for several of the fields implemented - these are tedious to implement and have taken a long time.
I could cut these fields from the PR to be finished later and tidy up what is done... unless it would be acceptable to submit with less than complete coverage.
The tests don't need to cover everything, they look extensive enough to me to warrant a merge.
But you definitely need to fix the failing tests.
@phyrwork ping
needs_info
@phyrwork This pullrequest is waiting for your response. Please respond or the pullrequest will be closed.
@phyrwork You have not responded to information requests in this pullrequest so we will assume it no longer affects you. If you are still interested in this, please create a new pullrequest with the requested information.