Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from DoodleScheduling/kaniko-DK-1985
Browse files Browse the repository at this point in the history
Use kaniko instead dind DK-1985
  • Loading branch information
raffis authored May 3, 2021
2 parents 521d229 + 04b9869 commit 02e2464
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 33 deletions.
40 changes: 7 additions & 33 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ podTemplate(label: 'k8svault-controller',
ttyEnabled: true
),
containerTemplate(
name: 'docker',
image: 'docker:latest',
name: 'kaniko',
command: '/busybox/cat',
image: 'gcr.io/kaniko-project/executor:debug',
ttyEnabled: true
),
containerTemplate(
Expand All @@ -21,17 +22,13 @@ podTemplate(label: 'k8svault-controller',
),
],
volumes: [
hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock'),
secretVolume(secretName: 'dockerauth', mountPath: '/root/dockerauth')
]
) {
node ('k8svault-controller') {
ansiColor("xterm") {
stage('checkout') {
checkout(scm)

container('docker') {
dockerAuth()
}
}

stage("build") {
Expand All @@ -56,9 +53,9 @@ podTemplate(label: 'k8svault-controller',

version = "$major.$minor.$patch$group"

container('docker') {
sh "docker build . -t nexus.doodle.com:5000/devops/k8svault-controller:${env.TAG_NAME}"
sh "docker push nexus.doodle.com:5000/devops/k8svault-controller:${env.TAG_NAME}"
container(name: 'kaniko', shell: '/busybox/sh') {
sh "cp /root/dockerauth/.dockerconfigjson /kaniko/.docker/config.json"
sh "/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --destination='nexus.doodle.com:5000/devops/k8svault-controller:${env.TAG_NAME}'"
}

container('helm') {
Expand All @@ -69,7 +66,6 @@ podTemplate(label: 'k8svault-controller',
sh "mkdir chart/k8svault-controller/crds"
sh "cp config/crd/bases/* chart/k8svault-controller/crds"
sh "helm package chart/k8svault-controller"

}

container('golang') {
Expand All @@ -86,28 +82,6 @@ podTemplate(label: 'k8svault-controller',
}
}

void dockerAuth() {
// nexus repository
withCredentials([[
$class : 'UsernamePasswordMultiBinding',
credentialsId : 'nexus',
usernameVariable: 'NEXUS_USER',
passwordVariable: 'NEXUS_PASSWORD'
]]) {
sh "docker login nexus.doodle.com:5000 -u ${env.NEXUS_USER} -p ${env.NEXUS_PASSWORD}"
}

// docker hub
withCredentials([[
$class : 'UsernamePasswordMultiBinding',
credentialsId : 'dockerhub',
usernameVariable: 'DOCKERHUB_USER',
passwordVariable: 'DOCKERHUB_PASSWORD'
]]) {
sh "docker login -u ${env.DOCKERHUB_USER} -p ${env.DOCKERHUB_PASSWORD}"
}
}

def bumpImageVersion(String version) {
echo "Update image tag"
def valuesFile = "./chart/k8svault-controller/values.yaml"
Expand Down
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ module github.com/DoodleScheduling/k8svault-controller
go 1.15

require (
4d63.com/gochecknoglobals v0.0.0-20201008074935-acfc0b28355a // indirect
4d63.com/gochecknoinits v0.0.0-20200108094044-eb73b47b9fc4 // indirect
github.com/alecthomas/gocyclo v0.0.0-20150208221726-aa8f8b160214 // indirect
github.com/alexkohler/nakedret v1.0.0 // indirect
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 // indirect
github.com/coreos/go-etcd v2.0.0+incompatible // indirect
Expand All @@ -16,6 +19,8 @@ require (
github.com/hashicorp/vault/sdk v0.1.14-0.20200519221838-e0cfd64bc267
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/jgautheron/goconst v0.0.0-20201117150253-ccae5bf973f3 // indirect
github.com/mdempsky/maligned v0.0.0-20210215075342-f0178ee82032 // indirect
github.com/mdempsky/unconvert v0.0.0-20200228143138-95ecdbfc0b5f // indirect
github.com/mibk/dupl v1.0.0 // indirect
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2
Expand All @@ -24,6 +29,7 @@ require (
github.com/securego/gosec v0.0.0-20200401082031-e946c8c39989 // indirect
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.0
github.com/stripe/safesql v0.2.0 // indirect
github.com/tsenart/deadcode v0.0.0-20160724212837-210d2dc333e9 // indirect
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 // indirect
github.com/walle/lll v1.0.1 // indirect
Expand All @@ -34,5 +40,8 @@ require (
k8s.io/apimachinery v0.20.2
k8s.io/cli-runtime v0.20.2
k8s.io/client-go v0.20.2
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7 // indirect
sigs.k8s.io/controller-runtime v0.8.0
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182aff
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/mdempsky/maligned v0.0.0-20201101000000-d73c43cb16d0 h1:+6XJvFZBYbNv/nSekNWFZyaGNMXcPnZ4n/HHoCXn+Ms=
github.com/mdempsky/maligned v0.0.0-20201101000000-d73c43cb16d0/go.mod h1:3UB4iTzhLciyWcrrvXSkrtCIU+IJ5GCfEmnleHRsxL4=
github.com/mdempsky/maligned v0.0.0-20210215075342-f0178ee82032 h1:3A6SZn0ThJmhm66wGfgvarlntuWbQQ8Qt0MGim6flzo=
github.com/mdempsky/maligned v0.0.0-20210215075342-f0178ee82032/go.mod h1:3UB4iTzhLciyWcrrvXSkrtCIU+IJ5GCfEmnleHRsxL4=
github.com/mdempsky/unconvert v0.0.0-20200228143138-95ecdbfc0b5f h1:Kc3s6QFyh9DLgInXpWKuG+8I7R7lXbnP7mcoOVIt6KY=
github.com/mdempsky/unconvert v0.0.0-20200228143138-95ecdbfc0b5f/go.mod h1:AmCV4WB3cDMZqgPk+OUQKumliiQS4ZYsBt3AXekyuAU=
github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU=
Expand Down

0 comments on commit 02e2464

Please sign in to comment.