Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-22297

Creating a pipeline schedule using Bitbucket Cloud API is ignoring the value of "enabled" field

XMLWordPrintable

      Issue Summary

      When using the Bitbucket Cloud API endpoint Create a schedule to create a new pipeline schedule in the repository, regardless of the value of the "enabled" field, the schedule is always being created as enabled:true

      Steps to Reproduce

      1. Create a new pipeline schedule using the Create a schedule endpoint and providing the attribute enabled:false
        curl -X POST -u username:app_password -H 'Content-Type: application/json' -H 'Accept: application/json'  'https://api.bitbucket.org/2.0/repositories/<workspace>/<repo_slug>/pipelines_config/schedules/' -d '{
           "type": "pipeline_schedule",
           "enabled": false,
           "target": {
              "ref_type": "branch",
              "type": "pipeline_ref_target",
              "ref_name": "master",
              "selector": {
                 "type": "default"
              }
           },
           "cron_pattern": "0 0 0 1 * ? *"
        }'
        
      1.  The returned object of the created schedule comes with enabled:"true".

      Expected Results

      When using the "enabled": false attribute in the API call, the schedule should be created in the disabled state.

      Actual Results

      The schedule is created in an active state ("enabled:true") even when using "enabled": false in the body of the API call.

      Workaround

      • The response of Create a schedule endpoint will contain the UUID of the created schedule.
      • With that UUID, use the Update a Schedule endpoint to update the value of enabled to false :
        curl -X PUT -u username:app_password -H 'Content-Type: application/json' -H 'Accept: application/json'  'https://api.bitbucket.org/2.0/repositories/<workspace>/<repo_slug>/pipelines_config/schedules/%7B<UUID>%7D' -d '{
           "enabled": false
        }'
        

        The %7B and %7D are the encoded values of "{}" that are present in the UUID

              Unassigned Unassigned
              641e77b2eb21 Patrik S (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: