Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Gitlab CI jobs #49

Open
wants to merge 1 commit into
base: production
Choose a base branch
from

Conversation

jeffmccune
Copy link

Without this patch the control repository does not contain any scripts to
execute CI jobs for Puppet code deployment. This patch addresses the problem
by adding a Gitlab CI job configuration with three jobs defined across two
stages. The test stage executes first with a Syntax and a Lint job executing
in parallel. If an environment branch has been pushed, one matching
developemnt, testing, production or starting with the prefix
playground, the deploy stage is executed.

The deploy stage requires a Gitlab secret environment variable, PUPPET_TOKEN.
This environment variable is the puppet access token configured with Code
Manager.

The test stage runs the following syntax checks:

  • yaml files (*.yml, *.yaml)
  • json files (*.json)
  • bash scripts (*.sh)
  • ruby scripts (*.rb)
  • puppet manifests (*.pp)
  • erb files (*.erb)

The behavior of the checks are to check only files modified relative to
a base branch, defaulting to production. This avoids running syntax
checks against files which have not been modified by the merge request.
The check uses git diff --name-status to identify changed files across
multiple commits in a topic branch.

The lint checks rely on bundler and the Gemfile to install numerous lint
checks.

Gem libraries are installed in a per-job location in $HOME. This is an
intentional compromise between installing into a system GEM_PATH
element, which would create library conflicts with other jobs, and the
job workspace, which would cause gem libraries to be installed from the
network on each job invocation.

Without this patch the control repository does not contain any scripts
to execute CI jobs for Puppet code deployment.  This patch addresses the
problem by adding a Gitlab CI job configuration with three jobs defined
across two stages.  The test stage executes first with a Syntax and a
Lint job executing in parallel.  If an environment branch has been
pushed, one matching `developemnt`, `testing`, `production` or starting
with the prefix `playground`, the deploy stage is executed.

The deploy stage requires a Gitlab secret environment variable,
PUPPET_TOKEN.  This environment variable is the puppet access token
configured with Code Manager.

The test stage runs the following syntax checks:

 * yaml files (*.yml, *.yaml)
 * json files (*.json)
 * bash scripts (*.sh)
 * ruby scripts (*.rb)
 * puppet manifests (*.pp)
 * erb files (*.erb)

The behavior of the checks are to check only files modified relative to
a base branch, defaulting to `production`.  This avoids running syntax
checks against files which have not been modified by the merge request.
The check uses `git diff --name-status` to identify changed files across
multiple commits in a topic branch.

The lint checks rely on bundler and the Gemfile to install numerous lint
checks.

Gem libraries are installed in a per-job location in $HOME.  This is an
intentional compromise between installing into a system GEM_PATH
element, which would create library conflicts with other jobs, and the
job workspace, which would cause gem libraries to be installed from the
network on each job invocation.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants