Option: Empty Default branch to be the most recent commit from the Branches to build, settings.

Pure Krome's Avatar

Pure Krome

09 Jul, 2015 06:53 AM

Hi,

see this pic:

I look at these two settings as:

Default Branch : when ever i manually push the BUILD button in AV, it will git clone etc from that branch.
Branches to build : when a git webhook is sent to AV, AV will decide if it should git clone, based on the settings, here.

Would be awesome if Default Branch could have the option to get the latest commit from whatever setting is in Branches to build.

For example. I have:

branches:
  exclude:
    - master

so when i manually press the build button in AV, it will grab the most recent commit that is NOT from the master branch. Boom! awesome!

Otherwise, set a value and it's the most recent commit from that branch (as is what's happening, now).

  1. 1 Posted by Pure Krome on 09 Jul, 2015 09:02 AM

    Pure Krome's Avatar

    Also - are the Default Branch & Branches to Build in the GUI totally separate and independant to the branches: section in the yml? (my question above is suggesting they are linked...)

    ie.**Default Branch** & Branches to Build are used to determine if the build should start/kick off while the branches: section i the .yml file is used to split out config data _AFTER the build has been determined to go ahead and start?

    eg.

    • if master kick off build (GUI Setting)
    • Ok .. we have a build started .. now ... if master, then deploy here, else deploy there... (config file setting)
  2. Support Staff 2 Posted by Feodor Fitsner on 10 Jul, 2015 01:51 AM

    Feodor Fitsner's Avatar

    "Default Branch" and "Branches to Build" are separate from those one in appveyor.yml. Basically, it's either UI or YAML there.

    Regarding getting commit of "not master" - nice idea but I'm not sure if it's possible using GitHub API.

  3. 3 Posted by Pure Krome on 10 Jul, 2015 02:01 AM

    Pure Krome's Avatar

    "Default Branch" and "Branches to Build" are separate from those one in appveyor.yml. Basically, it's either UI or YAML there.

    So .. if it's UI or YAML .. if i go the YAML way, how does the AV service know when to pull down .. if using the file means it has to pull down first to find the file to check what branches to use?

  4. Support Staff 4 Posted by Feodor Fitsner on 10 Jul, 2015 02:11 AM

    Feodor Fitsner's Avatar

    It just fetches a single appveyor.yml at specified commit ID using GitHub API.

  5. 5 Posted by Pure Krome on 10 Jul, 2015 02:24 AM

    Pure Krome's Avatar

    AH! winnah!!

    so does that mean .. basically ... the only UI elements in the project settings are

    • Project name
    • Next build number
    • git repo details

    the only settings that are NOT available via a YAML file?

  6. 6 Posted by Pure Krome on 10 Jul, 2015 02:29 AM

    Pure Krome's Avatar

    Also - another question about this..

    if the AV service uses either the UI or the File ... what would the UI look like if i did this file setting in the UI

    branches:
      except:
        - master
    

    Basically, the UI has 2 settings .. and the file has 1?

  7. Support Staff 7 Posted by Feodor Fitsner on 10 Jul, 2015 02:32 AM

    Feodor Fitsner's Avatar

    Like that?

  8. 8 Posted by Pure Krome on 10 Jul, 2015 02:44 AM

    Pure Krome's Avatar

    How do you define the default branch in file?

    also, the previous q (above) about UI elements?

  9. Support Staff 9 Posted by Feodor Fitsner on 10 Jul, 2015 02:49 AM

    Feodor Fitsner's Avatar

    Ah, Default branch is on UI only. Sorry if I confused you.

  10. 10 Posted by Pure Krome on 10 Jul, 2015 03:53 AM

    Pure Krome's Avatar

    Sweet. ok. i've fired off a support query to GH to see if they have some GH Api :sparkle: magic that can do this :)

  11. 11 Posted by Pure Krome on 10 Jul, 2015 06:28 AM

    Pure Krome's Avatar

    OK . GH replied. First, their reply, them my comment...

    Hi Pure Krome,

    The only API endpoint which will give you timestamps for when a commit was pushed is the Events API:

    https://developer.github.com/v3/activity/events/

    The Events API allows you to fetch the last 300 events for a repository, so you could check that and see if you notice a PushEvent:

    https://developer.github.com/v3/activity/events/types/#pushevent

    The latest PushEven will contain the most recent commit. If you don't notice any PushEvents, then you can't determine which commits were pushed most recently -- you can only determine which commits are at the tips of the repository's branches:

    https://developer.github.com/v3/repos/#list-branches

    Another approach would be to set up a webhook on the repository so that you get notified of all push events:

    https://developer.github.com/webhooks/

    I hope this answers your question.

    Right now, my repo's look like they have WebHooks wired up already, so you could leverage the Push Event that occurs with the webhook and just read what branch the commit occurred against:

    https://developer.github.com/v3/activity/events/types/#pushevent

    and then use the ref payload value :)

    WIN!

  12. 12 Posted by Pure Krome on 14 Jul, 2015 01:07 AM

    Pure Krome's Avatar

    Also - if it's possible to do this ... then this could also be added to a YAML file?

    branches
      except:
        - master
    defaultbranch: any
    

    ^ where any is a reserverd word (documented) or that value can be left empty... (as the title of this post, suggested)

    branches
      except:
        - master
    defaultbranch:
    
  13. Support Staff 13 Posted by Feodor Fitsner on 14 Jul, 2015 01:10 AM

    Feodor Fitsner's Avatar

    Push event is wired anyway. As far as I understand their suggestion is to collect information about pushes and then use last push. It won't work if webhook disabled. I'd leave default branch on UI.

  14. 14 Posted by Pure Krome on 14 Jul, 2015 01:15 AM

    Pure Krome's Avatar

    But ... nothing would work if the webhook is disabled? that's how AV works, right?

  15. Support Staff 15 Posted by Feodor Fitsner on 14 Jul, 2015 01:21 AM

    Feodor Fitsner's Avatar

    You can start new builds with "New build" button - many users do manual or scheduled builds.

  16. 16 Posted by Pure Krome on 14 Jul, 2015 01:35 AM

    Pure Krome's Avatar

    but doesn't that button just read the value of the Default branch .. which might defeat the purpose of what I'm trying => eg. run a new build of the most recent commit. (well, that's usually what i want to try and do).

    side note: i do understand the process when people want to push a button, to manually kick of a live/production build/deployment.

  17. Support Staff 17 Posted by Feodor Fitsner on 14 Jul, 2015 01:50 AM

    Feodor Fitsner's Avatar

    Yes, it reads default branch and gets the latest commit from that branch. Looks like what you are trying to do can be accomplished by going to a history and clicking "Re-build commit" on the top most one.

  18. 18 Posted by Pure Krome on 14 Jul, 2015 04:42 AM

    Pure Krome's Avatar

    NP. i'll close this off then. Cheers for walking through the discussion with me.

  19. Pure Krome closed this discussion on 14 Jul, 2015 04:42 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

Recent Discussions

07 Jul, 2020 06:21 PM
07 Jul, 2020 03:15 PM
05 Jul, 2020 02:33 AM
03 Jul, 2020 07:29 PM
03 Jul, 2020 03:53 AM

 

02 Jul, 2020 09:09 PM
02 Jul, 2020 03:24 PM
01 Jul, 2020 01:12 PM
30 Jun, 2020 04:26 PM
25 Jun, 2020 05:54 PM
24 Jun, 2020 08:11 AM