Can't trigger a build using API

I can’t seem to trigger a build using the API on my project. The API calls seem to work pretty well, and I receive a 201 Created response for my build, but the build fails with the following error message:

Build-agent version 0.1.1301-dd8e9365 (2019-01-09T17:12:43+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 build_android 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:’
  • According to the project settings, “Enable Build Processing” is on.

  • According to my config.yml file, I have a build_android job in the jobs: section, and a top-level key called workflows:
version: 2.1
commands:
  set_short_hash:
    description: Set short hash from environment variable
    steps:
      - run:
          name: Set short git hash environment variable
          command: <hidden>
jobs:
  build_android:
    docker:
      - image: cstario/teambrain-build_android:1.1
    steps:
      - checkout
      - set_short_hash
      - restore_cache:
          name: Restore build cache
          key: cache:build_android-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}-{{ checksum "config.xml" }}
      - run:
          name: Prepare build
          command: <hidden>
      - save_cache:
          name: Save build cache
          paths:
            - node_modules
            - platforms
          key: build_cache-{{ checksum "package.json" }}-{{ checksum "package-lock.json" }}-{{ checksum "config.xml" }}
      - run:
          name: Build debug 
          command: <hidden>
      - run:
          name: Build release
          command: <hidden>
      - run:
          name: Copy artifacts
          command: <hidden>
      - persist_to_workspace:
          root: /tmp
          paths:
            - artifacts
      - store_artifacts:
          path: /tmp/artifacts
          destination: /
  build_ios:
    macos:
      xcode: "10.0"
    steps:
      - checkout
      - set_short_hash
      - run:
          name: Prepare build
          command: <hidden>
      - run:
          name: "[Fastlane] match certificates"
          command: <hidden>
      - run:
          name: Build debug 
          command: <hidden>
      - run:
          name: Build release
          command:  <hidden>
      - persist_to_workspace:
          root: /tmp
          paths:
            - artifacts
      - store_artifacts:
          path: /tmp/artifacts
          destination: /
  deploy_to_s3:
    docker:
      - image: cstario/teambrain-deploy_to_s3:1.2
    steps:
      - set_short_hash
      - attach_workspace:
          at: /tmp
      - deploy:
          name: Upload to S3
          command: <hidden>
      - run:
          name: Post to Slack
          command: <hidden>
workflows:
  version: 2
  build:
    jobs:
      - build_android
      - build_ios:
          filters:
            branches:
              ignore:
                - engineering/ci-use-cache
      - deploy_to_s3:
          requires:
            - build_android
            - build_ios
          filters:
            branches:
              only:
                - master

API HTTP Request/Response

Here is the HTTP request:

POST /api/v1.1/project/github/cstar-industries/cogiway-app/tree/engineering/ci-use-cache HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Authorization: Basic <hidden>
Connection: keep-alive
Content-Length: 45
Content-Type: application/json
Host: circleci.com
User-Agent: HTTPie/1.0.2

{
    "job": "build_android",
    "workflow": "build"
}

And the response:

HTTP/1.1 201 Created
Connection: keep-alive
Content-Length: 7672
Content-Type: application/json; charset=utf-8
Date: Tue, 22 Jan 2019 15:23:22 GMT
Location: https://circleci.com/api/v1.1/project/github/cstar-industries/cogiway-app/95
Server: nginx
Set-Cookie: ring-session=1Cdous1ZX3wawy75uy0tShEb3x0hcY2vldVo%2BtSjCVwHAFQCK%2BxvkuBtLw0RcpkoiFvOHOcs6cvO9C%2FBqbPmeks4kuIElU18r%2BtgpSzJUIgwEOtNQTdy6DxOd%2F3rDS63YMJKZ5W1t56oa1mNXlVEb75u1MSbr6KgBi0rh3oT%2FKJO%2FXQkaapPmCaID0Eai0Oa%2BxF6jzUZca15LDh5ZV6YlHGBzEOHgilLrYEN3lx76pk%3D--0uzkQYVXTw9Uc7xlbdT4urUcCOmIHfETMLduM1QEZA4%3D;Path=/;HttpOnly;Expires=Wed, 22 Jan 2020 12:57:25 +0000;Max-Age=1209600;Secure
Strict-Transport-Security: max-age=15724800
X-Circleci-Identity: circle-www-api-v1-7dd68fc789-5g62r
X-Circleci-Scopes: :write-settings
X-Circleci-Scopes: :view-builds
X-Circleci-Scopes: :read-settings
X-Circleci-Scopes: :trigger-builds
X-Circleci-Scopes: :all
X-Circleci-Scopes: :status
X-Circleci-Scopes: :none
X-Client-Trace-Id: 
X-Frame-Options: DENY
X-Request-Id: b1ddd312-fa28-4f7a-984a-c57150c7ce92
X-Route: /tree/:branch
X-Route: :branch
X-Route: [^,;?]+

{
    "author_date": null,
    "author_email": null,
    "author_name": null,
    "body": null,
    "branch": "engineering/ci-use-cache",
    "build_num": 95,
    "build_parameters": {},
    "build_time_millis": null,
    "build_url": "https://circleci.com/gh/cstar-industries/cogiway-app/95",
    "canceled": false,
    "canceler": null,
    "circle_yml": {
        "string": "version: 2.1\ncommands:\n  set_short_hash:\n    description: Set short hash from environment variable\n    steps:\n      - run:\n          name: Set short git hash environment variable\n          command: echo 'export CI_SHA1_SHORT=${CIRCLE_SHA1:0:7}' >> $BASH_ENV\njobs:\n  build_android:\n    docker:\n      - image: cstario/teambrain-build_android:1.1\n    steps:\n      - checkout\n      - set_short_hash\n      - restore_cache:\n          name: Restore build cache\n          key: cache:build_android-{{ checksum \"package.json\" }}-{{ checksum \"package-lock.json\" }}-{{ checksum \"config.xml\" }}\n      - run:\n          name: Prepare build\n          command: |\n            npm ci --no-progress --no-audit &&\n            ionic cordova platform add android --nosave\n      - save_cache:\n          name: Save build cache\n          paths:\n            - node_modules\n            - platforms\n          key: build_cache-{{ checksum \"package.json\" }}-{{ checksum \"package-lock.json\" }}-{{ checksum \"config.xml\" }}\n      - run:\n          name: Build debug \n          command: ionic cordova build android\n      - run:\n          name: Build release\n          command: |\n            ionic cordova build android --prod --release &&\n            jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore .circleci/release-key.jks -storepass $RELEASE_KEYSTORE_PASSWORD platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk cogiway &&\n            $ANDROID_HOME/build-tools/28.0.3/zipalign -v 4 platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk platforms/android/app/build/outputs/apk/release/app-release-signed.apk\n      - run:\n          name: Copy artifacts\n          command: |\n            mkdir /tmp/artifacts &&\n            cp platforms/android/app/build/outputs/apk/debug/app-debug.apk /tmp/artifacts/Kapitaliser-$CI_SHA1_SHORT-debug.apk &&\n            cp platforms/android/app/build/outputs/apk/release/app-release-signed.apk /tmp/artifacts/Kapitaliser-$CI_SHA1_SHORT.apk\n      - persist_to_workspace:\n          root: /tmp\n          paths:\n            - artifacts\n      - store_artifacts:\n          path: /tmp/artifacts\n          destination: /\n  build_ios:\n    macos:\n      xcode: \"10.0\"\n    steps:\n      - checkout\n      - set_short_hash\n      - run:\n          name: Prepare build\n          command: |\n            npm install --global ionic cordova &&\n            npm ci --no-progress --no-audit &&\n            ionic cordova platform add ios --nosave &&\n            mkdir /tmp/artifacts\n      - run:\n          name: \"[Fastlane] match certificates\"\n          command: |\n            cp -r .circleci/fastlane platforms/ios/fastlane &&\n            cd platforms/ios &&\n            fastlane match_cert &&\n            security find-identity -v -p codesigning fastlane_tmp_keychain\n      - run:\n          name: Build debug \n          command: |\n            ionic cordova build ios --device --debug -- --provisioningProfile=\"61896fd4-7458-42b3-a0fe-0a9cee04b757\" --codeSignIdentity=\"iPhone Developer\" --developmentTeam=\"8GGR5ZFAGZ\" --buildFlag=\"-UseModernBuildSystem=0\" &&\n            cp platforms/ios/build/device/Kapitaliser.ipa /tmp/artifacts/Kapitaliser-$CI_SHA1_SHORT-debug.ipa\n      - run:\n          name: Build release\n          command:  |\n            ionic cordova build ios --device --prod --release -- --provisioningProfile=\"61896fd4-7458-42b3-a0fe-0a9cee04b757\" --codeSignIdentity=\"iPhone Developer\" --developmentTeam=\"8GGR5ZFAGZ\" --buildFlag=\"-UseModernBuildSystem=0\" &&\n            cp platforms/ios/build/device/Kapitaliser.ipa /tmp/artifacts/Kapitaliser-$CI_SHA1_SHORT.ipa\n      - persist_to_workspace:\n          root: /tmp\n          paths:\n            - artifacts\n      - store_artifacts:\n          path: /tmp/artifacts\n          destination: /\n\n  deploy_to_s3:\n    docker:\n      - image: cstario/teambrain-deploy_to_s3:1.2\n    steps:\n      - set_short_hash\n      - attach_workspace:\n          at: /tmp\n      - deploy:\n          name: Upload to S3\n          command: |\n            aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID &&\n            aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY &&\n            aws s3 cp /tmp/artifacts/Kapitaliser-$CI_SHA1_SHORT.apk s3://kapitaliser-builds/apk/Kapitaliser-$CI_SHA1_SHORT.apk &&\n            aws s3 cp /tmp/artifacts/Kapitaliser-$CI_SHA1_SHORT-debug.apk s3://kapitaliser-builds/apk/Kapitaliser-$CI_SHA1_SHORT-debug.apk &&\n            aws s3 cp /tmp/artifacts/Kapitaliser-$CI_SHA1_SHORT.apk s3://kapitaliser-builds/Kapitaliser.apk &&\n            aws s3 cp /tmp/artifacts/Kapitaliser-$CI_SHA1_SHORT.ipa s3://kapitaliser-builds/apk/Kapitaliser-$CI_SHA1_SHORT.ipa &&\n            aws s3 cp /tmp/artifacts/Kapitaliser-$CI_SHA1_SHORT-debug.ipa s3://kapitaliser-builds/apk/Kapitaliser-$CI_SHA1_SHORT-debug.ipa &&\n            aws s3 cp /tmp/artifacts/Kapitaliser-$CI_SHA1_SHORT.ipa s3://kapitaliser-builds/Kapitaliser.ipa\n      - run:\n          name: Post to Slack\n          command: |\n            curl \\\n            -XPOST \\\n            -d '{\"text\":\"TeamBrain CI success (<https://circleci.com/workflow-run/'$CIRCLE_WORKFLOW_ID'|view workflow>)\",\"attachments\":[{\"color\":\"#666\",\"fields\":[{\"title\":\"Debug APK\",\"value\":\"https://kapitaliser-builds.s3.amazonaws.com/apk/Kapitaliser-'$CI_SHA1_SHORT'-debug.apk\"},{\"title\":\"Release APK\",\"value\":\"https://kapitaliser-builds.s3.amazonaws.com/apk/Kapitaliser-'$CI_SHA1_SHORT'.apk\"},{\"title\":\"Debug IPA\",\"value\":\"https://kapitaliser-builds.s3.amazonaws.com/apk/Kapitaliser-'$CI_SHA1_SHORT'-debug.ipa\"},{\"title\":\"Release IPA\",\"value\":\"https://kapitaliser-builds.s3.amazonaws.com/apk/Kapitaliser-'$CI_SHA1_SHORT'.ipa\"}]}]}' \\\n            $SLACK_HOOK_URL\nworkflows:\n  version: 2\n  build:\n    jobs:\n      - build_android\n      - build_ios:\n          filters:\n            branches:\n              ignore:\n                - engineering/ci-use-cache\n      - deploy_to_s3:\n          requires:\n            - build_android\n            - build_ios\n          filters:\n            branches:\n              only:\n                - master\n\n"
    },
    "committer_date": null,
    "committer_email": null,
    "committer_name": null,
    "compare": null,
    "dont_build": null,
    "fail_reason": null,
    "failed": null,
    "infrastructure_fail": false,
    "is_first_green_build": false,
    "job_name": null,
    "lifecycle": "not_running",
    "messages": [],
    "no_dependency_cache": false,
    "node": null,
    "oss": false,
    "outcome": null,
    "parallel": 1,
    "picard": null,
    "platform": "2.0",
    "previous": {
        "build_num": 94,
        "build_time_millis": 106,
        "status": "failed"
    },
    "previous_successful_build": {
        "build_num": 87,
        "build_time_millis": 516211,
        "status": "success"
    },
    "reponame": "cogiway-app",
    "retries": null,
    "retry_of": null,
    "ssh_disabled": true,
    "ssh_users": [],
    "start_time": null,
    "status": "not_running",
    "stop_time": null,
    "subject": null,
    "timedout": false,
    "usage_queued_at": "2019-01-22T15:23:22.778Z",
    "user": {
        "avatar_url": "https://avatars2.githubusercontent.com/u/731497?v=4",
        "id": 731497,
        "is_user": true,
        "login": "loderunner",
        "name": "Charles Francoise",
        "vcs_type": "github"
    },
    "username": "cstar-industries",
    "vcs_revision": "ede6334e406f93f92ee3261a67e7ca7d343287c9",
    "vcs_tag": null,
    "vcs_type": "github",
    "vcs_url": "https://github.com/cstar-industries/cogiway-app",
    "why": "api"
}

hey loderunner, where you able to figure this out, I have the same issue with my builds as well

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