Skip to content

Commit

Permalink
Improving error handling on get tfs repo artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
jdewinne committed Feb 23, 2017
1 parent dd1804a commit 6fe4207
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.gradle
.idea
build
supervisord.*
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ deploy:
provider: releases
api_key:
secure: CmkIWOhshU9wGtopnJZMtP/cIvCGR4WcOelOgSwtpu5UiMlbhmqTIQnHNOASe5kytmv3jleuC9PzzBYM7Dp4PMHs4lP5QbKLB+O6GQ40dPL7OL56DinCv9DBbTLXn57bz69GZwyxbGEumg6S8Zt5nA0H0D9tq41J2p8M65hjIxKNm5MGeNvdHA5Z7PZvZsxbjIvkvVj9/ySmN4phbVk1hh3TJefd273gDJ/CtSb1yNGqIXiolnP+GEwxXn82bJynWg3KUXI659cT74vrZiMGpmt4r8RSvz1YZyzW2aCgSigVpmrwSm+r7kwZ4MGySXTp6tYY66uR8mJnNgVNzOZco9FExb/m7T/H06okERq9uxC7X5zcvYRvnJx1XesJcdgN6ctRaR2ynglh8wpJQfNG74IZhm0MXUpJ5e4A1gFdKMShjS81MP78LYe0bGs5sAdnDKZe3moj+eXgpSbUh22eDud87xOZPKNodnQvgjQZPZWwSOiiP+WNFDWY7T/lhcDW/yPTR6Mq7eCdn54EE+zzJQ9C8fPCmagypbTW6+BDOF2wB+whIAd5ysgWi7WdM8v3WAjXd9VXXpHpeU42r/Lr0L3BMMuf4L1Z0Y66FIjIXKNXYa7WocSuaCdC6oKucBugcRg5OxFZarWyj1HQei9mhTQYTw+tWb9Y3DdO3M43t84=
file: build/libs/xlr-tfs-plugin-1.0.4.jar
file: build/libs/xlr-tfs-plugin-1.0.5.jar
skip_cleanup: true
on:
all_branches: true
Expand Down
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
plugins {
id "com.github.hierynomus.license" version "0.13.0"
id "com.xebialabs.xlr.docker" version "1.1.12"
id "com.xebialabs.xl.docker" version "1.0.0"
}

version='1.0.4'
version='1.0.5'

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'maven'

xlrDocker {
version = '5.0.1.10'
xlDocker {
compileImage = 'xebialabs/xlr_dev_compile'
compileVersion = 'v6.1.0.1'
runImage = 'xebialabs/xlr_dev_run'
runVersion = 'v6.1.0.1'
runPortMapping = '15516:5516'
}

license {
Expand Down
13 changes: 5 additions & 8 deletions src/main/resources/tfsrest/GetTfsRepoArtifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,19 @@

request = HttpRequest(tfsServer)
if username:
request.username = username
request.username = username
if password:
request.password = password

#contentType = "application/octet-stream"

response = request.get('%s/_apis/git/repositories?api-version=1.0' % collectionName)

httpStatusCode = response.status
if not response.isSuccessful():
raise Exception("Error in getting repositories. Server return [%s], with content [%s]" % (response.status, response.response))

if response.isSuccessful():
repositoryId = json.loads(response.response)['value'][0]['id']
print "Repository id is %s" % repositoryId
else:
print "Error in getting repositories"
sys.exit(1)
repositoryId = json.loads(response.response)['value'][0]['id']
print "Repository id is %s" % repositoryId

response = request.get('%s/_apis/git/repositories/%s/items?api-version=1.0&scopepath=%s' % (collectionName,repositoryId, scopePath))

Expand Down

0 comments on commit 6fe4207

Please sign in to comment.