I want to schedule a pipeline using a cron expression but i don't know how to add that value to my bitbucket-pipeline.yml in order to see it when using the schedule function in bitbucket.
How do i add it in the bitbucket-pipeline file?
Hi Bruno!
Schedules are not configured in the bitbucket-pipeline.yml file. If you open the Pipelines page of the repo, you will see an option Schedules at the top right corner.:
You can select that option in order to create a schedule.
Another option is to use our API to create a schedule and you can pass the cron expression as an argument:
An example API call is the following:
curl -X POST -u Bitbucket_Username:App_Password 'https://api.bitbucket.org/2.0/repositories/workspace-id/repo-slug/pipelines_config/schedules/' -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{
"type": "pipeline_schedule",
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master",
"selector": {
"type": "custom",
"pattern": "master"
}
},
"cron_pattern": "0 0 0 1 * ? *"
}'
Please feel free to let me know if you have any questions.
Kind regards,
Theodora
This will do.
Thank you very much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.