CircleCI-Archived / api-preview-docs

In-progress docs about the pre-release preview of CircleCI API v2
72 stars 39 forks source link

Triggering a pipeline by tag doesn't trigger any workflows #61

Open jkleinsc opened 4 years ago

jkleinsc commented 4 years ago

I am trying to use the new API to trigger a pipeline by tag or commit and neither seem to work. It looks like the API doesn't support passing a commit/revision but it looks like tag is supported: https://github.com/CircleCI-Public/api-preview-docs/blob/master/specs/v2-sketch.yaml#L750

However when I try to trigger via a tag, it doesn't end up triggering any workflows. Here's the request body being sent

{ 
  parameters: { 
    'run-lint': false,
    'run-build-linux': false,
    'run-build-mac': false,
    'upload-to-s3': '1',
    'run-linux-x64-publish': true
  },
  tag: 'v8.0.0-nightly.20191016' 
}

And the response I get back:

{ 
  workflows: [],
  id: '84f3fc12-6fbf-47ac-85ea-9c977f071b39',
  errors: [],
  project_slug: 'gh/electron/electron',
  updated_at: '2019-10-17T14:09:40.081Z',
  number: 15408,
  state: 'created',
  created_at: '2019-10-17T14:09:40.081Z',
  trigger: { received_at: '2019-10-17T14:09:40.056Z',
     type: 'api',
     actor:
      { 
        login: 'jkleinsc',
        avatar_url: 'https://avatars0.githubusercontent.com/u/609052?v=4' 
      } 
  },
  vcs:
   { origin_repository_url: 'https://github.com/electron/electron',
     target_repository_url: 'https://github.com/electron/electron',
     revision: 'e06b0aa73b91ef90a40616f2ad4554117c69d7ee',
     provider_name: 'GitHub',
     tag: 'v8.0.0-nightly.20191016'
  } 
}
simesy commented 4 years ago

I think i have the same problem as the OP, but on triggering a branch.

curl -u TOKEN: -X POST --header "Content-Type: application/json" -d '{"parameters": {}}, "branch": "upstream_change"' https://circleci.com/api/v2/project/github/ORG/PROJECT/pipeline

Although my response is different

{
  "number" : 62,
  "state" : "pending",
  "id" : "7d1e5c00-673d-47e0-8ac6-22e49011eb3a",
  "created_at" : "2019-10-27T04:52:09.794Z"
}

It's definitely triggering a build, but on the default branch, rather than the passed branch.

sulami commented 4 years ago

@simesy You need to get the branch key into the JSON object with the parameters key.

--

Robin Schroer On 27 Oct 2019, 06:01 +0100, Simon Hobbs notifications@github.com, wrote:

I think i have the same problem as the OP, but on triggering a branch. curl -u TOKEN: -X POST --header "Content-Type: application/json" -d '{"parameters": {}}, "branch": "upstream_change"' https://circleci.com/api/v2/project/github/ORG/PROJECT/pipeline Although my response is different { "number" : 62, "state" : "pending", "id" : "7d1e5c00-673d-47e0-8ac6-22e49011eb3a", "created_at" : "2019-10-27T04:52:09.794Z" } It's definitely triggering a build, but on the default branch, rather than the passed branch. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.