示例#1
0
import json, sys, time
from xlrhttp.HttpRequest import HttpRequest

print "Executing QueueBuild"

if tfsServer is None:
    print "No server provided"
    sys.exit(1)

contentType = 'application/json'

request = HttpRequest(tfsServer, username, password, domain)

response = request.get(
    '%s/%s/_apis/build/definitions?api-version=2.0&name=%s' %
    (collectionName, teamProjectName, buildDefinitionName))

if not response.isSuccessful():
    raise Exception(
        "Error fetching build definition. Server return [%s], with content [%s]"
        % (response.status, response.response))
print response.response
json_response = json.loads(response.getResponse())
if json_response["count"] != 1:
    raise Exception(
        "Error fetching build definition. Server return [%s], with content [%s]"
        % (response.status, response.response))

build_definition_id = json.loads(response.getResponse())["value"][0]["id"]
示例#2
0
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

import json
from xlrhttp.HttpRequest import HttpRequest

if tfsServer is None:
    print "No server provided"
    sys.exit(1)

request = HttpRequest(tfsServer, username, password, domain)
url = "%s/%s/_apis/tfvc/changesets?api-version=1.0" % (collection, project)

response = request.get(url)

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

json_object = json.loads(response.response)

commits = json_object["value"]
latest_commit = commits[0]
changesetId = latest_commit["changesetId"]

triggerState = str(changesetId)
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

import sys
import com.xhaus.jyson.JysonCodec as json
from tempfile import mkdtemp
from xlrhttp.HttpRequest import HttpRequest

print "Executing GetTfsRepoArtifacts"

if tfsServer is None:
    print "No server provided"
    sys.exit(1)

request = HttpRequest(tfsServer, username, password, domain)
response = request.get('%s/_apis/git/repositories?api-version=1.0' %
                       collectionName)

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

repository_id = json.loads(response.response)['value'][0]['id']
print "Repository id is %s" % repository_id

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

if not response.isSuccessful():
    raise Exception(