This repository includes the source code and presentation that I delivered at Gluecon 2018.
-
Start up a fresh Jenkins.
I typically download the generic java package (.war) file and run it from the command-line when testing, but if you already have Jenkins running, you just need the Job DSL Plugin installed.
$> java -jar jenkins.war
-
Install a few Jenkins Plugins
Navigate To: Manage Jenkins > Manage Plugins > Available Tab
-
Install Job DSL Plugin (id: job-dsl, documentation: https://plugins.jenkins.io/job-dsl)
-
Install Authorize Project Plugin (id: authorize-project https://wiki.jenkins-ci.org/display/JENKINS/Authorize+Project+plugin)
-
(Optional) Install Blue Ocean Plugin (id: blueocean https://plugins.jenkins.io/blueocean)
-
-
Restart Jenkins
-
Configure Authorize Project Plugin
Navigate To: Manage Jenkins > Configure Global Security
- Find the "Access Control for Builds" section
- Click Add
- Select "Project default Build Authorization"
- Select "Run as User who Triggered Build"
- Click "Save"
-
Create seed freestyle job
- Click "New Item" from the left menu
- Enter "seed" for "Enter an item name"
- Select "Freestyle project"
- Click "Ok"
- General > Advanced > Display Name: #Seed (this is just so the seed job shows at the top of the list of jobs)
- Source Code Management > Git > Repositories > Repository URL: https://github.com/bpmericle/gluecon-2018-JaC.git
- Build > Process Job DSLs
- Look on Filesystem > DSL Scripts:
-
src/jobs/hello_world.groovy src/pipelines/pipeline_demo.groovy
-
- Use Groovy Sandbox: checked
- Action for removed jobs: Delete
- Action for removed views: Delete
- Action for removed config files: Delete
- Look on Filesystem > DSL Scripts:
- Click "Build Now" in the left menu
-
Hello World Freestyle Job
Navigate To: Jobs > Hello World Job DSL Example
This job is your typical "Hello World" type of job. You input a name, and the job will echo back a greeting in the output log. You can find the source code for this job here.
-
Demo Declarative Pipeline Job
Navigate To: Pipelines > Pipeline Example
This pipeline job uses a declarative pipeline Jenkinsfile definition.
Below you will find the many resources I have used to aid me in my Jenkins job and pipeline development activities.