Teamcity REST API get latest successful build on a branch

I’m using git flow with teamcity as my CI server. I’d like to pull artifacts from the latest successful build on a particular branch.

I can use this url to get the latest build on a branch: http://$teamcity$/httpAuth/app/rest/buildTypes/name:$BuildTypeName$/builds/branch:name:$branchName$

  • Remove previous commit from git while keeping latest changes?
  • find - folder isn't excluded and sed corrupts git index because of it
  • git - Change all global settings
  • How to install Symfony 2.7?
  • What happens when GIT runs out of hash values for your Revisions?
  • How do I delete other subdirectories when doing git filter-branch
  • but it fails if the branch name contains / (e.g., git flow names branches feature/% and release/%).

    I’ve tried url encoding the /. For example, if $branchName$> == 'release/branchName' I use /builds/branch:name:release%2F$branchName$).

    • works – /builds/branch:name:develop
    • fails – /builds/branch:name:release%2F$branchName$.

    I don’t get an API error, but the api result is empty.

  • Where is git Fetch data stored?
  • How can i push a git history to svn
  • Syntax for Git Submodule Foreach Pull?
  • Move uncommitted changes from current branch to another branch that conflicts with those changes
  • detail change after git pull
  • Why choose VSO over IaaS TFS 2013/15
  • 2 Solutions collect form web for “Teamcity REST API get latest successful build on a branch”

    You can work around this by putting your build locator into a query string rather than as part of the path element of the URL, i.e. instead of /builds/branch:name:release%2F1.0.1 or the like, you could do /builds?locator=branch:name:release%2F1.0.1. The format of the data coming back does not seem to be the same, but it does include the internal build ID, so you can always make a second request for that exact build using that ID, e.g. /builds/id:3332.

    Another point, which I have not personally tried, is found on this comment from JetBrains’ issue tracker:

    I delved into this a bit and discovered that Tomcat versions 6.0.10 and newer by default don’t accept encoded slashes and backslashes in path elements anymore. This behavior can be changed by changing two Tomcat server properties (found on http://tomcat.apache.org/security-6.html#Fixed_in_Apache_Tomcat_6.0.10):

    -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
    -Dorg.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=true
    

    I do not know if this is considered a bad security practice.

    Apparently this is a bug in TeamCity as of 8.0.3

    It looks like it is being worked on.

    Git Baby is a git and github fan, let's start git clone.