I'm looking at the POST method for pipelines_config/schedules, but I can't figure out how to structure my POST data.
I've tried to mimic the results from GET, but to no avail.
Can someone help me restructure the POST data correctly?
I've tried POSTing with all of the following, and all respond with 400 bad request:
[
'enabled' => true,
'cron_pattern' => '0 4 * * *',
'type' => 'custom',
'pattern' => 'clu'
];
[
'enabled' => true,
'cron_pattern' => '0 4 * * *',
'target' => [
'type' => 'custom',
'pattern' => 'clu'
]
];
[
'enabled' => true,
'cron_pattern' => '0 4 * * *',
'target' => [
'selector' => [
'type' => 'custom',
'pattern' => 'clu'
]
]
]
[
'enabled' => true,
'cron_pattern' => '0 4 * * *',
[
'type' => 'custom',
'pattern' => 'clu'
]
]
[
'enabled' => true,
'cron_pattern' => '0 4 * * *',
'target' => [
'type' => 'pipeline_ref_target',
'ref_type' => 'branch',
'ref_name' => 'master',
'selector' => [
'type' => 'custom',
'pattern' => 'clu'
]
]
]
My bitbucket-pipelines.yml defines the "clu" job thusly:
pipelines:
custom:
clu:
- step:
name: Composer Lock Update Test
script:
- echo "hello world"
OK, I figured it out.
The final version above is nearly there, just using an invalid cron syntax.
The version that works looks like this:
[
'enabled' => true,
'cron_pattern' => '0 0 4 * * ? *',
'target' => [
'type' => 'pipeline_ref_target',
'ref_type' => 'branch',
'ref_name' => 'master',
'selector' => [
'type' => 'custom',
'pattern' => 'clu'
]
]
]
This creates a scheduled task on branch "master" to run the custom task "clu" at 4am GMT, 7 days a week.
If the API requires specific names for elements in its expected data structures, perhaps those should be included in the API docs!?
Solving a similar problem to schedule monthly builds I wrote a detailed explanation at https://jira.atlassian.com/browse/BCLOUD-17798?focusedCommentId=2353519&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-2353519
Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.