Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cron expression in bitbucket-pipeline.yml?

Bruno Romagnoli
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2023

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?

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 21, 2023

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.:

Screenshot 2023-02-21 at 15.13.30.png

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

Bruno Romagnoli
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 22, 2023

This will do. 
Thank you very much.

Like Theodora Boudale likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events