Commit 1361f859 by Feanil Patel

Don't run plugin install un-necessarily.

parent d03ef582
...@@ -23,13 +23,17 @@ ...@@ -23,13 +23,17 @@
# Should be resolved in the next release, but until then we need to do this # Should be resolved in the next release, but until then we need to do this
# https://issues.jenkins-ci.org/browse/JENKINS-20407 # https://issues.jenkins-ci.org/browse/JENKINS-20407
- name: workaround for JENKINS-20407 - name: workaround for JENKINS-20407
command: "mkdir -p /var/run/jenkins" file:
path="/var/run/jenkins"
state=directory
owner="{{ jenkins_user }}"
group="{{ jenkins_group }}"
- name: download Jenkins package - name: download Jenkins package
get_url: url="{{ jenkins_deb_url }}" dest="/tmp/{{ jenkins_deb }}" get_url: url="{{ jenkins_deb_url }}" dest="/tmp/{{ jenkins_deb }}"
- name: install Jenkins package - name: install Jenkins package
command: dpkg -i --force-depends "/tmp/{{ jenkins_deb }}" shell: dpkg -i --force-depends "/tmp/{{ jenkins_deb }}"
- name: stop Jenkins - name: stop Jenkins
service: name=jenkins state=stopped service: name=jenkins state=stopped
...@@ -57,8 +61,11 @@ ...@@ -57,8 +61,11 @@
shell: usermod -d {{jenkins_home}} {{jenkins_user}} shell: usermod -d {{jenkins_home}} {{jenkins_user}}
- name: make plugins directory - name: make plugins directory
sudo_user: jenkins file:
shell: mkdir -p {{ jenkins_home }}/plugins path="{{ jenkins_home }}/plugins"
state=directory
owner="{{ jenkins_user }}"
group="{{ jenkins_group }}"
# We first download the plugins to a temp directory and include # We first download the plugins to a temp directory and include
# the version in the file name. That way, if we increment # the version in the file name. That way, if we increment
...@@ -67,15 +74,18 @@ ...@@ -67,15 +74,18 @@
get_url: url=http://updates.jenkins-ci.org/download/plugins/{{ item.name }}/{{ item.version }}/{{ item.name }}.hpi get_url: url=http://updates.jenkins-ci.org/download/plugins/{{ item.name }}/{{ item.version }}/{{ item.name }}.hpi
dest=/tmp/{{ item.name }}_{{ item.version }} dest=/tmp/{{ item.name }}_{{ item.version }}
with_items: jenkins_plugins with_items: jenkins_plugins
register: jenkins_plugin_downloads
- name: install Jenkins plugins - name: install Jenkins plugins
command: cp /tmp/{{ item.name }}_{{ item.version }} {{ jenkins_home }}/plugins/{{ item.name }}.hpi command: cp {{ item.dest}} {{ jenkins_home }}/plugins/{{ item.item.name }}.hpi
with_items: jenkins_plugins with_items: jenkins_plugin_downloads.results
when: item.changed
- name: set Jenkins plugin permissions - name: set Jenkins plugin permissions
file: path={{ jenkins_home }}/plugins/{{ item.name }}.hpi file: path={{ jenkins_home }}/plugins/{{ item.item.name }}.hpi
owner={{ jenkins_user }} group={{ jenkins_group }} mode=700 owner={{ jenkins_user }} group={{ jenkins_group }} mode=700
with_items: jenkins_plugins with_items: jenkins_plugin_downloads.results
when: item.changed
notify: notify:
- restart Jenkins - restart Jenkins
...@@ -88,23 +98,26 @@ ...@@ -88,23 +98,26 @@
repo={{ item.repo_url }} dest=/tmp/{{ item.repo_name }} version={{ item.version }} repo={{ item.repo_url }} dest=/tmp/{{ item.repo_name }} version={{ item.version }}
accept_hostkey=yes accept_hostkey=yes
with_items: jenkins_custom_plugins with_items: jenkins_custom_plugins
register: jenkins_custom_plugins_checkout
- name: compile custom plugins - name: compile custom plugins
command: mvn -Dmaven.test.skip=true install chdir=/tmp/{{ item.repo_name }} command: mvn -Dmaven.test.skip=true install chdir=/tmp/{{ item.item.repo_name }}
with_items: jenkins_custom_plugins with_items: jenkins_custom_plugins_checkout.results
when: item.changed
- name: install custom plugins - name: install custom plugins
command: mv /tmp/{{ item.repo_name }}/target/{{ item.package }} command: mv /tmp/{{ item.item.repo_name }}/target/{{ item.item.package }}
{{ jenkins_home }}/plugins/{{ item.package }} {{ jenkins_home }}/plugins/{{ item.item.package }}
with_items: jenkins_custom_plugins with_items: jenkins_custom_plugins_checkout.results
when: item.changed
notify: notify:
- restart Jenkins - restart Jenkins
- name: set custom plugin permissions - name: set custom plugin permissions
file: path={{ jenkins_home }}/plugins/{{ item.package }} file: path={{ jenkins_home }}/plugins/{{ item.item.package }}
owner={{ jenkins_user }} group={{ jenkins_group }} mode=700 owner={{ jenkins_user }} group={{ jenkins_group }} mode=700
with_items: jenkins_custom_plugins with_items: jenkins_custom_plugins_checkout.results
when: item.changed
# Plugins that are bundled with Jenkins are "pinned". # Plugins that are bundled with Jenkins are "pinned".
# Jenkins will overwrite updated plugins with its built-in version # Jenkins will overwrite updated plugins with its built-in version
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment