Skip to content

Commit

Permalink
Fix for TeamCity buildQueue REST API build/@branchName.
Browse files Browse the repository at this point in the history
Strips the refs/*/ if any to get just the branchName out of a :ref
e.g.: `refs/heads/feature/newProfile` -> `feature/newProfile`

The TeamCity buildQueue POST data require the branchName attribute
to contain just the branch name (just xyzbranch and not the full
ref in the refs/heads/xyzbranch). With the refs/heads/xyzbranch the
build is triggered and looks like it is working however it always
ompiles the default branch (or master).
  • Loading branch information
opichals committed Feb 18, 2015
1 parent 0b8e41a commit 7ff854e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/models/project_services/teamcity_service.rb
Expand Up @@ -121,7 +121,9 @@ def execute(data)
password: password,
}

branch = data[:ref]
# strip the refs/*/ if any to get just the branchName out of a :ref
# e.g.: `refs/heads/feature/newProfile` -> `feature/newProfile`
branch = data[:ref].match("(refs\/.*?\/)?(.*)$")[2]

self.class.post("#{teamcity_url}/httpAuth/app/rest/buildQueue",
body: "<build branchName=\"#{branch}\">"\
Expand Down

0 comments on commit 7ff854e

Please sign in to comment.