From 6fe42076aa58a088b29278f667c3273148690dd3 Mon Sep 17 00:00:00 2001 From: Joris De Winne Date: Thu, 23 Feb 2017 09:42:02 -0800 Subject: [PATCH] Improving error handling on get tfs repo artifacts --- .gitignore | 1 + .travis.yml | 2 +- build.gradle | 12 ++++++++---- src/main/resources/tfsrest/GetTfsRepoArtifacts.py | 13 +++++-------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index e0d53d8..a2dc5b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .gradle .idea build +supervisord.* diff --git a/.travis.yml b/.travis.yml index a5bb847..0cd6960 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/build.gradle b/build.gradle index 0e8cd6b..c871820 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { diff --git a/src/main/resources/tfsrest/GetTfsRepoArtifacts.py b/src/main/resources/tfsrest/GetTfsRepoArtifacts.py index 1f958c7..5131d9f 100644 --- a/src/main/resources/tfsrest/GetTfsRepoArtifacts.py +++ b/src/main/resources/tfsrest/GetTfsRepoArtifacts.py @@ -16,7 +16,7 @@ request = HttpRequest(tfsServer) if username: - request.username = username + request.username = username if password: request.password = password @@ -24,14 +24,11 @@ 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))