CircleCI 2.1: Is it possible to trigger a job through API?

#1

We upgraded our config.yml from v2 to v2.1 recently and our API command has stopped working.

The command that we are using is:
POST: /project/:vcs-type/:username/:project/tree/:branch params = {"circle-token": circleci_token}, json={"build_parameters": {"CIRCLE_JOB": 'jobName',}}

jobName is the job that we want to run using the API command and looks something like this:
jobName: executor: macos steps: - checkout - setup_ruby_version - restore_bundler_cache (etc etc)

When we trigger the API command, we now get the error below:
Build-agent version 0.1.953-81328d36 (2018-10-31T20:07:21+0000) Configuration errors: 2 errors occurred: * Configuration version 2.1 requires the "Enable Build Processing" project setting. Enable Build Processing under Project Settings -> Advanced Settings. In order to retrigger build processing, you must push a new commit. * Cannot find a job namedjobNameto run in thejobs:section of your configuration file. If you expected a workflow to run, check your config contains a top-level key called 'workflows:'

Does CircleCI 2.1 not support using the API command to trigger a job?

2 Likes

#2

I have the exact same error after a v2 to v2.1 upgrade.

My API call request:

curl \
            --user ${TOKEN}: \
            --header "Content-Type: application/json" \
            --data "{\"build_parameters\": {\"CIRCLE_JOB\": \"smoke\"}}" \
            --request POST "https://circleci.com/api/v1.1/project/github/:username/:project/tree/:branch"

Error message:

Build-agent version 0.1.1062-dce5e86e (2018-11-10T01:11:11+0000)
Configuration errors: 2 errors occurred:

* Configuration version 2.1 requires the "Enable Build Processing" project setting. Enable Build Processing under Project Settings -> Advanced Settings. In order to retrigger build processing, you must push a new commit.
* Cannot find a job named `smoke` to run in the `jobs:` section of your configuration file.
If you expected a workflow to run, check your config contains a top-level key called 'workflows:'

Enable Build Processing is set on the project and triggering the job via the workflow works!

Is there any new version of the API supporting the v2.1 ?

0 Likes

#3

I created a simple example to illustrate the issue:

I also created a bug report.

0 Likes

#4

@kptdobe Hi! Can you link me to the bug report so that I can follow progress? I really hope they fix this soon.

0 Likes

#5

@gmgchow My discussions with support lead only to https://circleci.com/ideas/?idea=CCI-I-690.
They cannot provide an ETA for this “new idea”…

0 Likes

#6

so basically it cannot be done? any workaround?

1 Like

#7

Hey guys, any updates on that. We’re looking forward to use the version 2.1 but the API is not working :confused:

0 Likes

#8

Hi folks,

I completely understand the need. This is something we are tracking here https://ideas.circleci.com/ideas/CCI-I-192. While it seems there may not be much activity on the request, it is very close to the top of our priority list and we hope to have it soon.

If you vote on the feature request, you will be notified when it is released.

0 Likes

#9

I completely understand the need.

Can you re-enable v1 API and config while you complete the basics of v2?

You want me to signup yet again to access the ideas forum?

0 Likes

closed #10

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

0 Likes