REST API for clearing build cache do not remove it

Azat's Avatar

Azat

29 Jan, 2019 09:46 AM

I tried to make the following request:
  DELETE https://ci.appveyor.com/api/projects/nmathewson/libevent/buildCache

But seems that the cache still there:
  https://ci.appveyor.com/project/nmathewson/libevent/build/job/6ta46tbcrxgoa9eq#L13

Also I tried to manually trigger with APPVEYOR_CACHE_SKIP_RESTORE the build and it reports an error:
$ curl -s -d@- -H 'Authorization: Bearer <token>' 'https://ci.appveyor.com/api/builds' <<<'{"accountName": "nmathewson", "projectSlug": "libevent", "environmentVariables": { "APPVEYOR_CACHE_SKIP_RESTORE": "true" }}' | jq .
{
  "message": "The request is invalid.",
  "modelState": {
    "request.AccountName": [
      "The AccountName field is required."
    ],
    "request.ProjectSlug": [
      "The ProjectSlug field is required."
    ]
  }
}

Maybe some urlencode issue?

  1. 1 Posted by Azat on 04 Feb, 2019 10:40 PM

    Azat's Avatar

    Friendly ping

  2. Support Staff 2 Posted by Ilya Finkelshte... on 05 Feb, 2019 09:15 AM

    Ilya Finkelshteyn's Avatar

    Sorry for delay with reply and thank you for the catch. Filed this issue, should be fixed soon.

    Regarding build start with environment variables, it should work. Please check this PowerShell sample.

    Here is curl command which works for me (replace _replace_ with your values):

    curl -H "Authorization: Bearer _replace_" -H "Content-Type: application/json" -X POST https://ci.appveyor.com/api/builds -d "{accountName: \"_replace_\", projectSlug: \"_replace_\", branch: \"master\", environmentVariables: {APPVEYOR_CACHE_SKIP_RESTORE: \"true\"}}"
    
  3. 3 Posted by Azat on 05 Feb, 2019 09:34 AM

    Azat's Avatar

    >Sorry for delay with reply and thank you for the catch. Filed this issue, should be fixed soon.

    Great, thanks!

    > curl -H "Authorization: Bearer _replace_" -H "Content-Type: application/json" -X POST https://ci.appveyor.com/api/builds -d "{accountName: \"_replace_\", projectSlug: \"_replace_\", branch: \"master\", environmentVariables: {APPVEYOR_CACHE_SKIP_RESTORE: \"true\"}}"

    Doh, missing Content-Type, thanks!

    I have one more question about API, my account has access to another, and when I tried to schedule the build with api key v2 (that should have access to all accounts AFAICS) it failed with "Project not found or access denied.", but once I get key for the sub-account it succeed, am I missing something?
    Nevemind, looks like I should prepend "/api/account/<account-name>/" to the API URLs

  4. Azat closed this discussion on 05 Feb, 2019 09:34 AM.

  5. Ilya Finkelshteyn re-opened this discussion on 05 Feb, 2019 06:00 PM

  6. Support Staff 4 Posted by Ilya Finkelshte... on 05 Feb, 2019 06:00 PM

    Ilya Finkelshteyn's Avatar

    Yeah, "all accounts" API key require you to add account/<account-name>. It was done to implement account switching without re-login. But all API samples still assume account-level API key.

  7. Ilya Finkelshteyn closed this discussion on 05 Feb, 2019 06:00 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

20 Mar, 2019 11:39 PM
20 Mar, 2019 09:03 PM
20 Mar, 2019 08:55 PM
20 Mar, 2019 08:48 PM
20 Mar, 2019 08:02 PM

 

20 Mar, 2019 07:14 PM
20 Mar, 2019 06:27 PM
20 Mar, 2019 04:02 PM
20 Mar, 2019 08:51 AM
19 Mar, 2019 06:21 PM
19 Mar, 2019 05:22 PM