forked from lachie83/croc-hunter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request lachie83#92 from lachie83/dev
Major pipeline updates
- Loading branch information
Showing
8 changed files
with
71 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM golang:1.7-alpine | ||
FROM golang:1.8-alpine3.6 | ||
|
||
MAINTAINER Lachlan Evenson <[email protected]> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,16 @@ | |
|
||
// load pipeline functions | ||
// Requires pipeline-github-lib plugin to load library from github | ||
@Library('github.com/lachie83/[email protected]') | ||
|
||
@Library('github.com/lachie83/jenkins-pipeline@dev') | ||
|
||
def pipeline = new io.estrado.Pipeline() | ||
|
||
podTemplate(label: 'jenkins-pipeline', containers: [ | ||
containerTemplate(name: 'jnlp', image: 'jenkinsci/jnlp-slave:2.62', args: '${computer.jnlpmac} ${computer.name}', workingDir: '/home/jenkins', resourceRequestCpu: '200m', resourceLimitCpu: '200m', resourceRequestMemory: '256Mi', resourceLimitMemory: '256Mi'), | ||
containerTemplate(name: 'docker', image: 'docker:1.12.6', command: 'cat', ttyEnabled: true), | ||
containerTemplate(name: 'jnlp', image: 'lachlanevenson/jnlp-slave:3.10-1-alpine', args: '${computer.jnlpmac} ${computer.name}', workingDir: '/home/jenkins', resourceRequestCpu: '200m', resourceLimitCpu: '300m', resourceRequestMemory: '256Mi', resourceLimitMemory: '512Mi'), | ||
containerTemplate(name: 'docker', image: 'docker:1.12.6', command: 'cat', ttyEnabled: true), | ||
containerTemplate(name: 'golang', image: 'golang:1.8.3', command: 'cat', ttyEnabled: true), | ||
containerTemplate(name: 'helm', image: 'lachlanevenson/k8s-helm:v2.5.0', command: 'cat', ttyEnabled: true), | ||
containerTemplate(name: 'helm', image: 'lachlanevenson/k8s-helm:v2.6.0', command: 'cat', ttyEnabled: true), | ||
containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl:v1.4.8', command: 'cat', ttyEnabled: true) | ||
], | ||
volumes:[ | ||
|
@@ -79,12 +81,14 @@ volumes:[ | |
dry_run : true, | ||
name : config.app.name, | ||
namespace : config.app.name, | ||
version_tag : image_tags_list.get(0), | ||
chart_dir : chart_dir, | ||
replicas : config.app.replicas, | ||
cpu : config.app.cpu, | ||
memory : config.app.memory, | ||
hostname : config.app.hostname | ||
set : [ | ||
"imageTag": image_tags_list.get(0), | ||
"replicas": config.app.replicas, | ||
"cpu": config.app.cpu, | ||
"memory": config.app.memory, | ||
"ingress.hostname": config.app.hostname, | ||
] | ||
) | ||
|
||
} | ||
|
@@ -94,10 +98,10 @@ volumes:[ | |
|
||
container('docker') { | ||
|
||
// perform docker login to quay as the docker-pipeline-plugin doesn't work with the next auth json format | ||
// perform docker login to container registry as the docker-pipeline-plugin doesn't work with the next auth json format | ||
withCredentials([[$class : 'UsernamePasswordMultiBinding', credentialsId: config.container_repo.jenkins_creds_id, | ||
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { | ||
sh "docker login -e ${config.container_repo.dockeremail} -u ${env.USERNAME} -p ${env.PASSWORD} quay.io" | ||
sh "docker login -u ${env.USERNAME} -p ${env.PASSWORD} ${config.container_repo.host}" | ||
} | ||
|
||
// build and publish container | ||
|
@@ -107,8 +111,18 @@ volumes:[ | |
acct : acct, | ||
repo : config.container_repo.repo, | ||
tags : image_tags_list, | ||
auth_id : config.container_repo.jenkins_creds_id | ||
auth_id : config.container_repo.jenkins_creds_id, | ||
image_scanning: config.container_repo.image_scanning | ||
) | ||
|
||
// anchore image scanning configuration | ||
println "Add container image tags to anchore scanning list" | ||
|
||
def tag = image_tags_list.get(0) | ||
def imageLine = "${config.container_repo.host}/${acct}/${config.container_repo.repo}:${tag}" + ' ' + env.WORKSPACE + '/Dockerfile' | ||
writeFile file: 'anchore_images', text: imageLine | ||
anchore name: 'anchore_images', inputQueries: [[query: 'list-packages all'], [query: 'list-files all'], [query: 'cve-scan all'], [query: 'show-pkg-diffs base']] | ||
|
||
} | ||
|
||
} | ||
|
@@ -121,12 +135,14 @@ volumes:[ | |
dry_run : false, | ||
name : env.BRANCH_NAME.toLowerCase(), | ||
namespace : env.BRANCH_NAME.toLowerCase(), | ||
version_tag : image_tags_list.get(0), | ||
chart_dir : chart_dir, | ||
replicas : config.app.replicas, | ||
cpu : config.app.cpu, | ||
memory : config.app.memory, | ||
hostname : config.app.hostname | ||
set : [ | ||
"imageTag": image_tags_list.get(0), | ||
"replicas": config.app.replicas, | ||
"cpu": config.app.cpu, | ||
"memory": config.app.memory, | ||
"ingress.hostname": config.app.hostname, | ||
] | ||
) | ||
|
||
// Run helm tests | ||
|
@@ -153,12 +169,14 @@ volumes:[ | |
dry_run : false, | ||
name : config.app.name, | ||
namespace : config.app.name, | ||
version_tag : image_tags_list.get(0), | ||
chart_dir : chart_dir, | ||
replicas : config.app.replicas, | ||
cpu : config.app.cpu, | ||
memory : config.app.memory, | ||
hostname : config.app.hostname | ||
set : [ | ||
"imageTag": image_tags_list.get(0), | ||
"replicas": config.app.replicas, | ||
"cpu": config.app.cpu, | ||
"memory": config.app.memory, | ||
"ingress.hostname": config.app.hostname, | ||
] | ||
) | ||
|
||
// Run helm tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters