We are running gcloud commands in our Jenkins scripted pipeline to deploy our application to Google App Engine. Since Jenkins console output is not very pretty and properly formatted, I added some echo statements and AnsiColor plugin to colorize some of the output.
However, I am stuck with gcloud commands. Is there a way to colorize gcloud command output?
I already used "gcloud config set core/disable_color false", but no use.
This is the screenshot of my output on Jenkins: -
Related
step1:I deploymented jenkins、rancher、gitlab servers in my local environment.I would want to realize CI/CD pipeline.
step2:My project is a web-based management system which used vue and gin.The project source code was pushed into the gitlab repository.I wrote a Dockerfile and a Jenkinsfile in my local IDE.The next is my important description.In my Jenkinsfile:there is some statement like the following shows :
steps {
sh "kubectl set image deployment/gin-vue gin-vue=myhost/containers/gin-vue.${BUILD_NUMBER} -n web"
}
Then executed git commit and git push command.
step3:I created a task in jenkins and clicked the build button to run the corresponding pipeline script.
step4:After end running,the newer image could not be updated into the rancher.
enter image description here
But I executed this command in rancher kubectl client terminal "kubectl set image deployment/gin-vue gin-vue=myhost/containers/gin-vue.${BUILD_NUMBER} -n web" could be successful.
So what's the cause of this problem?And this confused me so many days and not found the solution.Thanks a lot!
I executed this command in rancher kubectl client terminal "kubectl set image deployment/gin-vue gin-vue=myhost/containers/gin-vue.${BUILD_NUMBER} -n web" could be successful.
I am trying to build a pipeline with gcloud commands to create cluster, deploy apps, etc. but couldn't do it as getting the error gcloud - command not found
Tried to refer some SO links but no luck. I can see the GCloud SDK plug-in was installed in my Jenkins instance as shown below, and tried to set the Environment variable and directly passing like below too..
withEnv(['GCLOUD_PATH=/var/lib/jenkins/plugins/gcloud-sdk/']) {
sh '$GCLOUD_PATH/gcloud --version'
}
still command not found error. Not sure what I am doing wrong or missing any. Appreciate any inputs on this.
I am using Jenkins Post build task plugin to execute a bash script. The script is running fine, but the entire raw script is printed on the Jenkins console. Check section 3 in the image.
How can I avoid the script from getting printed on the Jenkins console?
I'm using newtmitch/sonar-scanner to scan my code. I'm using it as a stage in jenkinsfile. My question is, if it is possible to stop the CI (stop the jenkins pipeline build), if the quality check is not passed.
In this article, they used waitForQualityGate abortPipeline: true, to stop the pipeline if the quality gate is not passed. Can I do the same from the docker?
My docker stage look like that:
stage('Run sonar scanner docker'){
sh(script:"""
sudo docker run -v $(pwd):/usr/src --network host .../newtmitch-scanner
""")
}
Plus I have sonar-project.properties file with properties in the path.
to fail a pipeline you need your command to return an exit code of failure that is different from 0 (success). If "newtmitch-scanner" always returns a success code, but returns output, what you could do is use grep command with option -q to look for the success message
When I run a Jenkins Pipeline Docker Plugin step
docker.image('the-image').inside {
sh 'thing'
doSomeComplexStep()
}
and I want to capture the output of the whole inside block to a log file instead of writing to the Jenkins log, is there any way to do that?
I read the sources of the jenkins pipeline docker plugin without finding anything obvious, but that doesn't mean there's no way.