community.general icon indicating copy to clipboard operation
community.general copied to clipboard

[MODULE] jenkins_plugin: install uncompatible plugin with current Jenkins version

Open nikola197 opened this issue 3 years ago • 4 comments

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.


nikola197 avatar Sep 02 '20 13:09 nikola197

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.

click here for bot help

ansibullbot avatar Sep 02 '20 13:09 ansibullbot

cc @jtyr @nerzhul click here for bot help

ansibullbot avatar Sep 02 '20 13:09 ansibullbot

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.

click here for bot help

ansibullbot avatar Nov 11 '22 02:11 ansibullbot

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

cf-sewe avatar Feb 12 '24 15:02 cf-sewe