I do have images in my registry but now I want to validate my docker builds with a Jenkins file and later do blue green deployments. However I am getting the following error:
error: The server uses a certificate signed by unknown authority. You
may need to use the --certificate-authority flag to provide the path to
a certificate file for the certificate authority, or --insecure-skip-
tls-verify to bypass the certificate check and use insecure
connections.
Jenkins file:
node {
stage('Checkout source control') {
checkout scm
}
stage('connect') {
sh "oc login <my URL> --token=<my token>"
}
stage('build api container') {
sh "oc new-build --name=api --binary=true"
sh "oc start-build api --from-dir=docker/api --follow"
}
}
Any advice would be greatly appreciated. I have thought of ways but this one seems to fit my needs the best.
I am also not using minishift, I am just wanting to pull multiple repositories and check the build.
When I remove the login I get the following error:
[workspace] Running shell script
+ oc new-build --name=api --binary=true
Unable to connect to the server: Service Unavailable
script returned exit code 1
Each sh call has its own "context". Your connection is lost already in the second sh
. Try multiline call:
sh("""
oc login <my URL> --token=<my token>
oc new-build --name=api --binary=true
oc start-build api --from-dir=docker/api --follow
""")
To avoid errors with certificates add --insecure-skip-tls-verify=true
or --certificate-authority
with path to ca.crt
to login command. I think it's better to use --insecure-skip-tls-verify=true
for a simpler understanding and maintainability of your pipeline.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.