Using a "for" section restricts builds to PRs only

Tom Wright's Avatar

Tom Wright

23 Feb, 2018 10:54 PM

Hi,

I was trying to automatically publish a package to NuGet.org whenever a commit got added to my master branch. To do this, I added the following to my appveyor.yml file:

for:
-
  branches:
    only:
      - master
  
  build:
    publish_nuget: true
    
  artifacts:
  - path: '**\ConTabs.tdwright.1.1.0.nupkg'
    name: NuGetPackage
  
  deploy:
    provider: NuGet
    api_key:
      secure: ghjsPlGg7R8v7U9ZYy9PxUWAJ4ijiCM/pSwXxy5eHarElGSM6gmhfdGH+EqNSsWM
    skip_symbols: false
    artifact: '**\ConTabs.tdwright.1.1.0.nupkg'

But then I struggled to get it to work. I could see that GitHub was firing webhooks and getting 204s, but AppVeyor was doing nothing. So:

  1. I tried a few fixes, but none of the commits trigger a build.
  2. Out of desperation, I tried a pull request and was surprised to see that it worked.
  3. I then made another commit with the PR still open and this one also triggered the build.
  4. I then closed the PR and pushed another commit - this one didn't trigger a build.
  5. Removing the for section from my appveyor.yml file and pushing to develop did once again trigger the build.

In other words, there seems to be a causal relationship between that for section of the YML and whether or not a build was triggered outside of a PR. My intention wasn't to restrict builds to PRs only and as far as I can tell I've not told AppVeyor to do that. According to the docs for this feature, the only effect should be to overwrite certain settings.

What's going on? Have I missed something stupid? Or is there a bug?

Tom

PS Love AppVeyor - thanks for keeping it free!

  1. 1 Posted by Ilya Finkelshte... on 24 Feb, 2018 04:33 AM

    Ilya Finkelshteyn's Avatar

    It appears to be a bug. Please look at this post for information about fix and a workaround.

  2. 2 Posted by Tom Wright on 24 Feb, 2018 08:24 PM

    Tom Wright's Avatar

    Thanks Ilya. Good to know I'm not going mad!

    I did try the workaround listed on the other post, but unfortunately it still didn't work.

    Anything else I could try? Or just sit tight until the bug is resolved?

  3. 3 Posted by Ilya Finkelshte... on 25 Feb, 2018 09:23 AM

    Ilya Finkelshteyn's Avatar

    In your case you should probably add something like this in the end of the YAML:

    -
      branches:
        except:
          - master
    
  4. 4 Posted by Tom Wright on 25 Feb, 2018 12:11 PM

    Tom Wright's Avatar

    D'oh! Of course! Treated that like a magic incantation and didn't think about the underlying intent.

    Have updated my config and am pleased to report it's building again! Thanks for your help.

    Now just need to test the new behaviour I was trying to implement...

  5. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:26 AM.

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