diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..56b9bf5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.eggs +.idea +.tox +puppet_openstackci.egg-info +AUTHORS +ChangeLog +doc/build + diff --git a/contrib/README.md b/contrib/README.md index 21ca912..4ef94a8 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -45,16 +45,16 @@ to the Swift Service. The system requires two external resources: -* A source for Nodepool nodes. This is a service that provides virtual machines - (e.g. OpenStack - Nova) or bare metal (e.g. OpenStack - Ironic) that nodepool - will manage as a pool of Jenkins slaves that will run the actual CI jobs. +* A source for Nodepool nodes. This is a service that implements the OpenStack Nova API + to provide virtual machines or bare metal nodes. Nodepool will use this service to + manage a pool of Jenkins slaves that will run the actual CI jobs. You can use a public or private OpenStack cloud, or even run your own [devstack](https://git.openstack.org/cgit/openstack-dev/devstack/) to get started. * A Gerrit server (for OpenStack users, this is provided to you at review.openstack.org) Zuul will listen to the Gerrit event stream to decide which jobs to run when it receives - a desired event. Zuul will also post a comment with results to this Gerrit with the + a desired event. Zuul will also post a comment with results to this Gerrit server with the job results along with a link to the related log files. These instructions are for a 'masterless' puppet setup, which is the simplest @@ -97,7 +97,7 @@ This script uses `modules.env` as its configuration input. The instructions in this section apply to both the single-node CI server node as well as the log server node. -First, it is useful to save the history, so set up a +It is useful to save the history, so set up a git repo as root user: sudo su - @@ -114,7 +114,7 @@ which configures Puppet Hiera to store local configurations and secrets such as passwords and private keys, and finally some `yaml` files which store the actual configurations and secrets. -First, set up these 3 files by starting with the samples provided. For each node, +Set up these 3 files by starting with the samples provided. For each node, select the corresponding `single_node_ci*` or `log_server*` files. sudo su - @@ -131,9 +131,9 @@ select the corresponding `single_node_ci*` or `log_server*` files. At this point, you should not need to modify either of the first two files. Modify `/etc/puppet/environments/common.yaml` as you need using the parameter -documentation described in `../manifests/single_node_ci.pp` or -`../manifests/logserver.pp` (which is -the top level puppet class that is used in `site.pp`). +documentation described in [single_node_ci.pp](http://git.openstack.org/cgit/openstack-infra/puppet-openstackci/tree/manifests/single_node_ci.pp) +or [logserver.pp](http://git.openstack.org/cgit/openstack-infra/puppet-openstackci/tree/manifests/logserver.pp) +(which are the top level puppet class that is used in `site.pp`). Once completed, you should commit these 3 files to the `/etc/puppet` git repo. Your git workflow may vary a bit, but here is an example: diff --git a/doc/source/conf.py b/doc/source/conf.py new file mode 100644 index 0000000..1a2b41b --- /dev/null +++ b/doc/source/conf.py @@ -0,0 +1,245 @@ +# -*- coding: utf-8 -*- +# +# OpenStack CI Puppet Module documentation build configuration file, created by +# sphinx-quickstart on Thu Dec 17 16:04:57 2015. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [ + 'sphinx.ext.autodoc', + 'oslo.sphinx' +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'OpenStack CI Puppet Module' +copyright = u'2015, OpenStack Infrastructure Team' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '0.1' +# The full version, including alpha/beta/rc tags. +release = '0.1' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'OpenStackCIPuppetModuledoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'OpenStackCIPuppetModule.tex', u'OpenStack CI Puppet Module Documentation', + u'OpenStack Infrastructure Team', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'openstackcipuppetmodule', u'OpenStack CI Puppet Module Documentation', + [u'OpenStack Infrastructure Team'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------------ + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'OpenStackCIPuppetModule', u'OpenStack CI Puppet Module Documentation', + u'OpenStack Infrastructure Team', 'OpenStackCIPuppetModule', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' diff --git a/doc/source/index.rst b/doc/source/index.rst new file mode 100644 index 0000000..bd81cf8 --- /dev/null +++ b/doc/source/index.rst @@ -0,0 +1,19 @@ +Welcome to OpenStack CI Puppet Module's documentation! +====================================================== + +The purpose of this module is to help others create a +continuous integration (CI) environment as used by the +OpenStack Infrastructure Team. + +.. toctree:: + :maxdepth: 2 + + third_party_ci + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/doc/source/third_party_ci.rst b/doc/source/third_party_ci.rst new file mode 100644 index 0000000..a1a099c --- /dev/null +++ b/doc/source/third_party_ci.rst @@ -0,0 +1,514 @@ +OpenStack Third-Party CI +======================== + +These instructions provide a **Third Party Testing** solution using the +same tools and scripts used by the OpenStack Infrastructure 'Jenkins' CI +system. + +If you are setting up a similar system for use outside of OpenStack, +many of these steps are still valid, while others can be skipped. These +will be mentioned within each step. + +If you are creating a third-party CI system for use within OpenStack, +you'll need to familiarize yourself with the contents of the `third +party +manual `__, +and in particular you'll need to [create a service account] +(http://docs.openstack.org/infra/system-config/third\_party.html#creating-a-service-account). + +Overview +-------- + +This CI solution uses a few open-source tools: + +- `Jenkins `__ + - an open-source continuous integration server. + +- `Zuul `__ - + a project gating system + +- `Nodepool `__- + a node management system for testing + +- `Jenkins Job + Builder `__ - + a tool to manage jenkins job definitions + +- `os-loganalyze `__ + - a tool to facilitate browsing, sharing, and filtering log files by + log level. + +The following steps will help you integrate and deploy the first 4 tools +on a single node. An initial system with 8GB RAM, 4CPUs, 80GB HD should +be sufficient, running Ubuntu 14.04. + +A second node will be used to store the log files and create a public +log server to host the static log files generated by jenkins jobs. This +log server node is an Apache server serving log files stored on disk or +on a Swift service. It is hosted on a separate node because it usually +needs to be publicly accessible to share job results whereas the rest of +the CI system can be located behind a firewall or within a VPN. At the +end of a Jenkins Job, ``publishers`` will scp log files from the jenkins +slave to the log server node or upload to the Swift Service. + +The system requires two external resources: + +- A source for Nodepool nodes. This is a service that implements the + OpenStack Nova API to provide virtual machines or bare metal nodes. + Nodepool will use this service to manage a pool of Jenkins slaves + that will run the actual CI jobs. You can use a public or private + OpenStack cloud, or even run your own + `devstack `__ + to get started. + +- A Gerrit server (for OpenStack users, this is provided to you at + review.openstack.org) Zuul will listen to the Gerrit event stream to + decide which jobs to run when it receives a desired event. Zuul will + also post a comment with results to this Gerrit server with the job + results along with a link to the related log files. + +These instructions are for a 'masterless' puppet setup, which is the +simplest version to set up for those not familiar with puppet. + +Install and Configure Puppet +---------------------------- + +On each node, you will need to install and configure puppet. These +scripts assume a dedicated 'clean' node built with a base `ubuntu 14.04 +server image `__. + +Install Puppet +~~~~~~~~~~~~~~ + +Puppet is a tool to automate the installation of servers by defining the +desired end state. You can quickly install puppet along with basic tools +(such as pip and git) using this script: + +:: + + sudo su - + wget https://git.openstack.org/cgit/openstack-infra/system-config/plain/install_puppet.sh + bash install_puppet.sh + exit + +Install Puppet Modules +~~~~~~~~~~~~~~~~~~~~~~ + +You can get the latest version of the puppet modules needed using this +script. + +:: + + sudo su - + git clone https://git.openstack.org/openstack-infra/system-config + cd system-config + ./install_modules.sh + exit + +This script will install all the puppet modules used by upstream to +``/etc/puppet/modules``. In many cases, these are git cloned, and +running the ``install_modules.sh`` script again will update them to the +latest version. This script uses ``modules.env`` as its configuration +input. + +Configure Masterless Puppet +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The instructions in this section apply to both the single-node CI server +node as well as the log server node. + +It is useful to save the history, so set up a git repo as root user: + +:: + + sudo su - + cd /etc/puppet + git init + echo "modules/" >> .gitignore + git add . + git commit -m "initial files" + exit + +You will be configuring 3 puppet files. The first is ``site.pp`` which +is the top level entry point for puppet to start managing the node. The +second is a ``hiera.yaml`` which configures Puppet Hiera to store local +configurations and secrets such as passwords and private keys, and +finally some ``yaml`` files which store the actual configurations and +secrets. + +Set up these 3 files by starting with the samples provided. For each +node, select the corresponding ``single_node_ci*`` or ``log_server*`` +files. + +:: + + sudo su - + cp /etc/puppet/modules/openstackci/contrib/hiera.yaml /etc/puppet + + cp /etc/puppet/modules/openstackci/contrib/single_node_ci_site.pp /etc/puppet/manifests/site.pp + cp /etc/puppet/modules/openstackci/contrib/single_node_ci_data.yaml /etc/puppet/environments/common.yaml + + OR + + cp /etc/puppet/modules/openstackci/contrib/log_server_site.pp /etc/puppet/manifests/site.pp + cp /etc/puppet/modules/openstackci/contrib/log_server_data.yaml /etc/puppet/environments/common.yaml + exit + +At this point, you should not need to modify either of the first two +files. Modify ``/etc/puppet/environments/common.yaml`` as you need using +the parameter documentation described in +`single\_node\_ci.pp `__ +or +`logserver.pp `__ +(which are the top level puppet class that is used in ``site.pp``). + +Once completed, you should commit these 3 files to the ``/etc/puppet`` +git repo. Your git workflow may vary a bit, but here is an example: + +:: + + sudo su - + cd /etc/puppet + git checkout -b setup + git add environments/common.yaml + # repeat for other modified files + git commit -a -m 'initial setup' + exit + +Set up the log server +===================== + +Set up the log server node first as it is simpler to configure. Besides, +its FQDN (or IP address) is needed to set up the CI server node. + +While setting up jenkins\_ssh\_public\_key in ``common.yaml`` it is +important that the same ssh key pair is used when setting up the CI +server node in the next step. This is the ssh key that Jenkins will use +to scp files. + +At this point you are ready to invoke Puppet for the first time. Puppet +needs to be run as root. + +:: + + sudo puppet apply --verbose /etc/puppet/manifests/site.pp + +You can simulate a jenkins file upload using: + +:: + + scp -i $JENKINS_SSH_PRIVATE_KEY_FILE -o StrictHostKeyChecking=no $your-log-file jenkins@:/srv/static/logs/ + +You should now be able to see the file you uploaded at +``http:///$your-log-file`` + +Set up the CI server +==================== + +Follow the steps above to install and configure puppet on the CI server +node. + +Create an Initial 'project-config' Repository +--------------------------------------------- + +Setting up a CI system consists of two major operational aspects. The +first is system configuration, which focuses on the installation and +deployment of the services, including any ssh keys, credentials, +databases, etc., and ensure all system components are able to interact +together. This portion is performed by a System Administrator. + +The second is project configuration, which includes the configuration +files that the services use to perform the desired project-specific +operations. + +The instructions provided here are mainly focused on the system +configuration aspect. However, system configuration requires an initial +set of project configurations in order to work. These project +configurations are provided via a git URL to a ``project-config`` +repository. Before moving on, create an initial ``project-config`` +repository. You can start with this +`project-config-example `__ +following the instructions provided in its README.md. While tailored for +OpenStack users, the instructions provided will help non-OpenStack users +also start with this repository. After your system is deployed, you can +make further changes to the ``project-config`` repository to +continuously tailor it to your needs. + +Add 'jenkins' to your host name +------------------------------- + +Add 'jenkins' to your /etc/hosts file so that Apache (which will be +installed by the puppet scripts) is happy. This is needed because the +scripts will install multiple services on a single node. For example: + +:: + + head -n 1 /etc/hosts + 127.0.0.1 localhost jenkins + +Run masterless Puppet +--------------------- + +At this point you are ready to invoke Puppet for the first time. Puppet +needs to be run as root. + +:: + + sudo puppet apply --verbose /etc/puppet/manifests/site.pp + +Puppet will install nodepool, jenkins, zuul, jenkins jobs builder, etc. + +Your ``project-config`` repository will be cloned to +/etc/project-config, and the puppet scripts will use these configuration +files located in this folder. Do not update these files directly. +Instead, you should update them from a clone on a dev host, merge the +changes to master, and push them to the same git remote location. Puppet +will always pull down the latest version of master from the git remote +and use that to update services. + +If you get the following error, manually run the failed +``jenkins-jobs update`` command with the arguments specified in the +error message as root. This is caused by a bug in the puppet scripts +where Jenkins is not yet running when Jenkins Job Builder attempts to +load the Jenkins jobs. + +:: + + Notice: /Stage[main]/Jenkins::Job_builder/Exec[jenkins_jobs_update]/returns: jenkins.JenkinsException: Error in request: [Errno 111] Connection refused + Notice: /Stage[main]/Jenkins::Job_builder/Exec[jenkins_jobs_update]/returns: INFO:jenkins_jobs.builder:Cache saved + Error: /Stage[main]/Jenkins::Job_builder/Exec[jenkins_jobs_update]: Failed to call refresh: jenkins-jobs update --delete-old /etc/jenkins_jobs/config returned 1 instead of one of [0] + Error: /Stage[main]/Jenkins::Job_builder/Exec[jenkins_jobs_update]: jenkins-jobs update --delete-old /etc/jenkins_jobs/config returned 1 instead of one of [0] + +Restart apache if necessary +--------------------------- + +There are some known issues with Puppet automation. If you get the +following error: + +:: + + AH00526: Syntax error on line 21 of /etc/apache2/sites-enabled/50-.conf: + Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration + +A simple restart works around the issue: + +:: + + sudo service apache2 restart + +Start zuul +---------- + +We'll start zuul first: + +:: + + sudo service zuul start + sudo service zuul-merger start + +You should see 2 zuul-server processes and 1 zuul-merger process + +:: + + ps -ef | grep zuul + zuul 5722 1 2 18:13 ? 00:00:00 /usr/bin/python /usr/local/bin/zuul-server + zuul 5725 5722 0 18:13 ? 00:00:00 /usr/bin/python /usr/local/bin/zuul-server + zuul 5741 1 2 18:13 ? 00:00:00 /usr/bin/python /usr/local/bin/zuul-merger + +You can view the log files for any errors: + +:: + + view /var/log/zuul/zuul.log + +Most zuul files are located in either of the following directories. They +should not need to be modified directly, but are useful to help identify +root causes: + +:: + + /var/lib/zuul + /etc/zuul + +Start nodepool +-------------- + +The first time starting nodepool, it's recommended to manually build the +image to aid in debugging any issues: + +:: + + sudo su - nodepool + + # Ensure the NODEPOOL_SSH_KEY variable is in the environment + # Otherwise nodepool won't be able to ssh into nodes based + # on the image built manually using these instructions + source /etc/default/nodepool + + # In the command below references one of the + # images defined in your project-config/nodepool/nodepool.yaml + # file as the 'name' field in the section 'diskimages'. + nodepool image-build + +If you run into issues building the image, the `documentation provided +here can help you +debug `__ + +After you have successfully built an image, manually upload it to the +provider to ensure provider authentication and image uploading work: + +:: + + nodepool image-upload all + +Once successful, you can start nodepool. (Note that if you don't yet +have an image, this is one of the first actions nodepool will do when it +starts, before creating any nodes): + +:: + + sudo service nodepool start + +You should see at least one process running. In particular: + +:: + + ps -ef | grep nodepool + nodepool 5786 1 28 18:14 ? 00:00:01 /usr/bin/python /usr/local/bin/nodepoold -c /etc/nodepool/nodepool.yaml -l /etc/nodepool/logging.conf + +After building and uploading the images to the providers, nodepool will +start to build nodes on those providers based on the image and will +register those nodes as jenkins slaves. + +If that does not happen, the nodepool log files will help identify the +causes. + +:: + + view /var/log/nodepool/nodepool.log + view /var/log/nodepool/debug.log + +Most nodepool configuration files are located in either of the following +directories. They should never to be modified directly as puppet will +overwrite any changes, but are useful to help identify root causes: + +:: + + /etc/nodepool + /home/nodepool/.config/openstack/clouds.yaml + +Setup Jenkins +------------- + +First Restart Jenkins so that plugins will be fully installed: + +:: + + sudo service jenkins restart + +Then open the Jenkins UI to finish manual configuration steps. + +Enable Gearman, which is the Jenkins plugin zuul uses to queue jobs: + +:: + + http://:8080/ + Manage Jenkins --> Configure System + Under "Gearman Plugin Config" Check the box "Enable Gearman" + Click "Test Connection" It should return success if zuul is running. + +Enable ZMQ Event Publisher, which is how nodepool is notified of Jenkin +slaves status events: + +:: + + http://:8080/ + Manage Jenkins --> Configure System + Under "ZMQ Event Publisher" + Check the box "Enable on all Jobs" + +Securing Jenkins (optional) +--------------------------- + +By default, Jenkins is installed with security disabled. While this is +fine for development environments where external access to Jenkins UI is +restricted, you are strongly encouraged to enable it. You can skip this +step and do it at a later time if you wish: + +Create a jenkins 'credentials': + +:: + + http://:8080/ + Manage Jenkins --> Add Credentials --> SSH Username with private key + Username 'jenkins' + Private key --> From a file on Jenkins master + "/var/lib/jenkins/.ssh/id_rsa" + --> Save + +Save the credential uuid in your hiera data: + +:: + + sudo su jenkins + cat /var/lib/jenkins/credentials.xml | grep "" + Copy the id to the 'jenkins_credentials_id' value in /etc/puppet/environments/common.yaml + +Enable basic Jenkins security: + +:: + + http://:8080/ + Manage Jenkins --> Configure Global Security + Check "Enable Security" + Under "Security Realm" + Select Jenkin's own user database + Uncheck allow users to sign up + Under "Authorization" select "logged-in users can do anything" + + Create a user 'jenkins' + Choose a password. + check 'Sign up' + Save the password to the 'jenkins_password' value in /etc/puppet/environments/common.yaml + +Get the new 'jenkins' user API token: + +:: + + http://:8080/ + Manage Jenkins --> People --> Select user 'jenkins' --> configure --> Show API Token + Save this token to the 'jenkins_api_key' value in /etc/puppet/environments/common.yaml + +Reconfigure your system to use Jenkins security settings stored in +``/etc/puppet/environments/common.yaml`` + +:: + + sudo puppet apply --verbose /etc/puppet/manifests/site.pp + +Updating your masterless puppet hosts +===================================== + +Any time you check-in changes to your ``project-config`` repo, make +changes to the hiera data (``/etc/puppet/environments/common.yaml``), or +update the puppet files (in /etc/puppet/modules, either manually or via +the ``install_modules.sh`` script), run the same puppet command to +update the host. + +:: + + sudo puppet apply --verbose /etc/puppet/manifests/site.pp + +If you need to change the git url in your ``project-config`` or any +other git urls in your ``common.yaml``, delete the respective +repository, e.g. ``/etc/project-config``, and puppet will reclone it +from the new location when the above ``puppet apply`` command is +reinvoked. + +Note that it is safe, and expected, to rerun the above ``puppet apply`` +command. Puppet will update the configuration of the host as described +in the puppet classes. This means that if you delete or modify any files +managed by puppet, rerunning the ``puppet apply`` command will restore +those settings back to the specified state (and remove your local +changes for better or worse). You could even run the ``puppet apply`` +command as a cron job to enable continuous deployment in your CI system. diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..bbb133e --- /dev/null +++ b/setup.cfg @@ -0,0 +1,23 @@ +[metadata] +name = puppet-openstackci +summary = OpenStack Infrastructure OpenStack CI Puppet module +description-file = + README.md +author = OpenStack Infrastructure Team +author-email = openstack-infra@lists.openstack.org +home-page = http://docs.openstack.org/infra/ +classifier = + Environment :: OpenStack + Intended Audience :: Information Technology + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + Programming Language :: Python + +[build_sphinx] +all_files = 1 +build-dir = doc/build +source-dir = doc/source + +[pbr] +warnerrors = true diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..1e09a38 --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. +# +# 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. + +import setuptools + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) \ No newline at end of file diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..c90b937 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,2 @@ +Sphinx>=1.1.2,<1.2 +oslo.sphinx diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..8de74ef --- /dev/null +++ b/tox.ini @@ -0,0 +1,15 @@ +[tox] +minversion = 1.6 +envlist = docs +skipsdist = True + +[testenv] +usedevelop = True +install_command = pip install {opts} {packages} +deps = -r{toxinidir}/test-requirements.txt + +[testenv:venv] +commands = {posargs} + +[testenv:docs] +commands = python setup.py build_sphinx