Git Product home page Git Product logo

jenkins-controller's Introduction

Base Jenkins Controller Container

Building on this container

If you need more specific configuration than this, use the following Dockerfile as a template.

File casc_configs/auth_config.yml is specifically to overwrite the base container.

Installing additional plugins

You can add plugin configurations by adding one or more to jenkins-plugins.yaml and running /bin/jenkins-plugin-cli -f /path/to/jenkins-plugins.yaml.

Plugin files need to be in the format specified by the base jenkins/jenkins container and described in the Jenkins Docker README file.

Adding additional Configuration as Code

The Configuration as Code (CasC) plugin is installed as part of the Jenkins Controller container and will read all configuration files out of the /usr/share/jenkins/ref/casc_configs/ directory. The CasC plugin docs have examples for how to configure many popular plugins.

Additional configuration with groovy

Groovy scripts can be added to /usr/share/jenkins/ref/init.groovy.d/ to be run when Jenkins starts up. This is a good way to provide repeatable configuration if you need something outside of additional plugins or features coverered by the CasC plugin. Please note that scripts in this directory are run in alphabetical order so if you are relying on scripts from more than one layer of Docker images be sure to name your files appropraitely.

Add groovy scripts

# Add in team specific groovy configs
ADD groovy_scripts/10_some_script.groovy /usr/share/jenkins/ref/init.groovy.d/

docker-compose

secrets.env

Contains:

GITHUB_API_TOKEN=<Your Token>

bitnami/openldap

This image is used for local development, if you want a smaller container image you may remove ldap plugin from plugins/01_base_auth_plugins.txt and build again.

Run locally

docker-compose up will give you a controller that can run docker jenkins agents using label docker-agent

Example: declare a shared library

# Example below from https://github.com/jenkinsci/configuration-as-code-plugin/blob/master/demos/jenkins/jenkins.yaml#L63-L70A
# https://github.com/jenkinsci/configuration-as-code-plugin/blob/master/integrations/src/test/resources/io/jenkins/plugins/casc/GlobalLibrariesGitHubTest.yml
unclassified:
  globalLibraries:
    libraries:
      - name: "<name your users will reference in @Library()>"
        defaultVersion: "<default branch to checkout>"
        retriever:
          modernSCM:
            scm:
              github:
                repoOwner: "<your GitHub Org name>"
                repository: "<your jenkins library repository name>"
                credentialsId: "github-api-username" // assuming you are using the default credentials

Example: create Multibranch Pipeline Job

# Example below from https://github.com/jenkinsci/configuration-as-code-plugin/tree/master/demos/jobs
jobs:
  - script: >
      multibranchPipelineJob('<repository name>') {
        branchSources {
          github {
            // The id option in the Git and GitHub branch source contexts is now mandatory (JENKINS-43693).
            id('12312313') // IMPORTANT: use a constant and unique identifier
            scanCredentialsId('github-api-username') // assuming you are using the default credentials
            repoOwner('<your GitHub Org name>')
            repository('<repository name>')
          }
        }
      }

More at jenkins-job-dsl

Related links

jenkins-controller's People

Contributors

missingcharacter avatar ricardo-overhaul avatar

Watchers

 avatar  avatar  avatar

Forkers

over-haul

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.