Last active
September 29, 2021 11:15
-
-
Save alexellis/b9e82390526dad5c4bc39d7f44b0a250 to your computer and use it in GitHub Desktop.
OpenFaaS Kaniko Jenkins Pipelines Gist
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 guarantees the node will use this template | |
def label = "mypod-${UUID.randomUUID().toString()}" | |
podTemplate(label: label, | |
containers: [ | |
containerTemplate(privileged: false, name: 'faascli', image: 'openfaas/faas-cli:0.8.6', ttyEnabled: true, command: 'cat'), | |
containerTemplate(name: "kaniko", image:"gcr.io/kaniko-project/executor:debug", ttyEnabled: true, command: "/busybox/cat") | |
]) { | |
node(label) { | |
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/alexellis/openfaas-cloud-test']]]) | |
stage("shrinkwrap") { | |
container("faascli") { | |
sh "apk add --no-cache git" | |
sh "faas-cli template store pull node8-express" | |
sh "faas-cli build --shrinkwrap" | |
} | |
} | |
stage("build") { | |
container(name: "kaniko", shell: '/busybox/sh') { | |
// Remove --no-push to push to a registry | |
// See also: https://github.com/GoogleContainerTools/kaniko#pushing-to-different-registries | |
withEnv(['PATH+EXTRA=/busybox:/kaniko']) { | |
sh '''#!/busybox/sh | |
/kaniko/executor -c /home/jenkins/workspace/Kaniko/build/timezone-shift --no-push | |
''' | |
} | |
} | |
} | |
} | |
} |
Thank you so much for helping. I have this working now and have edited the text. How does it look at your end now?
Well, I didn't really help I believe. Just stumbled on a different problem. :)
Anyway - it was a small attempt to return a favour - your tutorials have helped me quite a number of times.
Sadly still doesn't work for me because of the same issue:
ls: can't open '/home/jenkins/workspace/': Value too large for defined data type
total 0
Error: error resolving dockerfile path: please provide a valid path to a Dockerfile within the build context with --dockerfile
Usage:
executor [flags]
Hi just curious, how to build the image with kaniko, if we don't use --no-push? I still get confused how to build and push the image to registry (eg. Google Container Registry)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like an issue with kaniko:debug container:
`docker run -it --entrypoint /busybox/sh gcr.io/kaniko-project/executor:debug
/ # ls
ls: can't open '.': Value too large for defined data type`
The same happens on k8s.
Probably related to this: GoogleContainerTools/distroless#225
So the container just can't read the filesystem