Commit 2e5cf8130a2ad5b4734343c296e013ec5407b3a2

Authored by Antonio Terceiro
2 parents c508ff23 7dd92cca
Exists in master and in 89 other branches 3.x, add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, cdtc_configuration, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev-lappis, dev_env_minimal, disable_email_dev, docs, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, performance, prezento, r3, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_backup_emails, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, stable-devel, support_docs, syslog, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

Merge branch 'ci' into 'master'

Receita de implantação do Jenkins

See merge request !28
cookbooks/ci/files/default/nginx 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +upstream app_server {
  2 + server 127.0.0.1:8080 fail_timeout=0;
  3 +}
  4 +
  5 +server {
  6 + listen 80;
  7 + listen [::]:80 default ipv6only=on;
  8 + server_name ci.spb.lappis;
  9 +
  10 + location / {
  11 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  12 + proxy_set_header Host $http_host;
  13 + proxy_redirect off;
  14 +
  15 + if (!-f $request_filename) {
  16 + proxy_pass http://app_server;
  17 + break;
  18 + }
  19 + }
  20 +}
0 21 \ No newline at end of file
... ...
cookbooks/ci/recipes/default.rb
1 1 include_recipe 'ci::spb'
  2 +include_recipe 'ci::jenkins'
2 3 \ No newline at end of file
... ...
cookbooks/ci/recipes/jenkins.rb 0 → 100644
... ... @@ -0,0 +1,61 @@
  1 +JENKINS_CLI = '/var/cache/jenkins/war/WEB-INF/jenkins-cli.jar'
  2 +
  3 +execute 'jenkins_repo' do
  4 + command 'wget -q -O - http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key | sudo apt-key add -'
  5 +end
  6 +
  7 +execute 'apt_sources' do
  8 + command 'echo "deb http://pkg.jenkins-ci.org/debian-stable binary/" >> /etc/apt/sources.list'
  9 + not_if 'cat /etc/apt/sources.list | grep jenkins-ci'
  10 +end
  11 +
  12 +execute 'apt-get update'
  13 +
  14 +package 'jenkins'
  15 +
  16 +service 'jenkins' do
  17 + action :enable
  18 +end
  19 +
  20 +execute 'service jenkins restart'
  21 +
  22 +package 'nginx'
  23 +
  24 +service 'nginx' do
  25 + action [:enable, :start]
  26 +end
  27 +
  28 +file '/etc/nginx/sites-available/default' do
  29 + action :delete
  30 +end
  31 +
  32 +cookbook_file 'nginx' do
  33 + path '/etc/nginx/sites-available/jenkins'
  34 +end
  35 +
  36 +file '/etc/nginx/sites-enabled/default' do
  37 + action :delete
  38 +end
  39 +
  40 +link '/etc/nginx/sites-enabled/jenkins' do
  41 + to '/etc/nginx/sites-available/jenkins'
  42 + not_if 'test -L /etc/nginx/sites-enabled/jenkins'
  43 +end
  44 +
  45 +service 'nginx' do
  46 + action :restart
  47 +end
  48 +
  49 +package 'git'
  50 +
  51 +plugins = ['git-client', 'git-server', 'build-blocker-plugin', 'greenballs', 'view-job-filters', 'gitlab-plugin']
  52 +
  53 +plugins.each do |plugin|
  54 + execute "install jenkins plugin #{plugin}" do
  55 + command "java -jar #{JENKINS_CLI} -s http://localhost/ install-plugin #{plugin}"
  56 + retries 5
  57 + retry_delay 10
  58 + end
  59 +end
  60 +
  61 +execute 'service jenkins restart'
0 62 \ No newline at end of file
... ...