Page MenuHomeGRNET

INSTALL.md
No OneTemporary

File Metadata

Created
Sat, Mar 21, 3:40 AM

INSTALL.md

# Install Jenkins jobs builder
You can either make a virtualenv and install jjb under that environment or just
`pip install --user jenkins-jobs-builder`
Then, clone this repo and edit `jenkins_jobs.ini`, which contains all the information
about your Jenkins instance.
# Adding a new project
Add a yaml file for the project under `jobs/projects/example.yaml`.
The project file might look like this:
```yaml
- project:
name: zeus
repo: https://github.com/grnet/zeus
staging-env: https://zeus-testing.grnet.gr/zeus/
domain: zeus-testing.grnet.gr
production-env: https://zeus.grnet.gr/apella/
jobs:
- 'static-tools':
bandit_extra_args: '-s B101,B102'
- 'dynamic-tools':
nmap_extra_args: '-sV --reason --script=http-security-headers'
```
# Adding a new tool
Add a new folder under `tools/example-tool/` containing all files needed
to build the docker image with the entrypoint being the tool itself.
After that, you need to push it to a docker registry, accesible by all jenkins
slaves, since jobs might run in any of them.
Then add a job template for the tool under `jobs/tools-templates/`. This job template
might look like this:
```yaml
- job-template:
name: '{name}-nmap'
description: "Nmap scanner"
concurrent: true
domain:
builders:
- shell: |
#!/bin/bash -e
docker pull linosgian/nmap
docker run --rm linosgian/nmap
triggers:
- timed: '@hourly'
```
After that, you can add it to any of the `dynamic` or `static`
job groups and then it will automatically run for all projects.
Lastly, you need to update Jenkins' state by generating all new Jenkins jobs
(and update the existing ones).
All you have to do is:
`jenkins-jobs --conf jenkins_jobs.ini update jobs/projects/:jobs/tools-templates`
Or if you want to delete the old jobs:
`jenkins-jobs --conf jenkins_jobs.ini update jobs/projects/:jobs/tools-templates --delete-old`

Event Timeline