I requested:
curl -X POST \--user ${myUserID}:${myPassword} \--header 'Content-type: application/json' \https://api.bitbucket.org/2.0/repositories/${myWorkSpace}/${myRepository}/pipelines_config/schedules/ \--data '{ "type": "pipeline_schedule", "enabled": true, "target": { "type": "pipeline_ref_target", "ref_type": "branch", "ref_name": "develop", "selector": { "type": "custom", "pattern": "laravelTestOnDemand" } }, "cron_pattern": "0 25 9 * * 1-5 *"}'
Then response:
{"error": {"message": "Bad request", "detail": "Response Summary: HttpResponseSummary{httpStatusCode=422, httpStatusMessage=Unprocessable Entity, bodyAsString={\"errors\":[\"expression is not valid\"]}}", "data": {"key": "trigger-service.schedule.schedule-creation-failed", "arguments": {}}}}
Please help me.
refs:
- https://ja.confluence.atlassian.com/bitbucket/scheduled-pipelines-933078702.html- https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pipelines_config/schedules/#post
Hi Hisashi-san,
It seems cron_pattern is not valid expression. Could you try to regenerate correct one using freeformatter.com ?
"cron_pattern": "0 25 9 * * 1-5 *"
Thanks for reply.
I tried, but same result.
・・・--data '{ "type": "pipeline_schedule", "enabled": true, "target": { "type": "pipeline_ref_target", "ref_type": "branch", "ref_name": "develop", "selector": { "type": "custom", "pattern": "laravelTestOnDemand" } }, "cron_pattern": "25 9 * * 1-5"}'{"error": {"message": "Bad request", "detail": "Response Summary: HttpResponseSummary{httpStatusCode=422, httpStatusMessage=Unprocessable Entity, bodyAsString={\"errors\":[\"expression is not valid\"]}}", "data": {"key": "trigger-service.schedule.schedule-creation-failed", "arguments": {}}}}~
Sorry, I not mentioning JSON format it's about cron format.
Please generate correct cron format e.g. 25 9 * ? * * *
Thanks!
Setting is successful.
I used "0 25 9 ? * MON,TUE,WED,THU,FRI *" to cron_pattern.
Note: The time zone must be taken into account.
If you want to set it to 9:15 JST,
x "0 15 9 ? * MON,TUE,WED,THU,FRI *"
o "0 15 0 ? * MON,TUE,WED,THU,FRI *"
It looks like you're new here. Sign in or register to get started.