labs42io / circleci-monorepo

An example of monorepo with CircleCI using conditional workflows and pipeline parameters.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Curl to trigger execution of package workflow fails

tricky42 opened this issue · comments

Right now I am running into the problem that the curl call to trigger the package workflow fails with a 404 response code:

Received status code: 404
Response:
{
  "message" : "Project not found"
}

The CIRCLE_TOKEN is set, so I am a bit clueless...

curl -s -v -u '****************************************:' -o response.txt -w '%{http_code}' -X POST --header 'Content-Type: application/json' -d '{ "branch": "build-docker-images", "parameters": { "trigger":false, "backoffice-helm":true } }' 'https://circleci.com/api/v2/project/github/********/pipeline'
*   Trying 18.208.34.245...
* TCP_NODELAY set
* Connected to circleci.com (18.208.34.245) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [89 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [4838 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [333 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=*.circleci.com
*  start date: Nov 20 00:00:00 2019 GMT
*  expire date: Dec 20 12:00:00 2020 GMT
*  subjectAltName: host "circleci.com" matched cert's "circleci.com"
*  issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon
*  SSL certificate verify ok.
* Server auth using Basic with user '****************************************'
} [5 bytes data]
> POST /api/v2/project/github/************/pipeline HTTP/1.1
> Host: circleci.com
> Authorization: Basic *************
> User-Agent: curl/7.58.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 94
> 
} [94 bytes data]
* upload completely sent off: 94 out of 94 bytes
{ [5 bytes data]
< HTTP/1.1 404 Not Found
< Content-Type: text/plain;charset=utf-8
< Date: Thu, 30 Jul 2020 16:34:21 GMT
< Server: nginx
< Set-Cookie: ring-session=**********;Path=/;HttpOnly;Expires=Fri, 30 Jul 2021 13:53:29 +0000;Max-Age=1209600;Secure
< Strict-Transport-Security: max-age=15724800
< X-CircleCI-Identity: circle-www-api-v1-75dfdb44f4-5m4dj
< X-Frame-Options: DENY
< X-RateLimit-Limit: 151
< X-RateLimit-Remaining: 150
< X-RateLimit-Reset: 0
< x-request-id: 9bad84c0-4a59-455c-a12c-35f9e19b94dd
< X-route: /api/v2/project/:project-slug/pipeline
< Content-Length: 37
< Connection: keep-alive
< 
{ [37 bytes data]
* Connection #0 to host circleci.com left intact
Received status code: 404
Response:
{
  "message" : "Project not found"
}

Ahhh I found the problem.... Project Level API Tokens do not work, even if you select ALL scopes :(
Only personal API Tokens work...

As it is clearly also written in the README :( Sorry my mistake of not reading the README... but the CircleCI documentation and maybe my expectation that a ALL scoped token would work was helping either....