<commit_before>---

# Jenkins comes with bundled plugins that get priority during deployment. This
# means that any newer version of a bundled plugin that gets downloaded to
# ~/plugins will be ignored and replaced with the bundled version the next
# time Jenkins is restarted.
#
# A workaround is to download a newer version and pin it (create a .pinned
# file). In this case Jenkins will not atempt to overwrite the newer version.
#
# Pinning a plugin does not mean that newer versions will get ignored. The
# pluginManager will continue to check for newer version and make them avai-
# lable through the web interface.

- name: Enable and start Jenkins
  service:
    name: jenkins
    enabled: yes
    state: started

- name: Wait for Jenkins to be ready
  shell: curl -D - --silent http://localhost:8080/cli/
  register: result
  until: >
    ((result.stdout.find("200 OK") != -1) or
    (result.stdout.find("Authentication required") != -1)) and
    (result.stdout.find("Please wait while") == -1)
  retries: "{{ jenkins_conn_retries }}"
  delay: "{{ jenkins_conn_delay }}"
  changed_when: false
 
- name: Get list of currently installed plugins
  shell: "java -jar {{ jenkins_cli_jar }} -s http://localhost:{{ jenkins_port }}/ list-plugins {{ jenkins_admin_credentials }} | awk '{ print $1 }'"
  register: plugin_list

- name: Install additional plugins and update everything
  get_url:
    dest: "{{ jenkins_home }}/plugins/{{ item }}.jpi"
    url: "{{ jenkins_updates_url }}/latest/{{ item }}.hpi"
    force: yes
    owner: "{{ jenkins_user }}"
  with_items:
    - "{{ plugin_list.stdout_lines }}"
    - "{{ jenkins_plugins }}"
  notify:
    - restart jenkins

- name: Pin all plugins to avoid bundled versions getting reinstalled
  file:
    path: "{{ jenkins_home }}/plugins/{{ item }}.jpi.pinned"
    state: touch
    owner: "{{ jenkins_user }}"
  with_items:
    - "{{ plugin_list.stdout_lines }}"
    - "{{ jenkins_plugins }}"
  notify:
    - restart jenkins

- name: Generate temporary file<commit_msg>Make sure that all the plugins are checked with or w/o authentication<commit_after>---

# Jenkins comes with bundled plugins that get priority during deployment. This
# means that any newer version of a bundled plugin that gets downloaded to
# ~/plugins will be ignored and replaced with the bundled version the next
# time Jenkins is restarted.
#
# A workaround is to download a newer version and pin it (create a .pinned
# file). In this case Jenkins will not atempt to overwrite the newer version.
#
# Pinning a plugin does not mean that newer versions will get ignored. The
# pluginManager will continue to check for newer version and make them avai-
# lable through the web interface.

- name: Enable and start Jenkins
  service:
    name: jenkins
    enabled: yes
    state: started

- name: Wait for Jenkins to be ready
  shell: curl -D - --silent http://localhost:8080/cli/
  register: result
  until: >
    ((result.stdout.find("200 OK") != -1) or
    (result.stdout.find("Authentication required") != -1)) and
    (result.stdout.find("Please wait while") == -1)
  retries: "{{ jenkins_conn_retries }}"
  delay: "{{ jenkins_conn_delay }}"
  changed_when: false

- name: Get list of currently installed plugins
  shell: "java -jar {{ jenkins_cli_jar }} -s http://localhost:{{ jenkins_port }}/ list-plugins | awk '{ print $1 }'"
  register: plugin_list

- name: Install additional plugins and update everything
  get_url:
    dest: "{{ jenkins_home }}/plugins/{{ item }}.jpi"
    url: "{{ jenkins_updates_url }}/latest/{{ item }}.hpi"
    force: yes
    owner: "{{ jenkins_user }}"
  when: not plugin_list.stderr
  with_items:
    - "{{ plugin_list.stdout_lines }}"
    - "{{ jenkins_plugins }}"
  notify:
    - restart jenkins

- name: Pin all plugins to avoid bundled versions getting reinstalled
  file:
    path: "{{ jenkins_home }}/plugins/{{ item }}.jpi.pinned"
    state: touch
    owner: "{{ jenkins_user }}"
  when: not plugin_list.stderr
  with_items:
    - "{{ plugin_list.stdout_lines }}"
    - "{{ jenkins_plugins }}"
  notify:
    - restart jenkins

- name: Get list of currently installed plugins with credentials
  shell: "java -jar {{ jenkins_cli_jar }} -s http://localhost:{{ jenkins_port }}/ list-plugins {{ jenkins_admin_credentials }} | awk '{ print $1 }'"
  register: plugin_list_credentials
  when: plugin_list.stderr

- name: Install additional plugins and update everything
  get_url:
    dest: "{{ jenkins_home }}/plugins/{{ item }}.jpi"
    url: "{{ jenkins_updates_url }}/latest/{{ item }}.hpi"
    force: yes
    owner: "{{ jenkins_user }}"
  when: plugin_list_credentials.stdout_lines is defined
  with_items:
    - "{{ plugin_list_credentials.stdout_lines }}"
    - "{{ jenkins_plugins }}"
  notify:
    - restart jenkins

- name: Pin all plugins to avoid bundled versions getting reinstalled
  file:
    path: "{{ jenkins_home }}/plugins/{{ item }}.jpi.pinned"
    state: touch
    owner: "{{ jenkins_user }}"
  when: plugin_list_credentials.stdout_lines is defined
  with_items:
    - "{{ plugin_list_credentials.stdout_lines }}"
    - "{{ jenkins_plugins }}"
  notify:
    - restart jenkins

- name: Generate temporary file
{'fraction_non_alphanumeric': 0.11812391430225826, 'fraction_numerical': 0.004439297432928006, 'mean_word_length': 3.525764192139738, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6051205', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1605, 'n_words': 546}