Hello everyone,
I'm attempting to create a schedule for one of my repositories pipelines using this request:
curl -X POST -u '$USER:$PASSWORD' \
https://api.bitbucket.org/2.0/repositories/$WORKSPACE/$REPO/pipelines_config/schedules/ \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"type": "pipeline_schedule",
"enabled": true,
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master",
"selector": {
"type": "custom",
"pattern": "stage"
}
},
"cron_pattern": "45 23 28 * *"
}'
However I keep getting this response:
{"error": {"message": "Request entity cannot be processed", "detail": "Unexpected response body", "data": {"key": "unexpected.response.body", "arguments": {}}}}
Does anyone have an idea of what I'm doing wrong?
Thank you
Okay was talking to Bitbucket support in a ticket I submitted and with their guidance I was able to get this to work:
1. The Pipeline Schedules use an extended cron format (this is not documented in the API reference):
sec min hour day-of-month month day-of-week year
2. You need to use the "?" symbol instead of the "*" when leaving day-of-month or day-of-week blank
Armed with that knowledge the following request actually works and creates a pipeline schedule that runs at 4:45 UTC on the 28th day of every month
curl -X POST -u '$USER:$PASSWORD' \
https://api.bitbucket.org/2.0/repositories/$WORKSPACE/$REPO/pipelines_config/schedules/ \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"type": "pipeline_schedule",
"enabled": true,
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master",
"selector": {
"type": "custom",
"pattern": "stage"
}
},
"cron_pattern": "0 45 4 28 * ? *"
}'
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.