Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

RSS

jenkins-grid (10) Versions 0.2.7

Installs/Configures jenkins-grid

Berkshelf/Librarian
Policyfile
Knife
cookbook 'jenkins-grid', '= 0.2.7'
cookbook 'jenkins-grid', '= 0.2.7', :supermarket
knife cookbook site install jenkins-grid
knife cookbook site download jenkins-grid
README
Dependencies
Changelog
Quality

jenkins-grid Cookbook

This cookbook sets up a Jenkins service.

Contents

Requirements

platforms

  • Debian >= 9.0
  • Ubuntu >= 14.04
  • CentOS,RHEL >= 7.3

packages

  • none.

Attributes

Key Type Description, example Default
['jenkins-grid']['with_ssl_cert_cookbook'] Boolean If this attribute is true, node['jenkins-grid']['docker-compose']['config'] are are overridden by the following common_name attributes. false
['jenkins-grid']['ssl_cert']['common_name'] String Jenkins server common name for TLS node['fqdn']
['jenkins-grid']['num_executors'] Integer Number of executors. 2
['jenkins-grid']['log.properties'] Hash java.util.logging configurations. See attributes/default.rb
['jenkins-grid']['docker-compose']['app_dir'] String "#{node['docker-grid']['compose']['app_dir']}/jenkins"
['jenkins-grid']['docker-compose']['jenkins_home']['path'] String Path string or nil (unset). '/var/lib/jenkins_home'
['jenkins-grid']['docker-compose']['jenkins_home']['owner'] String, Integer Jenkins owner uid (read only). 1000
['jenkins-grid']['docker-compose']['config'] Hash docker-compose.yml configurations. See attributes/default.rb

Usage

Recipes

jenkins-grid::default

This recipe does nothing.

jenkins-grid::docker-compose

This recipe generates a docker-compose.yml for the Jenkins CI service.

Role Examples

  • roles/jenkins.rb
name 'jenkins'
description 'Jenkins'

run_list(
  'role[docker]',
  'recipe[jenkins-grid::docker-compose]',
)

#env_run_lists()

#default_attributes()

override_attributes(
  'jenkins-grid' => {
    'docker-compose' => {
      'config' => {
        # Version 2 docker-compose format
        'version' => '2',
        'services' => {
          'jenkins' => {
            'restart' => 'always',
            'image' => 'jenkins:latest',
            'ports' => [
              '8080:8080',
              '50000:50000',
            ],
            #'environment' => {
            #},
            #'volumes' => [
            #  # set automatically, if the node['jenkins-grid']['docker-compose']['jenkins_home']['path'] is not nil.
            #  "#{node['jenkins-grid']['docker-compose']['jenkins_home']['path']}:/var/jenkins_home",
            #],
          },
        },
      },
    },
  },
)
  • roles/jenkins-with-ssl-cert.rb
name 'jenkins-with-ssl-cert'
description 'Jenkins setup with ssl_cert cookbook'

run_list(
  #'recipe[ssl_cert::server_key_pairs]',  # jenkins-grid <= 0.2.3
  'role[docker]',
  'recipe[jenkins-grid::docker-compose]',
)

#env_run_lists()

#default_attributes()

jenkins_cn = 'jenkins.io.example.com'

override_attributes(
  'jenkins-grid' => {
    'with_ssl_cert_cookbook' => true,
    'ssl_cert' => {
      'common_name' => jenkins_cn,
    },
    'docker-compose' => {
      'config' => {
        # Version 2 docker-compose format
        'version' => '2',
        'services' => {
          'jenkins' => {
            'restart' => 'always',
            'image' => 'jenkins:latest',
            'expose' => [
              '8083',  # for https
            ],
            'ports' => [
              '8083:8083',
              '50000:50000',
            ],
            'environment' => {
              'JENKINS_OPTS' => [
                '--httpPort=-1 --httpsPort=8083',
                # These options will be set by the jenkins-grid::docker-compose recipe automatically.
                #'--httpsCertificate=/var/lib/jenkins/server.crt',
                #'--httpsPrivateKey=/var/lib/jenkins/server.key',
              ].join(' '),
            },
            # These volumes will be set by the jenkins-grid::docker-compose recipe automatically.
            #'volumes' => [
            #  "#{node['jenkins-grid']['docker-compose']['jenkins_home']['path']}:/var/jenkins_home",
            #  "#{server_cert_path(node['jenkins-grid']['ssl_cert']['common_name'])}:/var/lib/jenkins/server.crt:ro",
            #  "#{node['jenkins-grid']['docker-compose']['app_dir']}/certs/server.key:/var/lib/jenkins/server.key:ro",
            #],
          },
        },
      },
    },
  },
  'ssl_cert' => {
    'common_names' => [
      jenkins_cn,
    ],
  }
)

SSL server keys and certificates management by ssl_cert cookbook

  • create vault items.
$ ruby -rjson -e 'puts JSON.generate({"private" => File.read("jenkins.io.example.com.prod.key")})' \
> > ~/tmp/jenkins.io.example.com.prod.key.json

$ ruby -rjson -e 'puts JSON.generate({"public" => File.read("jenkins.io.example.com.prod.crt")})' \
> > ~/tmp/jenkins.io.example.com.prod.crt.json

$ cd $CHEF_REPO

$ knife vault create ssl_server_keys jenkins.io.example.com.prod \
> --json ~/tmp/jenkins.io.example.com.prod.key.json

$ knife vault create ssl_server_certs jenkins.io.example.com.prod \
> --json ~/tmp/jenkins.io.example.com.prod.crt.json
  • grant reference permission to the Jenkins host
$ knife vault update ssl_server_keys  jenkins.io.example.com.prod -S 'name:jenkins-host.example.com'
$ knife vault update ssl_server_certs jenkins.io.example.com.prod -S 'name:jenkins-host.example.com'
  • modify run_list and attributes
run_list(
  #'recipe[ssl_cert::server_key_pairs]',  # jenkins-grid <= 0.2.3
  'recipe[jenkins-grid::docker-compose]',
)

override_attributes(
  'ssl_cert' => {
    'common_names' => [
      'jenkins.io.example.com',
    ],
  },
  'jenkins-grid' => {
    'with_ssl_cert_cookbook' => true,
    'ssl_cert' => {
      'common_name' => 'jenkins.io.example.com',
    },
    # ...
  },
)

License and Authors

  • Author:: whitestar at osdn.jp
Copyright 2016-2017, whitestar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

ssl_cert >= 0.3.3
docker-grid >= 0.3.6

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

jenkins-grid CHANGELOG

0.2.7

  • improves SSL server key management.

0.2.6

  • bug fix.

0.2.5

  • refactoring.

0.2.4

  • includes the ssl_cert::server_key_pairs recipe automatically.

0.2.3

  • adds default ports settings.

0.2.2

  • Bug fix: Docker volumes management.
  • revises documents.

0.2.1

  • bug fix.

0.2.0

  • adds log.properties configurations.
  • adds executors.groovy configurations.
  • adds linkage with the ssl_cert cookbook for TLS setup.

0.1.0

  • Initial release of jenkins-grid

Collaborator Number Metric
            

0.2.7 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.2.7 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

0.2.7 passed this metric

License Metric
            

0.2.7 passed this metric

No Binaries Metric
            

0.2.7 passed this metric

Publish Metric
            

0.2.7 passed this metric

Supported Platforms Metric
            

0.2.7 passed this metric

Testing File Metric
            

0.2.7 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.2.7 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number