This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Migrate to Jenkins 2.x

  • Loading branch information...
BR0kEN- committed Dec 24, 2016
1 parent 4a37c21 commit b596bd97db2476410e179f9a31597cac61f90130
Showing with 465 additions and 346 deletions.
  1. +20 −22 scripts/roles/cibox-jenkins/defaults/main.yml
  2. +5 −9 scripts/roles/cibox-jenkins/tasks/cli.yml
  3. +0 −28 scripts/roles/cibox-jenkins/tasks/configure.yml
  4. +23 −6 scripts/roles/cibox-jenkins/tasks/install.yml
  5. +5 −11 scripts/roles/cibox-jenkins/tasks/repo.yml
  6. +1 −10 scripts/roles/cibox-jenkins/templates/configs/com.cloudbees.jenkins.GitHubPushTrigger.xml.j2
  7. +9 −47 scripts/roles/cibox-jenkins/templates/configs/config.xml.j2
  8. +4 −4 scripts/roles/cibox-jenkins/templates/configs/credentials.xml.j2
  9. +2 −2 scripts/roles/cibox-jenkins/templates/configs/hudson.maven.MavenModuleSet.xml.j2
  10. +1 −1 scripts/roles/cibox-jenkins/templates/configs/hudson.plugins.analysis.core.GlobalSettings.xml.j2
  11. +279 −62 scripts/roles/cibox-jenkins/templates/configs/hudson.plugins.ansicolor.AnsiColorBuildWrapper.xml.j2
  12. +5 −5 scripts/roles/cibox-jenkins/templates/configs/hudson.plugins.git.GitSCM.xml.j2
  13. +1 −1 scripts/roles/cibox-jenkins/templates/configs/hudson.scm.CVSSCM.xml.j2
  14. +1 −1 scripts/roles/cibox-jenkins/templates/configs/hudson.tasks.Ant.xml.j2
  15. +2 −2 scripts/roles/cibox-jenkins/templates/configs/hudson.tasks.Mailer.xml.j2
  16. +1 −1 scripts/roles/cibox-jenkins/templates/configs/hudson.tasks.Maven.xml.j2
  17. +1 −1 scripts/roles/cibox-jenkins/templates/configs/hudson.tasks.Shell.xml.j2
  18. +1 −1 scripts/roles/cibox-jenkins/templates/configs/hudson.triggers.SCMTrigger.xml.j2
  19. +1 −1 scripts/roles/cibox-jenkins/templates/configs/jenkins.model.ArtifactManagerConfiguration.xml.j2
  20. +1 −1 scripts/roles/cibox-jenkins/templates/configs/jenkins.model.DownloadSettings.xml.j2
  21. +1 −1 scripts/roles/cibox-jenkins/templates/configs/jenkins.model.JenkinsLocationConfiguration.xml.j2
  22. +1 −1 scripts/roles/cibox-jenkins/templates/configs/jenkins.mvn.GlobalMavenConfig.xml.j2
  23. +1 −1 .../templates/configs/org.jenkinsCi.plugins.projectDescriptionSetter.DescriptionSetterWrapper.xml.j2
  24. +38 −20 scripts/roles/cibox-jenkins/templates/configs/org.jenkinsci.plugins.ghprb.GhprbTrigger.xml.j2
  25. +1 −1 scripts/roles/cibox-jenkins/templates/configs/org.jenkinsci.plugins.gitclient.JGitTool.xml.j2
  26. +1 −1 scripts/roles/cibox-jenkins/templates/configs/org.jvnet.hudson.plugins.SSHBuildWrapper.xml.j2
  27. +3 −18 scripts/roles/cibox-jenkins/templates/jobs/backup_prod_db.xml.j2
  28. +5 −4 scripts/roles/cibox-jenkins/templates/jobs/builder.xml.j2
  29. +4 −16 scripts/roles/cibox-jenkins/templates/jobs/disk_usage_trigger.xml.j2
  30. +36 −14 scripts/roles/cibox-jenkins/templates/jobs/pr_builder.xml.j2
  31. +0 −42 scripts/roles/cibox-jenkins/templates/users/root.xml.j2
  32. +11 −11 scripts/roles/cibox-jenkins/vars/main.yml
@@ -27,25 +27,23 @@ jenkins_data:
template: root.xml.j2

plugins:
- http://mirrors.jenkins-ci.org/plugins/ansicolor/0.4.2/ansicolor.hpi
- http://mirrors.jenkins-ci.org/plugins/token-macro/1.11/token-macro.hpi
- http://mirrors.jenkins-ci.org/plugins/ssh-agent/1.8/ssh-agent.hpi
- http://mirrors.jenkins-ci.org/plugins/plain-credentials/1.1/plain-credentials.hpi
- http://mirrors.jenkins-ci.org/plugins/credentials/1.22/credentials.hpi
- http://mirrors.jenkins-ci.org/plugins/git-client/1.19.0/git-client.hpi
- http://mirrors.jenkins-ci.org/plugins/git/2.4.0/git.hpi
- http://mirrors.jenkins-ci.org/plugins/github-api/1.69/github-api.hpi
- http://mirrors.jenkins-ci.org/plugins/github/1.14.0/github.hpi
- http://mirrors.jenkins-ci.org/plugins/ghprb/1.15-0/ghprb.hpi
- http://mirrors.jenkins-ci.org/plugins/htmlpublisher/1.9/htmlpublisher.hpi
- http://mirrors.jenkins-ci.org/plugins/jquery/1.11.2-0/jquery.hpi
- http://mirrors.jenkins-ci.org/plugins/matrix-auth/1.2/matrix-auth.hpi
- http://mirrors.jenkins-ci.org/plugins/matrix-project/1.6/matrix-project.hpi
- http://mirrors.jenkins-ci.org/plugins/project-description-setter/1.1/project-description-setter.hpi
- http://mirrors.jenkins-ci.org/plugins/ssh-credentials/1.11/ssh-credentials.hpi
- http://mirrors.jenkins-ci.org/plugins/hipchat/0.2.0/hipchat.hpi
- http://mirrors.jenkins-ci.org/plugins/scm-api/0.2/scm-api.hpi
- http://mirrors.jenkins-ci.org/plugins/scripttrigger/0.31/scripttrigger.hpi
- http://mirrors.jenkins-ci.org/plugins/parameterized-trigger/2.28/parameterized-trigger.hpi

jenkins_pkg_version: http://pkg.jenkins-ci.org/debian/binary/jenkins_1.656_all.deb
ansicolor: latest
token-macro: latest
ssh-agent: latest
plain-credentials: latest
credentials: latest
git-client: latest
git: latest
github-api: latest
github: latest
ghprb: latest
htmlpublisher: latest
jquery: latest
matrix-auth: latest
matrix-project: latest
project-description-setter: latest
ssh-credentials: latest
scripttrigger: latest
parameterized-trigger: latest
slack: latest
simple-theme-plugin: latest
@@ -4,34 +4,30 @@
port: "{{ jenkins_port }}"
delay: 10

# Create Jenkins CLI destination directory
- name: Create Jenkins CLI destination directory
file:
path: "{{ jenkins_dest }}"
state: directory

# Get Jenkins CLI from localhost
- name: Get Jenkins CLI
get_url:
url: "{{ jenkins_host }}/jnlpJars/jenkins-cli.jar"
dest: "{{ jenkins.cli_dest }}"
dest: "{{ jenkins.cli }}"
mode: 0440
delay: 20
retries: 5
register: cli_downloaded
until: not "failed" in cli_downloaded

# Get latest Jenkins update file
- name: Get Jenkins updates
- name: Get updates
get_url:
url: http://updates.jenkins-ci.org/update-center.json
dest: "{{ jenkins.updates_dest }}"
dest: "{{ jenkins.updates }}"
mode: 0440
thirsty: yes
register: jenkins_updates

# Jenkins Update-center
- name: Update-center Jenkins
shell: "cat {{ jenkins.updates_dest }} | sed '1d;$d' | curl -X POST -H 'Accept: application/json' -d @- {{ jenkins_host }}/updateCenter/byId/default/postBack"
- name: Update-center
shell: "cat {{ jenkins.updates }} | sed '1d;$d' | curl -X POST -H 'Accept: application/json' -d @- {{ jenkins_host }}/updateCenter/byId/default/postBack"
when: jenkins_updates.changed
notify: Restart Jenkins

This file was deleted.

Oops, something went wrong.
@@ -3,7 +3,7 @@

- name: Download Jenkins
get_url:
url: "{{ jenkins_pkg_version }}"
url: "{{ jenkins.package }}"
dest: ~/jenkins.deb
mode: 440

@@ -13,7 +13,8 @@
dest: /etc/default/jenkins

- name: Install Jenkins
shell: "dpkg -i ~/jenkins.deb"
# Do not override previously created Jenkins config during installation.
shell: "yes N | dpkg -i ~/jenkins.deb"

- name: Restart service
service:
@@ -22,9 +23,27 @@

- include: cli.yml

- name: Copy configs
template:
src: "configs/{{ item | basename }}"
dest: '{{ jenkins_lib }}/{{ item | basename | regex_replace("\.j2", "") }}'
owner: "{{ jenkins_data.user }}"
group: "{{ jenkins_data.group }}"
force: yes
with_fileglob: ../templates/configs/*.j2

- name: Restart service
service:
name: jenkins
state: restarted

- name: Install/update plugins
shell: "java -jar {{ jenkins.cli_dest }} -s {{ jenkins_host }} install-plugin {{ item }}"
with_items: "{{ plugins }}"
# Firstly: plugin downloading.
# Secondly: install plugin dependencies.
shell: >
java -jar {{ jenkins.cli }} -s {{ jenkins_host }} install-plugin http://mirrors.jenkins-ci.org/plugins/{{ item.key }}/{{ item.value }}/{{ item.key }}.hpi &&
curl -X POST -d "<jenkins><install plugin='{{ item.key }}@{{ item.value }}' /></jenkins>" -H 'Content-Type: text/xml' {{ jenkins_host }}/pluginManager/installNecessaryPlugins
with_dict: "{{ plugins }}"
notify: Restart Jenkins

- name: Restore service
@@ -44,5 +63,3 @@
lineinfile:
dest: /etc/sudoers
line: "{{ jenkins_data.user }} ALL=(ALL) NOPASSWD:ALL"

- include: configure.yml
@@ -1,23 +1,17 @@
---
# Add Jenkins repository key
- name: Add jenkins apt-key
- name: Add APT key
apt_key:
url: "{{ jenkins.deb.key }}"
url: "{{ jenkins.key }}"
state: present

# Add Jenkins repository
- name: Add Jenkins repository
- name: Add APT repository
apt_repository:
repo: "{{ jenkins.deb.repo }}"
repo: "{{ jenkins.repo }}"
state: present
ignore_errors: yes

# Ugly workaround fixing the auto-add src repo when using apt_repository
#- name: Remove invalid Jenkins src repository
# action: command sed --in-place '/deb-src.*pkg.jenkins-ci/d' /etc/apt/sources.list

- name: Install dependencies
apt:
pkg: "{{ item }}"
state: installed
with_items: "{{ jenkins.deb.dependencies }}"
with_items: "{{ jenkins.dependencies }}"
@@ -1,11 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<com.cloudbees.jenkins.GitHubPushTrigger_-DescriptorImpl plugin="github@1.9.1">
<manageHook>true</manageHook>
<credentials>
<com.cloudbees.jenkins.Credential>
<username></username>
<apiUrl>https://api.github.com</apiUrl>
<oauthAccessToken>CHANGE_ME</oauthAccessToken>
</com.cloudbees.jenkins.Credential>
</credentials>
</com.cloudbees.jenkins.GitHubPushTrigger_-DescriptorImpl>
<com.cloudbees.jenkins.GitHubPushTrigger_-DescriptorImpl plugin="github@1.25.0"/>
@@ -1,51 +1,14 @@
<?xml version='1.0' encoding='UTF-8'?>
<hudson>
<disabledAdministrativeMonitors/>
<version>1.577</version>
<disabledAdministrativeMonitors>
<string>jenkins.diagnostics.SecurityIsOffMonitor</string>
</disabledAdministrativeMonitors>
<version>2.37</version>
<numExecutors>2</numExecutors>
<mode>NORMAL</mode>
<useSecurity>false</useSecurity>
<authorizationStrategy class="hudson.security.GlobalMatrixAuthorizationStrategy">
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.Create:root</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.Delete:root</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.ManageDomains:root</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.Update:root</permission>
<permission>com.cloudbees.plugins.credentials.CredentialsProvider.View:root</permission>
<permission>hudson.model.Computer.Build:root</permission>
<permission>hudson.model.Computer.Configure:root</permission>
<permission>hudson.model.Computer.Connect:root</permission>
<permission>hudson.model.Computer.Create:root</permission>
<permission>hudson.model.Computer.Delete:root</permission>
<permission>hudson.model.Computer.Disconnect:root</permission>
<permission>hudson.model.Hudson.Administer:root</permission>
<permission>hudson.model.Hudson.ConfigureUpdateCenter:root</permission>
<permission>hudson.model.Hudson.Read:anonymous</permission>
<permission>hudson.model.Hudson.Read:root</permission>
<permission>hudson.model.Hudson.RunScripts:anonymous</permission>
<permission>hudson.model.Hudson.RunScripts:root</permission>
<permission>hudson.model.Hudson.UploadPlugins:anonymous</permission>
<permission>hudson.model.Hudson.UploadPlugins:root</permission>
<permission>hudson.model.Item.Build:root</permission>
<permission>hudson.model.Item.Cancel:root</permission>
<permission>hudson.model.Item.Configure:root</permission>
<permission>hudson.model.Item.Create:root</permission>
<permission>hudson.model.Item.Delete:root</permission>
<permission>hudson.model.Item.Discover:root</permission>
<permission>hudson.model.Item.Read:anonymous</permission>
<permission>hudson.model.Item.Read:root</permission>
<permission>hudson.model.Item.Workspace:root</permission>
<permission>hudson.model.Run.Delete:root</permission>
<permission>hudson.model.Run.Update:root</permission>
<permission>hudson.model.View.Configure:root</permission>
<permission>hudson.model.View.Create:root</permission>
<permission>hudson.model.View.Delete:root</permission>
<permission>hudson.model.View.Read:anonymous</permission>
<permission>hudson.model.View.Read:root</permission>
<permission>hudson.scm.SCM.Tag:root</permission>
</authorizationStrategy>
<securityRealm class="hudson.security.PAMSecurityRealm" plugin="pam-auth@1.2">
<serviceName>sshd</serviceName>
</securityRealm>
<useSecurity>true</useSecurity>
<authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/>
<securityRealm class="hudson.security.SecurityRealm$None"/>
<disableRememberMe>false</disableRememberMe>
<projectNamingStrategy class="jenkins.model.ProjectNamingStrategy$DefaultProjectNamingStrategy"/>
<workspaceDir>${ITEM_ROOTDIR}/workspace</workspaceDir>
@@ -55,19 +18,18 @@
<viewsTabBar class="hudson.views.DefaultViewsTabBar"/>
<myViewsTabBar class="hudson.views.DefaultMyViewsTabBar"/>
<clouds/>
<slaves/>
<quietPeriod>3</quietPeriod>
<scmCheckoutRetryCount>0</scmCheckoutRetryCount>
<views>
<hudson.model.AllView>
<owner class="hudson" reference="../../.."/>
<name>All</name>
<name>all</name>
<filterExecutors>false</filterExecutors>
<filterQueue>false</filterQueue>
<properties class="hudson.model.View$PropertyList"/>
</hudson.model.AllView>
</views>
<primaryView>All</primaryView>
<primaryView>all</primaryView>
<slaveAgentPort>0</slaveAgentPort>
<label></label>
<nodeProperties/>
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<com.cloudbees.plugins.credentials.SystemCredentialsProvider plugin="credentials@1.16.1">
<com.cloudbees.plugins.credentials.SystemCredentialsProvider plugin="credentials@2.1.10">
<domainCredentialsMap class="hudson.util.CopyOnWriteMap$Hash">
<entry>
<com.cloudbees.plugins.credentials.domains.Domain>
@@ -9,11 +9,11 @@
<com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
<scope>GLOBAL</scope>
<id>c55a496e-7717-4f51-88d5-1a50b478ba55</id>
<description> github account</description>
<username></username>
<description>GitHub account</description>
<username>CHANGE_ME</username>
<password>CHANGE_ME</password>
</com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
</java.util.concurrent.CopyOnWriteArrayList>
</entry>
</domainCredentialsMap>
</com.cloudbees.plugins.credentials.SystemCredentialsProvider>
</com.cloudbees.plugins.credentials.SystemCredentialsProvider>
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<hudson.maven.MavenModuleSet_-DescriptorImpl plugin="maven-plugin@2.6">
<hudson.maven.MavenModuleSet_-DescriptorImpl plugin="maven-plugin@2.14">
<mavenValidationLevels class="linked-hash-map">
<entry>
<string>DEFAULT</string>
@@ -27,4 +27,4 @@
</entry>
</mavenValidationLevels>
<localRepository class="hudson.maven.local_repo.DefaultLocalRepositoryLocator"/>
</hudson.maven.MavenModuleSet_-DescriptorImpl>
</hudson.maven.MavenModuleSet_-DescriptorImpl>
@@ -2,4 +2,4 @@
<hudson.plugins.analysis.core.GlobalSettings_-DescriptorImpl plugin="analysis-core@1.58">
<isQuiet>false</isQuiet>
<failOnCorrupt>false</failOnCorrupt>
</hudson.plugins.analysis.core.GlobalSettings_-DescriptorImpl>
</hudson.plugins.analysis.core.GlobalSettings_-DescriptorImpl>
Oops, something went wrong.

0 comments on commit b596bd9

Please sign in to comment.