Forums

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

What is wrong to create pipeline schedule ?

Hisashi SOGA/曽我 央 July 28, 2020

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

2 answers

1 accepted

0 votes
Answer accepted
Tomoko Suzuki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 29, 2020

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 *"
Hisashi SOGA/曽我 央 July 29, 2020

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": {}}}}
~

 

スクリーンショット 2020-07-29 18.09.35.png

Tomoko Suzuki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 29, 2020

Sorry, I not mentioning JSON format it's about cron format.

Screen Shot 2020-07-29 at 18.17.53.png

Please generate correct cron format e.g. 25 9 * ? * * *

Like Hisashi SOGA/曽我 央 likes this
Hisashi SOGA/曽我 央 July 29, 2020

Thanks! 

Setting is successful. 

I used "0 25 9 ? * MON,TUE,WED,THU,FRI *" to cron_pattern. 

スクリーンショット 2020-07-30 10.02.05.png

Tomoko Suzuki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 29, 2020

 Glad to help!

0 votes
Hisashi SOGA/曽我 央 August 2, 2020

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 *"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events