Hi Pencillr, Thanks alot for the post. I have one requirement where I have to trigger 2nd stage in pipeline at different time and date after the initial stage. Can you please help me if you have any suggestions?
Did you ever figure out how to trigger 2nd stage in pipeline?
I also have a requirement to trigger just a stage in Jenkinsfile pipeline. This stage should only run daily but all other stages triggered by a code push. Any ideas?
Use what is known as a parameterized pipeline. You can set default environment variables for code runs.
when you want to change the behavior of the pipeline stage you can modify the parameter. If you set the toggle parameter to false in the UI, or by calling the build via URL, it will now skip the first stage because it's not true
Calling via URL: http://server/job/project/buildWithParameters?toggle=false
pipeline {
agent any
parameters {
booleanParam(name: 'toggle', defaultValue: true)}
stages {
stage('optional stage'){
when (toggle: true){
sh `make clean`}}}}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Pencillr, Thanks alot for the post. I have one requirement where I have to trigger 2nd stage in pipeline at different time and date after the initial stage. Can you please help me if you have any suggestions?
Did you ever figure out how to trigger 2nd stage in pipeline?
I also have a requirement to trigger just a stage in Jenkinsfile pipeline. This stage should only run daily but all other stages triggered by a code push. Any ideas?
Have the same case, no luck so far.
Use what is known as a parameterized pipeline. You can set default environment variables for code runs.
when
you want to change the behavior of the pipeline stage you can modify the parameter. If you set the toggle parameter to false in the UI, or by calling the build via URL, it will now skip the first stage because it's not trueCalling via URL:
http://server/job/project/buildWithParameters?toggle=false