davidcurrie / index2018 Goto Github PK
View Code? Open in Web Editor NEWJenkins/Kube/Helm demo for Index 2018
Jenkins/Kube/Helm demo for Index 2018
Hi David,
I was running the script beforehand it was working. Now it is giving me timeout when last helm command is executed.
podTemplate(
label: 'mypod',
inheritFrom: 'default',
containers: [
containerTemplate(
name: 'golang',
image: 'golang:1.10-alpine',
ttyEnabled: true,
command: 'cat'
),
containerTemplate(
name: 'docker',
image: 'docker:18.02',
ttyEnabled: true,
command: 'cat'
),
containerTemplate(
name: 'helm',
image: 'ibmcom/k8s-helm:v2.6.0',
ttyEnabled: true,
command: 'cat'
)
],
volumes: [
hostPathVolume(
hostPath: '/var/run/docker.sock',
mountPath: '/var/run/docker.sock'
)
]
) {
node('mypod') {
def commitId
stage ('Extract') {
checkout scm
commitId = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
}
stage ('Build') {
container ('golang') {
sh 'CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .'
sh 'ls -ltr'
}
}
def repository
stage ('Docker') {
container ('docker') {
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: '123456',
usernameVariable: 'DOCKER_HUB_USER',
passwordVariable: 'DOCKER_HUB_PASSWORD']]) {
sh "docker build -t ${env.DOCKER_HUB_USER}/demo:${env.BUILD_NUMBER} ."
sh "docker login -u ${env.DOCKER_HUB_USER} -p ${env.DOCKER_HUB_PASSWORD} "
sh "docker push ${env.DOCKER_HUB_USER}/demo:${env.BUILD_NUMBER} "
}
}
}
stage ('Deploy') {
container ('helm') {
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: '123456',
usernameVariable: 'DOCKER_HUB_USER',
passwordVariable: 'DOCKER_HUB_PASSWORD']]){
sh "/helm init --client-only --skip-refresh"
sh "/helm upgrade --install --wait --set image.repository=${env.DOCKER_HUB_USER}/demo,image.tag=${env.BUILD_NUMBER} demo hello"
}
}
}
}
}
Logs of Jenkins:
Hi,
I am facing problem in running the code. When I run on the Jenkins , I get below error:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.