community.general
community.general copied to clipboard
[MODULE] jenkins_plugin: install uncompatible plugin with current Jenkins version
SUMMARY
When state: latest
is set in jenkins_plugin module, it installs the latest plugin version even if it is not compatible with the current Jenkins version.
ISSUE TYPE
- Bug Report
COMPONENT NAME
Module: jenkins_plugin
ANSIBLE VERSION
2.9.10
CONFIGURATION
OS / ENVIRONMENT
Host: Ubuntu 20.04 Remote: MacOS Catalina 10.15
STEPS TO REPRODUCE
- name: Install Jenkins plugins using a password.
jenkins_plugin:
name: "{{ item.name | default(item) }}"
version: "{{ item.version | default(omit) }}"
jenkins_home: "{{ jenkins_home }}"
url_username: "{{ jenkins_admin_username }}"
url_password: "{{ jenkins_admin_password }}"
state: "{{ 'present' if item.version is defined else jenkins_plugins_state }}"
timeout: "{{ jenkins_plugin_timeout }}"
updates_expiration: "{{ jenkins_plugin_updates_expiration }}"
updates_url: "{{ jenkins_updates_url }}"
url: "http://{{ jenkins_hostname }}:{{ jenkins_http_port }}{{ jenkins_url_prefix }}"
with_dependencies: "{{ jenkins_plugins_install_dependencies }}"
owner: "{{ jenkins_process_user }}"
group: "{{ jenkins_process_group }}"
# use_proxy: no
with_items: "{{ jenkins_plugins }}"
when: jenkins_admin_password | default(false)
tags: ['skip_ansible_lint']
register: plugin_result
until: plugin_result is success
retries: 3
delay: 2
EXPECTED RESULTS
It should install the latest compatible plugin version with the current Jenkins version.
ACTUAL RESULTS
It install the most latest version of the plugin regardless of its compatibility.
Files identified in the description:
If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
cc @jtyr @nerzhul click here for bot help
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
The issue is real, but can be workarounded by specifying the version:
community.general.jenkins_plugin:
name: "ansible"
state: latest
update_json_url_segment:
- "update-center.json/version={{ jenkins_version }}"
The version can be obtained for example from the Docker label org.opencontainers.image.version