initial import for Open Source 🎉
This commit is contained in:
parent
1898c361f3
commit
9c0dd3b722
2048 changed files with 218743 additions and 0 deletions
0
buildtrigger/test/__init__.py
Normal file
0
buildtrigger/test/__init__.py
Normal file
159
buildtrigger/test/bitbucketmock.py
Normal file
159
buildtrigger/test/bitbucketmock.py
Normal file
|
@ -0,0 +1,159 @@
|
|||
from datetime import datetime
|
||||
from mock import Mock
|
||||
|
||||
from buildtrigger.bitbuckethandler import BitbucketBuildTrigger
|
||||
from util.morecollections import AttrDict
|
||||
|
||||
def get_bitbucket_trigger(dockerfile_path=''):
|
||||
trigger_obj = AttrDict(dict(auth_token='foobar', id='sometrigger'))
|
||||
trigger = BitbucketBuildTrigger(trigger_obj, {
|
||||
'build_source': 'foo/bar',
|
||||
'dockerfile_path': dockerfile_path,
|
||||
'nickname': 'knownuser',
|
||||
'account_id': 'foo',
|
||||
})
|
||||
|
||||
trigger._get_client = get_mock_bitbucket
|
||||
return trigger
|
||||
|
||||
def get_repo_path_contents(path, revision):
|
||||
data = {
|
||||
'files': [{'path': 'Dockerfile'}],
|
||||
}
|
||||
|
||||
return (True, data, None)
|
||||
|
||||
def get_raw_path_contents(path, revision):
|
||||
if path == 'Dockerfile':
|
||||
return (True, 'hello world', None)
|
||||
|
||||
if path == 'somesubdir/Dockerfile':
|
||||
return (True, 'hi universe', None)
|
||||
|
||||
return (False, None, None)
|
||||
|
||||
def get_branches_and_tags():
|
||||
data = {
|
||||
'branches': [{'name': 'master'}, {'name': 'otherbranch'}],
|
||||
'tags': [{'name': 'sometag'}, {'name': 'someothertag'}],
|
||||
}
|
||||
return (True, data, None)
|
||||
|
||||
def get_branches():
|
||||
return (True, {'master': {}, 'otherbranch': {}}, None)
|
||||
|
||||
def get_tags():
|
||||
return (True, {'sometag': {}, 'someothertag': {}}, None)
|
||||
|
||||
def get_branch(branch_name):
|
||||
if branch_name != 'master':
|
||||
return (False, None, None)
|
||||
|
||||
data = {
|
||||
'target': {
|
||||
'hash': 'aaaaaaa',
|
||||
},
|
||||
}
|
||||
|
||||
return (True, data, None)
|
||||
|
||||
def get_tag(tag_name):
|
||||
if tag_name != 'sometag':
|
||||
return (False, None, None)
|
||||
|
||||
data = {
|
||||
'target': {
|
||||
'hash': 'aaaaaaa',
|
||||
},
|
||||
}
|
||||
|
||||
return (True, data, None)
|
||||
|
||||
def get_changeset_mock(commit_sha):
|
||||
if commit_sha != 'aaaaaaa':
|
||||
return (False, None, 'Not found')
|
||||
|
||||
data = {
|
||||
'node': 'aaaaaaa',
|
||||
'message': 'some message',
|
||||
'timestamp': 'now',
|
||||
'raw_author': 'foo@bar.com',
|
||||
}
|
||||
|
||||
return (True, data, None)
|
||||
|
||||
def get_changesets():
|
||||
changesets_mock = Mock()
|
||||
changesets_mock.get = Mock(side_effect=get_changeset_mock)
|
||||
return changesets_mock
|
||||
|
||||
def get_deploykeys():
|
||||
deploykeys_mock = Mock()
|
||||
deploykeys_mock.create = Mock(return_value=(True, {'pk': 'someprivatekey'}, None))
|
||||
deploykeys_mock.delete = Mock(return_value=(True, {}, None))
|
||||
return deploykeys_mock
|
||||
|
||||
def get_webhooks():
|
||||
webhooks_mock = Mock()
|
||||
webhooks_mock.create = Mock(return_value=(True, {'uuid': 'someuuid'}, None))
|
||||
webhooks_mock.delete = Mock(return_value=(True, {}, None))
|
||||
return webhooks_mock
|
||||
|
||||
def get_repo_mock(name):
|
||||
if name != 'bar':
|
||||
return None
|
||||
|
||||
repo_mock = Mock()
|
||||
repo_mock.get_main_branch = Mock(return_value=(True, {'name': 'master'}, None))
|
||||
repo_mock.get_path_contents = Mock(side_effect=get_repo_path_contents)
|
||||
repo_mock.get_raw_path_contents = Mock(side_effect=get_raw_path_contents)
|
||||
repo_mock.get_branches_and_tags = Mock(side_effect=get_branches_and_tags)
|
||||
repo_mock.get_branches = Mock(side_effect=get_branches)
|
||||
repo_mock.get_tags = Mock(side_effect=get_tags)
|
||||
repo_mock.get_branch = Mock(side_effect=get_branch)
|
||||
repo_mock.get_tag = Mock(side_effect=get_tag)
|
||||
|
||||
repo_mock.changesets = Mock(side_effect=get_changesets)
|
||||
repo_mock.deploykeys = Mock(side_effect=get_deploykeys)
|
||||
repo_mock.webhooks = Mock(side_effect=get_webhooks)
|
||||
return repo_mock
|
||||
|
||||
def get_repositories_mock():
|
||||
repos_mock = Mock()
|
||||
repos_mock.get = Mock(side_effect=get_repo_mock)
|
||||
return repos_mock
|
||||
|
||||
def get_namespace_mock(namespace):
|
||||
namespace_mock = Mock()
|
||||
namespace_mock.repositories = Mock(side_effect=get_repositories_mock)
|
||||
return namespace_mock
|
||||
|
||||
def get_repo(namespace, name):
|
||||
return {
|
||||
'owner': namespace,
|
||||
'logo': 'avatarurl',
|
||||
'slug': name,
|
||||
'description': 'some %s repo' % (name),
|
||||
'utc_last_updated': str(datetime.utcfromtimestamp(0)),
|
||||
'read_only': namespace != 'knownuser',
|
||||
'is_private': name == 'somerepo',
|
||||
}
|
||||
|
||||
def get_visible_repos():
|
||||
repos = [
|
||||
get_repo('knownuser', 'somerepo'),
|
||||
get_repo('someorg', 'somerepo'),
|
||||
get_repo('someorg', 'anotherrepo'),
|
||||
]
|
||||
return (True, repos, None)
|
||||
|
||||
def get_authed_mock(token, secret):
|
||||
authed_mock = Mock()
|
||||
authed_mock.for_namespace = Mock(side_effect=get_namespace_mock)
|
||||
authed_mock.get_visible_repositories = Mock(side_effect=get_visible_repos)
|
||||
return authed_mock
|
||||
|
||||
def get_mock_bitbucket():
|
||||
bitbucket_mock = Mock()
|
||||
bitbucket_mock.get_authorized_client = Mock(side_effect=get_authed_mock)
|
||||
return bitbucket_mock
|
178
buildtrigger/test/githubmock.py
Normal file
178
buildtrigger/test/githubmock.py
Normal file
|
@ -0,0 +1,178 @@
|
|||
from datetime import datetime
|
||||
from mock import Mock
|
||||
|
||||
from github import GithubException
|
||||
|
||||
from buildtrigger.githubhandler import GithubBuildTrigger
|
||||
from util.morecollections import AttrDict
|
||||
|
||||
def get_github_trigger(dockerfile_path=''):
|
||||
trigger_obj = AttrDict(dict(auth_token='foobar', id='sometrigger'))
|
||||
trigger = GithubBuildTrigger(trigger_obj, {'build_source': 'foo', 'dockerfile_path': dockerfile_path})
|
||||
trigger._get_client = get_mock_github
|
||||
return trigger
|
||||
|
||||
def get_mock_github():
|
||||
def get_commit_mock(commit_sha):
|
||||
if commit_sha == 'aaaaaaa':
|
||||
commit_mock = Mock()
|
||||
commit_mock.sha = commit_sha
|
||||
commit_mock.html_url = 'http://url/to/commit'
|
||||
commit_mock.last_modified = 'now'
|
||||
|
||||
commit_mock.commit = Mock()
|
||||
commit_mock.commit.message = 'some cool message'
|
||||
|
||||
commit_mock.committer = Mock()
|
||||
commit_mock.committer.login = 'someuser'
|
||||
commit_mock.committer.avatar_url = 'avatarurl'
|
||||
commit_mock.committer.html_url = 'htmlurl'
|
||||
|
||||
commit_mock.author = Mock()
|
||||
commit_mock.author.login = 'someuser'
|
||||
commit_mock.author.avatar_url = 'avatarurl'
|
||||
commit_mock.author.html_url = 'htmlurl'
|
||||
return commit_mock
|
||||
|
||||
raise GithubException(None, None)
|
||||
|
||||
def get_branch_mock(branch_name):
|
||||
if branch_name == 'master':
|
||||
branch_mock = Mock()
|
||||
branch_mock.commit = Mock()
|
||||
branch_mock.commit.sha = 'aaaaaaa'
|
||||
return branch_mock
|
||||
|
||||
raise GithubException(None, None)
|
||||
|
||||
def get_repo_mock(namespace, name):
|
||||
repo_mock = Mock()
|
||||
repo_mock.owner = Mock()
|
||||
repo_mock.owner.login = namespace
|
||||
|
||||
repo_mock.full_name = '%s/%s' % (namespace, name)
|
||||
repo_mock.name = name
|
||||
repo_mock.description = 'some %s repo' % (name)
|
||||
|
||||
if name != 'anotherrepo':
|
||||
repo_mock.pushed_at = datetime.utcfromtimestamp(0)
|
||||
else:
|
||||
repo_mock.pushed_at = None
|
||||
|
||||
repo_mock.html_url = 'https://bitbucket.org/%s/%s' % (namespace, name)
|
||||
repo_mock.private = name == 'somerepo'
|
||||
repo_mock.permissions = Mock()
|
||||
repo_mock.permissions.admin = namespace == 'knownuser'
|
||||
return repo_mock
|
||||
|
||||
def get_user_repos_mock(type='all', sort='created'):
|
||||
return [get_repo_mock('knownuser', 'somerepo')]
|
||||
|
||||
def get_org_repos_mock(type='all'):
|
||||
return [get_repo_mock('someorg', 'somerepo'), get_repo_mock('someorg', 'anotherrepo')]
|
||||
|
||||
def get_orgs_mock():
|
||||
return [get_org_mock('someorg')]
|
||||
|
||||
def get_user_mock(username='knownuser'):
|
||||
if username == 'knownuser':
|
||||
user_mock = Mock()
|
||||
user_mock.name = username
|
||||
user_mock.plan = Mock()
|
||||
user_mock.plan.private_repos = 1
|
||||
user_mock.login = username
|
||||
user_mock.html_url = 'https://bitbucket.org/%s' % (username)
|
||||
user_mock.avatar_url = 'avatarurl'
|
||||
user_mock.get_repos = Mock(side_effect=get_user_repos_mock)
|
||||
user_mock.get_orgs = Mock(side_effect=get_orgs_mock)
|
||||
return user_mock
|
||||
|
||||
raise GithubException(None, None)
|
||||
|
||||
def get_org_mock(namespace):
|
||||
if namespace == 'someorg':
|
||||
org_mock = Mock()
|
||||
org_mock.get_repos = Mock(side_effect=get_org_repos_mock)
|
||||
org_mock.login = namespace
|
||||
org_mock.html_url = 'https://bitbucket.org/%s' % (namespace)
|
||||
org_mock.avatar_url = 'avatarurl'
|
||||
org_mock.name = namespace
|
||||
org_mock.plan = Mock()
|
||||
org_mock.plan.private_repos = 2
|
||||
return org_mock
|
||||
|
||||
raise GithubException(None, None)
|
||||
|
||||
def get_tags_mock():
|
||||
sometag = Mock()
|
||||
sometag.name = 'sometag'
|
||||
sometag.commit = get_commit_mock('aaaaaaa')
|
||||
|
||||
someothertag = Mock()
|
||||
someothertag.name = 'someothertag'
|
||||
someothertag.commit = get_commit_mock('aaaaaaa')
|
||||
return [sometag, someothertag]
|
||||
|
||||
def get_branches_mock():
|
||||
master = Mock()
|
||||
master.name = 'master'
|
||||
master.commit = get_commit_mock('aaaaaaa')
|
||||
|
||||
otherbranch = Mock()
|
||||
otherbranch.name = 'otherbranch'
|
||||
otherbranch.commit = get_commit_mock('aaaaaaa')
|
||||
return [master, otherbranch]
|
||||
|
||||
def get_contents_mock(filepath):
|
||||
if filepath == 'Dockerfile':
|
||||
m = Mock()
|
||||
m.content = 'hello world'
|
||||
return m
|
||||
|
||||
if filepath == 'somesubdir/Dockerfile':
|
||||
m = Mock()
|
||||
m.content = 'hi universe'
|
||||
return m
|
||||
|
||||
raise GithubException(None, None)
|
||||
|
||||
def get_git_tree_mock(commit_sha, recursive=False):
|
||||
first_file = Mock()
|
||||
first_file.type = 'blob'
|
||||
first_file.path = 'Dockerfile'
|
||||
|
||||
second_file = Mock()
|
||||
second_file.type = 'other'
|
||||
second_file.path = '/some/Dockerfile'
|
||||
|
||||
third_file = Mock()
|
||||
third_file.type = 'blob'
|
||||
third_file.path = 'somesubdir/Dockerfile'
|
||||
|
||||
t = Mock()
|
||||
|
||||
if commit_sha == 'aaaaaaa':
|
||||
t.tree = [
|
||||
first_file, second_file, third_file,
|
||||
]
|
||||
else:
|
||||
t.tree = []
|
||||
|
||||
return t
|
||||
|
||||
repo_mock = Mock()
|
||||
repo_mock.default_branch = 'master'
|
||||
repo_mock.ssh_url = 'ssh_url'
|
||||
|
||||
repo_mock.get_branch = Mock(side_effect=get_branch_mock)
|
||||
repo_mock.get_tags = Mock(side_effect=get_tags_mock)
|
||||
repo_mock.get_branches = Mock(side_effect=get_branches_mock)
|
||||
repo_mock.get_commit = Mock(side_effect=get_commit_mock)
|
||||
repo_mock.get_contents = Mock(side_effect=get_contents_mock)
|
||||
repo_mock.get_git_tree = Mock(side_effect=get_git_tree_mock)
|
||||
|
||||
gh_mock = Mock()
|
||||
gh_mock.get_repo = Mock(return_value=repo_mock)
|
||||
gh_mock.get_user = Mock(side_effect=get_user_mock)
|
||||
gh_mock.get_organization = Mock(side_effect=get_org_mock)
|
||||
return gh_mock
|
598
buildtrigger/test/gitlabmock.py
Normal file
598
buildtrigger/test/gitlabmock.py
Normal file
|
@ -0,0 +1,598 @@
|
|||
import base64
|
||||
import json
|
||||
|
||||
from contextlib import contextmanager
|
||||
|
||||
import gitlab
|
||||
|
||||
from httmock import urlmatch, HTTMock
|
||||
|
||||
from buildtrigger.gitlabhandler import GitLabBuildTrigger
|
||||
from util.morecollections import AttrDict
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab')
|
||||
def catchall_handler(url, request):
|
||||
return {'status_code': 404}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/users$')
|
||||
def users_handler(url, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
if url.query.find('knownuser') < 0:
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps([]),
|
||||
}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps([
|
||||
{
|
||||
"id": 1,
|
||||
"username": "knownuser",
|
||||
"name": "Known User",
|
||||
"state": "active",
|
||||
"avatar_url": "avatarurl",
|
||||
"web_url": "https://bitbucket.org/knownuser",
|
||||
},
|
||||
]),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/user$')
|
||||
def user_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"id": 1,
|
||||
"username": "john_smith",
|
||||
"email": "john@example.com",
|
||||
"name": "John Smith",
|
||||
"state": "active",
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/foo%2Fbar$')
|
||||
def project_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"id": 4,
|
||||
"description": None,
|
||||
"default_branch": "master",
|
||||
"visibility": "private",
|
||||
"path_with_namespace": "someorg/somerepo",
|
||||
"ssh_url_to_repo": "git@example.com:someorg/somerepo.git",
|
||||
"web_url": "http://example.com/someorg/somerepo",
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/4/repository/tree$')
|
||||
def project_tree_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps([
|
||||
{
|
||||
"id": "a1e8f8d745cc87e3a9248358d9352bb7f9a0aeba",
|
||||
"name": "Dockerfile",
|
||||
"type": "tree",
|
||||
"path": "files/Dockerfile",
|
||||
"mode": "040000",
|
||||
},
|
||||
]),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/4/repository/tags$')
|
||||
def project_tags_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps([
|
||||
{
|
||||
'name': 'sometag',
|
||||
'commit': {
|
||||
'id': '60a8ff033665e1207714d6670fcd7b65304ec02f',
|
||||
},
|
||||
},
|
||||
{
|
||||
'name': 'someothertag',
|
||||
'commit': {
|
||||
'id': '60a8ff033665e1207714d6670fcd7b65304ec02f',
|
||||
},
|
||||
},
|
||||
]),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/4/repository/branches$')
|
||||
def project_branches_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps([
|
||||
{
|
||||
'name': 'master',
|
||||
'commit': {
|
||||
'id': '60a8ff033665e1207714d6670fcd7b65304ec02f',
|
||||
},
|
||||
},
|
||||
{
|
||||
'name': 'otherbranch',
|
||||
'commit': {
|
||||
'id': '60a8ff033665e1207714d6670fcd7b65304ec02f',
|
||||
},
|
||||
},
|
||||
]),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/4/repository/branches/master$')
|
||||
def project_branch_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"name": "master",
|
||||
"merged": True,
|
||||
"protected": True,
|
||||
"developers_can_push": False,
|
||||
"developers_can_merge": False,
|
||||
"commit": {
|
||||
"author_email": "john@example.com",
|
||||
"author_name": "John Smith",
|
||||
"authored_date": "2012-06-27T05:51:39-07:00",
|
||||
"committed_date": "2012-06-28T03:44:20-07:00",
|
||||
"committer_email": "john@example.com",
|
||||
"committer_name": "John Smith",
|
||||
"id": "60a8ff033665e1207714d6670fcd7b65304ec02f",
|
||||
"short_id": "7b5c3cc",
|
||||
"title": "add projects API",
|
||||
"message": "add projects API",
|
||||
"parent_ids": [
|
||||
"4ad91d3c1144c406e50c7b33bae684bd6837faf8",
|
||||
],
|
||||
},
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/namespaces/someorg$')
|
||||
def namespace_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"id": 2,
|
||||
"name": "someorg",
|
||||
"path": "someorg",
|
||||
"kind": "group",
|
||||
"full_path": "someorg",
|
||||
"parent_id": None,
|
||||
"members_count_with_descendants": 2
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/namespaces/knownuser$')
|
||||
def user_namespace_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"id": 1,
|
||||
"name": "knownuser",
|
||||
"path": "knownuser",
|
||||
"kind": "user",
|
||||
"full_path": "knownuser",
|
||||
"parent_id": None,
|
||||
"members_count_with_descendants": 2
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/namespaces(/)?$')
|
||||
def namespaces_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps([{
|
||||
"id": 2,
|
||||
"name": "someorg",
|
||||
"path": "someorg",
|
||||
"kind": "group",
|
||||
"full_path": "someorg",
|
||||
"parent_id": None,
|
||||
"web_url": "http://gitlab.com/groups/someorg",
|
||||
"members_count_with_descendants": 2
|
||||
}]),
|
||||
}
|
||||
|
||||
|
||||
def get_projects_handler(add_permissions_block):
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/groups/2/projects$')
|
||||
def projects_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
permissions_block = {
|
||||
"project_access": {
|
||||
"access_level": 10,
|
||||
"notification_level": 3
|
||||
},
|
||||
"group_access": {
|
||||
"access_level": 20,
|
||||
"notification_level": 3
|
||||
},
|
||||
}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps([{
|
||||
"id": 4,
|
||||
"name": "Some project",
|
||||
"description": None,
|
||||
"default_branch": "master",
|
||||
"visibility": "private",
|
||||
"path": "someproject",
|
||||
"path_with_namespace": "someorg/someproject",
|
||||
"last_activity_at": "2013-09-30T13:46:02Z",
|
||||
"web_url": "http://example.com/someorg/someproject",
|
||||
"permissions": permissions_block if add_permissions_block else None,
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "Another project",
|
||||
"description": None,
|
||||
"default_branch": "master",
|
||||
"visibility": "public",
|
||||
"path": "anotherproject",
|
||||
"path_with_namespace": "someorg/anotherproject",
|
||||
"last_activity_at": "2013-09-30T13:46:02Z",
|
||||
"web_url": "http://example.com/someorg/anotherproject",
|
||||
}]),
|
||||
}
|
||||
return projects_handler
|
||||
|
||||
|
||||
def get_group_handler(null_avatar):
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/groups/2$')
|
||||
def group_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"id": 1,
|
||||
"name": "SomeOrg Group",
|
||||
"path": "someorg",
|
||||
"description": "An interesting group",
|
||||
"visibility": "public",
|
||||
"lfs_enabled": True,
|
||||
"avatar_url": 'avatar_url' if not null_avatar else None,
|
||||
"web_url": "http://gitlab.com/groups/someorg",
|
||||
"request_access_enabled": False,
|
||||
"full_name": "SomeOrg Group",
|
||||
"full_path": "someorg",
|
||||
"parent_id": None,
|
||||
}),
|
||||
}
|
||||
return group_handler
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/4/repository/files/Dockerfile$')
|
||||
def dockerfile_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"file_name": "Dockerfile",
|
||||
"file_path": "Dockerfile",
|
||||
"size": 10,
|
||||
"encoding": "base64",
|
||||
"content": base64.b64encode('hello world'),
|
||||
"ref": "master",
|
||||
"blob_id": "79f7bbd25901e8334750839545a9bd021f0e4c83",
|
||||
"commit_id": "d5a3ff139356ce33e37e73add446f16869741b50",
|
||||
"last_commit_id": "570e7b2abdd848b95f2f578043fc23bd6f6fd24d"
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/4/repository/files/somesubdir%2FDockerfile$')
|
||||
def sub_dockerfile_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"file_name": "Dockerfile",
|
||||
"file_path": "somesubdir/Dockerfile",
|
||||
"size": 10,
|
||||
"encoding": "base64",
|
||||
"content": base64.b64encode('hi universe'),
|
||||
"ref": "master",
|
||||
"blob_id": "79f7bbd25901e8334750839545a9bd021f0e4c83",
|
||||
"commit_id": "d5a3ff139356ce33e37e73add446f16869741b50",
|
||||
"last_commit_id": "570e7b2abdd848b95f2f578043fc23bd6f6fd24d"
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/4/repository/tags/sometag$')
|
||||
def tag_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"name": "sometag",
|
||||
"message": "some cool message",
|
||||
"target": "60a8ff033665e1207714d6670fcd7b65304ec02f",
|
||||
"commit": {
|
||||
"id": "60a8ff033665e1207714d6670fcd7b65304ec02f",
|
||||
"short_id": "60a8ff03",
|
||||
"title": "Initial commit",
|
||||
"created_at": "2017-07-26T11:08:53.000+02:00",
|
||||
"parent_ids": [
|
||||
"f61c062ff8bcbdb00e0a1b3317a91aed6ceee06b"
|
||||
],
|
||||
"message": "v5.0.0\n",
|
||||
"author_name": "Arthur Verschaeve",
|
||||
"author_email": "contact@arthurverschaeve.be",
|
||||
"authored_date": "2015-02-01T21:56:31.000+01:00",
|
||||
"committer_name": "Arthur Verschaeve",
|
||||
"committer_email": "contact@arthurverschaeve.be",
|
||||
"committed_date": "2015-02-01T21:56:31.000+01:00"
|
||||
},
|
||||
"release": None,
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/foo%2Fbar/repository/commits/60a8ff033665e1207714d6670fcd7b65304ec02f$')
|
||||
def commit_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"id": "60a8ff033665e1207714d6670fcd7b65304ec02f",
|
||||
"short_id": "60a8ff03366",
|
||||
"title": "Sanitize for network graph",
|
||||
"author_name": "someguy",
|
||||
"author_email": "some.guy@gmail.com",
|
||||
"committer_name": "Some Guy",
|
||||
"committer_email": "some.guy@gmail.com",
|
||||
"created_at": "2012-09-20T09:06:12+03:00",
|
||||
"message": "Sanitize for network graph",
|
||||
"committed_date": "2012-09-20T09:06:12+03:00",
|
||||
"authored_date": "2012-09-20T09:06:12+03:00",
|
||||
"parent_ids": [
|
||||
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
|
||||
],
|
||||
"last_pipeline" : {
|
||||
"id": 8,
|
||||
"ref": "master",
|
||||
"sha": "2dc6aa325a317eda67812f05600bdf0fcdc70ab0",
|
||||
"status": "created",
|
||||
},
|
||||
"stats": {
|
||||
"additions": 15,
|
||||
"deletions": 10,
|
||||
"total": 25
|
||||
},
|
||||
"status": "running"
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/4/deploy_keys$', method='POST')
|
||||
def create_deploykey_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"id": 1,
|
||||
"title": "Public key",
|
||||
"key": "ssh-rsa some stuff",
|
||||
"created_at": "2013-10-02T10:12:29Z",
|
||||
"can_push": False,
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/4/hooks$', method='POST')
|
||||
def create_hook_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({
|
||||
"id": 1,
|
||||
"url": "http://example.com/hook",
|
||||
"project_id": 4,
|
||||
"push_events": True,
|
||||
"issues_events": True,
|
||||
"confidential_issues_events": True,
|
||||
"merge_requests_events": True,
|
||||
"tag_push_events": True,
|
||||
"note_events": True,
|
||||
"job_events": True,
|
||||
"pipeline_events": True,
|
||||
"wiki_page_events": True,
|
||||
"enable_ssl_verification": True,
|
||||
"created_at": "2012-10-12T17:04:47Z",
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/4/hooks/1$', method='DELETE')
|
||||
def delete_hook_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/projects/4/deploy_keys/1$', method='DELETE')
|
||||
def delete_deploykey_handker(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps({}),
|
||||
}
|
||||
|
||||
|
||||
@urlmatch(netloc=r'fakegitlab', path=r'/api/v4/users/1/projects$')
|
||||
def user_projects_list_handler(_, request):
|
||||
if not request.headers.get('Authorization') == 'Bearer foobar':
|
||||
return {'status_code': 401}
|
||||
|
||||
return {
|
||||
'status_code': 200,
|
||||
'headers': {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
'content': json.dumps([
|
||||
{
|
||||
"id": 2,
|
||||
"name": "Another project",
|
||||
"description": None,
|
||||
"default_branch": "master",
|
||||
"visibility": "public",
|
||||
"path": "anotherproject",
|
||||
"path_with_namespace": "knownuser/anotherproject",
|
||||
"last_activity_at": "2013-09-30T13:46:02Z",
|
||||
"web_url": "http://example.com/knownuser/anotherproject",
|
||||
}
|
||||
]),
|
||||
}
|
||||
|
||||
|
||||
@contextmanager
|
||||
def get_gitlab_trigger(dockerfile_path='', add_permissions=True, missing_avatar_url=False):
|
||||
handlers = [user_handler, users_handler, project_branches_handler, project_tree_handler,
|
||||
project_handler, get_projects_handler(add_permissions), tag_handler,
|
||||
project_branch_handler, get_group_handler(missing_avatar_url), dockerfile_handler,
|
||||
sub_dockerfile_handler, namespace_handler, user_namespace_handler, namespaces_handler,
|
||||
commit_handler, create_deploykey_handler, delete_deploykey_handker,
|
||||
create_hook_handler, delete_hook_handler, project_tags_handler,
|
||||
user_projects_list_handler, catchall_handler]
|
||||
|
||||
with HTTMock(*handlers):
|
||||
trigger_obj = AttrDict(dict(auth_token='foobar', id='sometrigger'))
|
||||
trigger = GitLabBuildTrigger(trigger_obj, {
|
||||
'build_source': 'foo/bar',
|
||||
'dockerfile_path': dockerfile_path,
|
||||
'username': 'knownuser'
|
||||
})
|
||||
|
||||
client = gitlab.Gitlab('http://fakegitlab', oauth_token='foobar', timeout=20, api_version=4)
|
||||
client.auth()
|
||||
|
||||
trigger._get_authorized_client = lambda: client
|
||||
yield trigger
|
55
buildtrigger/test/test_basehandler.py
Normal file
55
buildtrigger/test/test_basehandler.py
Normal file
|
@ -0,0 +1,55 @@
|
|||
import pytest
|
||||
|
||||
from buildtrigger.basehandler import BuildTriggerHandler
|
||||
|
||||
|
||||
@pytest.mark.parametrize('input,output', [
|
||||
("Dockerfile", True),
|
||||
("server.Dockerfile", True),
|
||||
(u"Dockerfile", True),
|
||||
(u"server.Dockerfile", True),
|
||||
("bad file name", False),
|
||||
(u"bad file name", False),
|
||||
])
|
||||
def test_path_is_dockerfile(input, output):
|
||||
assert BuildTriggerHandler.filename_is_dockerfile(input) == output
|
||||
|
||||
|
||||
@pytest.mark.parametrize('input,output', [
|
||||
("", {}),
|
||||
("/a", {"/a": ["/"]}),
|
||||
("a", {"/a": ["/"]}),
|
||||
("/b/a", {"/b/a": ["/b", "/"]}),
|
||||
("b/a", {"/b/a": ["/b", "/"]}),
|
||||
("/c/b/a", {"/c/b/a": ["/c/b", "/c", "/"]}),
|
||||
("/a//b//c", {"/a/b/c": ["/", "/a", "/a/b"]}),
|
||||
("/a", {"/a": ["/"]}),
|
||||
])
|
||||
def test_subdir_path_map_no_previous(input, output):
|
||||
actual_mapping = BuildTriggerHandler.get_parent_directory_mappings(input)
|
||||
for key in actual_mapping:
|
||||
value = actual_mapping[key]
|
||||
actual_mapping[key] = value.sort()
|
||||
for key in output:
|
||||
value = output[key]
|
||||
output[key] = value.sort()
|
||||
|
||||
assert actual_mapping == output
|
||||
|
||||
|
||||
@pytest.mark.parametrize('new_path,original_dictionary,output', [
|
||||
("/a", {}, {"/a": ["/"]}),
|
||||
("b", {"/a": ["some_path", "another_path"]}, {"/a": ["some_path", "another_path"], "/b": ["/"]}),
|
||||
("/a/b/c/d", {"/e": ["some_path", "another_path"]},
|
||||
{"/e": ["some_path", "another_path"], "/a/b/c/d": ["/", "/a", "/a/b", "/a/b/c"]}),
|
||||
])
|
||||
def test_subdir_path_map(new_path, original_dictionary, output):
|
||||
actual_mapping = BuildTriggerHandler.get_parent_directory_mappings(new_path, original_dictionary)
|
||||
for key in actual_mapping:
|
||||
value = actual_mapping[key]
|
||||
actual_mapping[key] = value.sort()
|
||||
for key in output:
|
||||
value = output[key]
|
||||
output[key] = value.sort()
|
||||
|
||||
assert actual_mapping == output
|
91
buildtrigger/test/test_bitbuckethandler.py
Normal file
91
buildtrigger/test/test_bitbuckethandler.py
Normal file
|
@ -0,0 +1,91 @@
|
|||
import json
|
||||
import pytest
|
||||
|
||||
from buildtrigger.test.bitbucketmock import get_bitbucket_trigger
|
||||
from buildtrigger.triggerutil import (SkipRequestException, ValidationRequestException,
|
||||
InvalidPayloadException)
|
||||
from endpoints.building import PreparedBuild
|
||||
from util.morecollections import AttrDict
|
||||
|
||||
@pytest.fixture
|
||||
def bitbucket_trigger():
|
||||
return get_bitbucket_trigger()
|
||||
|
||||
|
||||
def test_list_build_subdirs(bitbucket_trigger):
|
||||
assert bitbucket_trigger.list_build_subdirs() == ["/Dockerfile"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('dockerfile_path, contents', [
|
||||
('/Dockerfile', 'hello world'),
|
||||
('somesubdir/Dockerfile', 'hi universe'),
|
||||
('unknownpath', None),
|
||||
])
|
||||
def test_load_dockerfile_contents(dockerfile_path, contents):
|
||||
trigger = get_bitbucket_trigger(dockerfile_path)
|
||||
assert trigger.load_dockerfile_contents() == contents
|
||||
|
||||
|
||||
@pytest.mark.parametrize('payload, expected_error, expected_message', [
|
||||
('{}', InvalidPayloadException, "'push' is a required property"),
|
||||
|
||||
# Valid payload:
|
||||
('''{
|
||||
"push": {
|
||||
"changes": [{
|
||||
"new": {
|
||||
"name": "somechange",
|
||||
"target": {
|
||||
"hash": "aaaaaaa",
|
||||
"message": "foo",
|
||||
"date": "now",
|
||||
"links": {
|
||||
"html": {
|
||||
"href": "somelink"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
},
|
||||
"repository": {
|
||||
"full_name": "foo/bar"
|
||||
}
|
||||
}''', None, None),
|
||||
|
||||
# Skip message:
|
||||
('''{
|
||||
"push": {
|
||||
"changes": [{
|
||||
"new": {
|
||||
"name": "somechange",
|
||||
"target": {
|
||||
"hash": "aaaaaaa",
|
||||
"message": "[skip build] foo",
|
||||
"date": "now",
|
||||
"links": {
|
||||
"html": {
|
||||
"href": "somelink"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]
|
||||
},
|
||||
"repository": {
|
||||
"full_name": "foo/bar"
|
||||
}
|
||||
}''', SkipRequestException, ''),
|
||||
])
|
||||
def test_handle_trigger_request(bitbucket_trigger, payload, expected_error, expected_message):
|
||||
def get_payload():
|
||||
return json.loads(payload)
|
||||
|
||||
request = AttrDict(dict(get_json=get_payload))
|
||||
|
||||
if expected_error is not None:
|
||||
with pytest.raises(expected_error) as ipe:
|
||||
bitbucket_trigger.handle_trigger_request(request)
|
||||
assert str(ipe.value) == expected_message
|
||||
else:
|
||||
assert isinstance(bitbucket_trigger.handle_trigger_request(request), PreparedBuild)
|
51
buildtrigger/test/test_customhandler.py
Normal file
51
buildtrigger/test/test_customhandler.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
import pytest
|
||||
|
||||
from buildtrigger.customhandler import CustomBuildTrigger
|
||||
from buildtrigger.triggerutil import (InvalidPayloadException, SkipRequestException,
|
||||
TriggerStartException)
|
||||
from endpoints.building import PreparedBuild
|
||||
from util.morecollections import AttrDict
|
||||
|
||||
@pytest.mark.parametrize('payload, expected_error, expected_message', [
|
||||
('', InvalidPayloadException, 'Missing expected payload'),
|
||||
('{}', InvalidPayloadException, "'commit' is a required property"),
|
||||
|
||||
('{"commit": "foo", "ref": "refs/heads/something", "default_branch": "baz"}',
|
||||
InvalidPayloadException, "u'foo' does not match '^([A-Fa-f0-9]{7,})$'"),
|
||||
|
||||
('{"commit": "11d6fbc", "ref": "refs/heads/something", "default_branch": "baz"}', None, None),
|
||||
('''{
|
||||
"commit": "11d6fbc",
|
||||
"ref": "refs/heads/something",
|
||||
"default_branch": "baz",
|
||||
"commit_info": {
|
||||
"message": "[skip build]",
|
||||
"url": "http://foo.bar",
|
||||
"date": "NOW"
|
||||
}
|
||||
}''', SkipRequestException, ''),
|
||||
])
|
||||
def test_handle_trigger_request(payload, expected_error, expected_message):
|
||||
trigger = CustomBuildTrigger(None, {'build_source': 'foo'})
|
||||
request = AttrDict(dict(data=payload))
|
||||
|
||||
if expected_error is not None:
|
||||
with pytest.raises(expected_error) as ipe:
|
||||
trigger.handle_trigger_request(request)
|
||||
assert str(ipe.value) == expected_message
|
||||
else:
|
||||
assert isinstance(trigger.handle_trigger_request(request), PreparedBuild)
|
||||
|
||||
@pytest.mark.parametrize('run_parameters, expected_error, expected_message', [
|
||||
({}, TriggerStartException, 'missing required parameter'),
|
||||
({'commit_sha': 'foo'}, TriggerStartException, "'foo' does not match '^([A-Fa-f0-9]{7,})$'"),
|
||||
({'commit_sha': '11d6fbc'}, None, None),
|
||||
])
|
||||
def test_manual_start(run_parameters, expected_error, expected_message):
|
||||
trigger = CustomBuildTrigger(None, {'build_source': 'foo'})
|
||||
if expected_error is not None:
|
||||
with pytest.raises(expected_error) as ipe:
|
||||
trigger.manual_start(run_parameters)
|
||||
assert str(ipe.value) == expected_message
|
||||
else:
|
||||
assert isinstance(trigger.manual_start(run_parameters), PreparedBuild)
|
121
buildtrigger/test/test_githosthandler.py
Normal file
121
buildtrigger/test/test_githosthandler.py
Normal file
|
@ -0,0 +1,121 @@
|
|||
import pytest
|
||||
|
||||
from buildtrigger.triggerutil import TriggerStartException
|
||||
from buildtrigger.test.bitbucketmock import get_bitbucket_trigger
|
||||
from buildtrigger.test.githubmock import get_github_trigger
|
||||
from endpoints.building import PreparedBuild
|
||||
|
||||
# Note: This test suite executes a common set of tests against all the trigger types specified
|
||||
# in this fixture. Each trigger's mock is expected to return the same data for all of these calls.
|
||||
@pytest.fixture(params=[get_github_trigger(), get_bitbucket_trigger()])
|
||||
def githost_trigger(request):
|
||||
return request.param
|
||||
|
||||
@pytest.mark.parametrize('run_parameters, expected_error, expected_message', [
|
||||
# No branch or tag specified: use the commit of the default branch.
|
||||
({}, None, None),
|
||||
|
||||
# Invalid branch.
|
||||
({'refs': {'kind': 'branch', 'name': 'invalid'}}, TriggerStartException,
|
||||
'Could not find branch in repository'),
|
||||
|
||||
# Invalid tag.
|
||||
({'refs': {'kind': 'tag', 'name': 'invalid'}}, TriggerStartException,
|
||||
'Could not find tag in repository'),
|
||||
|
||||
# Valid branch.
|
||||
({'refs': {'kind': 'branch', 'name': 'master'}}, None, None),
|
||||
|
||||
# Valid tag.
|
||||
({'refs': {'kind': 'tag', 'name': 'sometag'}}, None, None),
|
||||
])
|
||||
def test_manual_start(run_parameters, expected_error, expected_message, githost_trigger):
|
||||
if expected_error is not None:
|
||||
with pytest.raises(expected_error) as ipe:
|
||||
githost_trigger.manual_start(run_parameters)
|
||||
assert str(ipe.value) == expected_message
|
||||
else:
|
||||
assert isinstance(githost_trigger.manual_start(run_parameters), PreparedBuild)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('name, expected', [
|
||||
('refs', [
|
||||
{'kind': 'branch', 'name': 'master'},
|
||||
{'kind': 'branch', 'name': 'otherbranch'},
|
||||
{'kind': 'tag', 'name': 'sometag'},
|
||||
{'kind': 'tag', 'name': 'someothertag'},
|
||||
]),
|
||||
('tag_name', set(['sometag', 'someothertag'])),
|
||||
('branch_name', set(['master', 'otherbranch'])),
|
||||
('invalid', None)
|
||||
])
|
||||
def test_list_field_values(name, expected, githost_trigger):
|
||||
if expected is None:
|
||||
assert githost_trigger.list_field_values(name) is None
|
||||
elif isinstance(expected, set):
|
||||
assert set(githost_trigger.list_field_values(name)) == set(expected)
|
||||
else:
|
||||
assert githost_trigger.list_field_values(name) == expected
|
||||
|
||||
|
||||
def test_list_build_source_namespaces():
|
||||
namespaces_expected = [
|
||||
{
|
||||
'personal': True,
|
||||
'score': 1,
|
||||
'avatar_url': 'avatarurl',
|
||||
'id': 'knownuser',
|
||||
'title': 'knownuser',
|
||||
'url': 'https://bitbucket.org/knownuser',
|
||||
},
|
||||
{
|
||||
'score': 2,
|
||||
'title': 'someorg',
|
||||
'personal': False,
|
||||
'url': 'https://bitbucket.org/someorg',
|
||||
'avatar_url': 'avatarurl',
|
||||
'id': 'someorg'
|
||||
}
|
||||
]
|
||||
|
||||
found = get_bitbucket_trigger().list_build_source_namespaces()
|
||||
found.sort()
|
||||
|
||||
namespaces_expected.sort()
|
||||
assert found == namespaces_expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize('namespace, expected', [
|
||||
('', []),
|
||||
('unknown', []),
|
||||
|
||||
('knownuser', [
|
||||
{
|
||||
'last_updated': 0, 'name': 'somerepo',
|
||||
'url': 'https://bitbucket.org/knownuser/somerepo', 'private': True,
|
||||
'full_name': 'knownuser/somerepo', 'has_admin_permissions': True,
|
||||
'description': 'some somerepo repo'
|
||||
}]),
|
||||
|
||||
('someorg', [
|
||||
{
|
||||
'last_updated': 0, 'name': 'somerepo',
|
||||
'url': 'https://bitbucket.org/someorg/somerepo', 'private': True,
|
||||
'full_name': 'someorg/somerepo', 'has_admin_permissions': False,
|
||||
'description': 'some somerepo repo'
|
||||
},
|
||||
{
|
||||
'last_updated': 0, 'name': 'anotherrepo',
|
||||
'url': 'https://bitbucket.org/someorg/anotherrepo', 'private': False,
|
||||
'full_name': 'someorg/anotherrepo', 'has_admin_permissions': False,
|
||||
'description': 'some anotherrepo repo'
|
||||
}]),
|
||||
])
|
||||
def test_list_build_sources_for_namespace(namespace, expected, githost_trigger):
|
||||
assert githost_trigger.list_build_sources_for_namespace(namespace) == expected
|
||||
|
||||
|
||||
def test_activate_and_deactivate(githost_trigger):
|
||||
_, private_key = githost_trigger.activate('http://some/url')
|
||||
assert 'private_key' in private_key
|
||||
githost_trigger.deactivate()
|
117
buildtrigger/test/test_githubhandler.py
Normal file
117
buildtrigger/test/test_githubhandler.py
Normal file
|
@ -0,0 +1,117 @@
|
|||
import json
|
||||
import pytest
|
||||
|
||||
from buildtrigger.test.githubmock import get_github_trigger
|
||||
from buildtrigger.triggerutil import (SkipRequestException, ValidationRequestException,
|
||||
InvalidPayloadException)
|
||||
from endpoints.building import PreparedBuild
|
||||
from util.morecollections import AttrDict
|
||||
|
||||
@pytest.fixture
|
||||
def github_trigger():
|
||||
return get_github_trigger()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('payload, expected_error, expected_message', [
|
||||
('{"zen": true}', SkipRequestException, ""),
|
||||
|
||||
('{}', InvalidPayloadException, "Missing 'repository' on request"),
|
||||
('{"repository": "foo"}', InvalidPayloadException, "Missing 'owner' on repository"),
|
||||
|
||||
# Valid payload:
|
||||
('''{
|
||||
"repository": {
|
||||
"owner": {
|
||||
"name": "someguy"
|
||||
},
|
||||
"name": "somerepo",
|
||||
"ssh_url": "someurl"
|
||||
},
|
||||
"ref": "refs/tags/foo",
|
||||
"head_commit": {
|
||||
"id": "11d6fbc",
|
||||
"url": "http://some/url",
|
||||
"message": "some message",
|
||||
"timestamp": "NOW"
|
||||
}
|
||||
}''', None, None),
|
||||
|
||||
# Skip message:
|
||||
('''{
|
||||
"repository": {
|
||||
"owner": {
|
||||
"name": "someguy"
|
||||
},
|
||||
"name": "somerepo",
|
||||
"ssh_url": "someurl"
|
||||
},
|
||||
"ref": "refs/tags/foo",
|
||||
"head_commit": {
|
||||
"id": "11d6fbc",
|
||||
"url": "http://some/url",
|
||||
"message": "[skip build]",
|
||||
"timestamp": "NOW"
|
||||
}
|
||||
}''', SkipRequestException, ''),
|
||||
])
|
||||
def test_handle_trigger_request(github_trigger, payload, expected_error, expected_message):
|
||||
def get_payload():
|
||||
return json.loads(payload)
|
||||
|
||||
request = AttrDict(dict(get_json=get_payload))
|
||||
|
||||
if expected_error is not None:
|
||||
with pytest.raises(expected_error) as ipe:
|
||||
github_trigger.handle_trigger_request(request)
|
||||
assert str(ipe.value) == expected_message
|
||||
else:
|
||||
assert isinstance(github_trigger.handle_trigger_request(request), PreparedBuild)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('dockerfile_path, contents', [
|
||||
('/Dockerfile', 'hello world'),
|
||||
('somesubdir/Dockerfile', 'hi universe'),
|
||||
('unknownpath', None),
|
||||
])
|
||||
def test_load_dockerfile_contents(dockerfile_path, contents):
|
||||
trigger = get_github_trigger(dockerfile_path)
|
||||
assert trigger.load_dockerfile_contents() == contents
|
||||
|
||||
|
||||
@pytest.mark.parametrize('username, expected_response', [
|
||||
('unknownuser', None),
|
||||
('knownuser', {'html_url': 'https://bitbucket.org/knownuser', 'avatar_url': 'avatarurl'}),
|
||||
])
|
||||
def test_lookup_user(username, expected_response, github_trigger):
|
||||
assert github_trigger.lookup_user(username) == expected_response
|
||||
|
||||
|
||||
def test_list_build_subdirs(github_trigger):
|
||||
assert github_trigger.list_build_subdirs() == ['Dockerfile', 'somesubdir/Dockerfile']
|
||||
|
||||
|
||||
def test_list_build_source_namespaces(github_trigger):
|
||||
namespaces_expected = [
|
||||
{
|
||||
'personal': True,
|
||||
'score': 1,
|
||||
'avatar_url': 'avatarurl',
|
||||
'id': 'knownuser',
|
||||
'title': 'knownuser',
|
||||
'url': 'https://bitbucket.org/knownuser',
|
||||
},
|
||||
{
|
||||
'score': 0,
|
||||
'title': 'someorg',
|
||||
'personal': False,
|
||||
'url': '',
|
||||
'avatar_url': 'avatarurl',
|
||||
'id': 'someorg'
|
||||
}
|
||||
]
|
||||
|
||||
found = github_trigger.list_build_source_namespaces()
|
||||
found.sort()
|
||||
|
||||
namespaces_expected.sort()
|
||||
assert found == namespaces_expected
|
231
buildtrigger/test/test_gitlabhandler.py
Normal file
231
buildtrigger/test/test_gitlabhandler.py
Normal file
|
@ -0,0 +1,231 @@
|
|||
import json
|
||||
import pytest
|
||||
|
||||
from mock import Mock
|
||||
|
||||
from buildtrigger.test.gitlabmock import get_gitlab_trigger
|
||||
from buildtrigger.triggerutil import (SkipRequestException, ValidationRequestException,
|
||||
InvalidPayloadException, TriggerStartException)
|
||||
from endpoints.building import PreparedBuild
|
||||
from util.morecollections import AttrDict
|
||||
|
||||
@pytest.fixture()
|
||||
def gitlab_trigger():
|
||||
with get_gitlab_trigger() as t:
|
||||
yield t
|
||||
|
||||
|
||||
def test_list_build_subdirs(gitlab_trigger):
|
||||
assert gitlab_trigger.list_build_subdirs() == ['Dockerfile']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('dockerfile_path, contents', [
|
||||
('/Dockerfile', 'hello world'),
|
||||
('somesubdir/Dockerfile', 'hi universe'),
|
||||
('unknownpath', None),
|
||||
])
|
||||
def test_load_dockerfile_contents(dockerfile_path, contents):
|
||||
with get_gitlab_trigger(dockerfile_path=dockerfile_path) as trigger:
|
||||
assert trigger.load_dockerfile_contents() == contents
|
||||
|
||||
|
||||
@pytest.mark.parametrize('email, expected_response', [
|
||||
('unknown@email.com', None),
|
||||
('knownuser', {'username': 'knownuser', 'html_url': 'https://bitbucket.org/knownuser',
|
||||
'avatar_url': 'avatarurl'}),
|
||||
])
|
||||
def test_lookup_user(email, expected_response, gitlab_trigger):
|
||||
assert gitlab_trigger.lookup_user(email) == expected_response
|
||||
|
||||
|
||||
def test_null_permissions():
|
||||
with get_gitlab_trigger(add_permissions=False) as trigger:
|
||||
sources = trigger.list_build_sources_for_namespace('someorg')
|
||||
source = sources[0]
|
||||
assert source['has_admin_permissions']
|
||||
|
||||
|
||||
def test_list_build_sources():
|
||||
with get_gitlab_trigger() as trigger:
|
||||
sources = trigger.list_build_sources_for_namespace('someorg')
|
||||
assert sources == [
|
||||
{
|
||||
'last_updated': 1380548762,
|
||||
'name': u'someproject',
|
||||
'url': u'http://example.com/someorg/someproject',
|
||||
'private': True,
|
||||
'full_name': u'someorg/someproject',
|
||||
'has_admin_permissions': False,
|
||||
'description': ''
|
||||
},
|
||||
{
|
||||
'last_updated': 1380548762,
|
||||
'name': u'anotherproject',
|
||||
'url': u'http://example.com/someorg/anotherproject',
|
||||
'private': False,
|
||||
'full_name': u'someorg/anotherproject',
|
||||
'has_admin_permissions': True,
|
||||
'description': '',
|
||||
}]
|
||||
|
||||
|
||||
def test_null_avatar():
|
||||
with get_gitlab_trigger(missing_avatar_url=True) as trigger:
|
||||
namespace_data = trigger.list_build_source_namespaces()
|
||||
expected = {
|
||||
'avatar_url': None,
|
||||
'personal': False,
|
||||
'title': u'someorg',
|
||||
'url': u'http://gitlab.com/groups/someorg',
|
||||
'score': 1,
|
||||
'id': '2',
|
||||
}
|
||||
|
||||
assert namespace_data == [expected]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('payload, expected_error, expected_message', [
|
||||
('{}', InvalidPayloadException, ''),
|
||||
|
||||
# Valid payload:
|
||||
('''{
|
||||
"object_kind": "push",
|
||||
"ref": "refs/heads/master",
|
||||
"checkout_sha": "aaaaaaa",
|
||||
"repository": {
|
||||
"git_ssh_url": "foobar"
|
||||
},
|
||||
"commits": [
|
||||
{
|
||||
"id": "aaaaaaa",
|
||||
"url": "someurl",
|
||||
"message": "hello there!",
|
||||
"timestamp": "now"
|
||||
}
|
||||
]
|
||||
}''', None, None),
|
||||
|
||||
# Skip message:
|
||||
('''{
|
||||
"object_kind": "push",
|
||||
"ref": "refs/heads/master",
|
||||
"checkout_sha": "aaaaaaa",
|
||||
"repository": {
|
||||
"git_ssh_url": "foobar"
|
||||
},
|
||||
"commits": [
|
||||
{
|
||||
"id": "aaaaaaa",
|
||||
"url": "someurl",
|
||||
"message": "[skip build] hello there!",
|
||||
"timestamp": "now"
|
||||
}
|
||||
]
|
||||
}''', SkipRequestException, ''),
|
||||
])
|
||||
def test_handle_trigger_request(gitlab_trigger, payload, expected_error, expected_message):
|
||||
def get_payload():
|
||||
return json.loads(payload)
|
||||
|
||||
request = AttrDict(dict(get_json=get_payload))
|
||||
|
||||
if expected_error is not None:
|
||||
with pytest.raises(expected_error) as ipe:
|
||||
gitlab_trigger.handle_trigger_request(request)
|
||||
assert str(ipe.value) == expected_message
|
||||
else:
|
||||
assert isinstance(gitlab_trigger.handle_trigger_request(request), PreparedBuild)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('run_parameters, expected_error, expected_message', [
|
||||
# No branch or tag specified: use the commit of the default branch.
|
||||
({}, None, None),
|
||||
|
||||
# Invalid branch.
|
||||
({'refs': {'kind': 'branch', 'name': 'invalid'}}, TriggerStartException,
|
||||
'Could not find branch in repository'),
|
||||
|
||||
# Invalid tag.
|
||||
({'refs': {'kind': 'tag', 'name': 'invalid'}}, TriggerStartException,
|
||||
'Could not find tag in repository'),
|
||||
|
||||
# Valid branch.
|
||||
({'refs': {'kind': 'branch', 'name': 'master'}}, None, None),
|
||||
|
||||
# Valid tag.
|
||||
({'refs': {'kind': 'tag', 'name': 'sometag'}}, None, None),
|
||||
])
|
||||
def test_manual_start(run_parameters, expected_error, expected_message, gitlab_trigger):
|
||||
if expected_error is not None:
|
||||
with pytest.raises(expected_error) as ipe:
|
||||
gitlab_trigger.manual_start(run_parameters)
|
||||
assert str(ipe.value) == expected_message
|
||||
else:
|
||||
assert isinstance(gitlab_trigger.manual_start(run_parameters), PreparedBuild)
|
||||
|
||||
|
||||
def test_activate_and_deactivate(gitlab_trigger):
|
||||
_, private_key = gitlab_trigger.activate('http://some/url')
|
||||
assert 'private_key' in private_key
|
||||
|
||||
gitlab_trigger.deactivate()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('name, expected', [
|
||||
('refs', [
|
||||
{'kind': 'branch', 'name': 'master'},
|
||||
{'kind': 'branch', 'name': 'otherbranch'},
|
||||
{'kind': 'tag', 'name': 'sometag'},
|
||||
{'kind': 'tag', 'name': 'someothertag'},
|
||||
]),
|
||||
('tag_name', set(['sometag', 'someothertag'])),
|
||||
('branch_name', set(['master', 'otherbranch'])),
|
||||
('invalid', None)
|
||||
])
|
||||
def test_list_field_values(name, expected, gitlab_trigger):
|
||||
if expected is None:
|
||||
assert gitlab_trigger.list_field_values(name) is None
|
||||
elif isinstance(expected, set):
|
||||
assert set(gitlab_trigger.list_field_values(name)) == set(expected)
|
||||
else:
|
||||
assert gitlab_trigger.list_field_values(name) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize('namespace, expected', [
|
||||
('', []),
|
||||
('unknown', []),
|
||||
|
||||
('knownuser', [
|
||||
{
|
||||
'last_updated': 1380548762,
|
||||
'name': u'anotherproject',
|
||||
'url': u'http://example.com/knownuser/anotherproject',
|
||||
'private': False,
|
||||
'full_name': u'knownuser/anotherproject',
|
||||
'has_admin_permissions': True,
|
||||
'description': ''
|
||||
},
|
||||
]),
|
||||
|
||||
('someorg', [
|
||||
{
|
||||
'last_updated': 1380548762,
|
||||
'name': u'someproject',
|
||||
'url': u'http://example.com/someorg/someproject',
|
||||
'private': True,
|
||||
'full_name': u'someorg/someproject',
|
||||
'has_admin_permissions': False,
|
||||
'description': ''
|
||||
},
|
||||
{
|
||||
'last_updated': 1380548762,
|
||||
'name': u'anotherproject',
|
||||
'url': u'http://example.com/someorg/anotherproject',
|
||||
'private': False,
|
||||
'full_name': u'someorg/anotherproject',
|
||||
'has_admin_permissions': True,
|
||||
'description': '',
|
||||
}]),
|
||||
])
|
||||
def test_list_build_sources_for_namespace(namespace, expected, gitlab_trigger):
|
||||
assert gitlab_trigger.list_build_sources_for_namespace(namespace) == expected
|
572
buildtrigger/test/test_prepare_trigger.py
Normal file
572
buildtrigger/test/test_prepare_trigger.py
Normal file
|
@ -0,0 +1,572 @@
|
|||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from jsonschema import validate
|
||||
|
||||
from buildtrigger.customhandler import custom_trigger_payload
|
||||
from buildtrigger.basehandler import METADATA_SCHEMA
|
||||
from buildtrigger.bitbuckethandler import get_transformed_webhook_payload as bb_webhook
|
||||
from buildtrigger.bitbuckethandler import get_transformed_commit_info as bb_commit
|
||||
from buildtrigger.githubhandler import get_transformed_webhook_payload as gh_webhook
|
||||
from buildtrigger.gitlabhandler import get_transformed_webhook_payload as gl_webhook
|
||||
from buildtrigger.triggerutil import SkipRequestException
|
||||
|
||||
def assertSkipped(filename, processor, *args, **kwargs):
|
||||
with open('buildtrigger/test/triggerjson/%s.json' % filename) as f:
|
||||
payload = json.loads(f.read())
|
||||
|
||||
nargs = [payload]
|
||||
nargs.extend(args)
|
||||
|
||||
with pytest.raises(SkipRequestException):
|
||||
processor(*nargs, **kwargs)
|
||||
|
||||
|
||||
def assertSchema(filename, expected, processor, *args, **kwargs):
|
||||
with open('buildtrigger/test/triggerjson/%s.json' % filename) as f:
|
||||
payload = json.loads(f.read())
|
||||
|
||||
nargs = [payload]
|
||||
nargs.extend(args)
|
||||
|
||||
created = processor(*nargs, **kwargs)
|
||||
assert created == expected
|
||||
validate(created, METADATA_SCHEMA)
|
||||
|
||||
|
||||
def test_custom_custom():
|
||||
expected = {
|
||||
u'commit':u'1c002dd',
|
||||
u'commit_info': {
|
||||
u'url': u'gitsoftware.com/repository/commits/1234567',
|
||||
u'date': u'timestamp',
|
||||
u'message': u'initial commit',
|
||||
u'committer': {
|
||||
u'username': u'user',
|
||||
u'url': u'gitsoftware.com/users/user',
|
||||
u'avatar_url': u'gravatar.com/user.png'
|
||||
},
|
||||
u'author': {
|
||||
u'username': u'user',
|
||||
u'url': u'gitsoftware.com/users/user',
|
||||
u'avatar_url': u'gravatar.com/user.png'
|
||||
}
|
||||
},
|
||||
u'ref': u'refs/heads/master',
|
||||
u'default_branch': u'master',
|
||||
u'git_url': u'foobar',
|
||||
}
|
||||
|
||||
assertSchema('custom_webhook', expected, custom_trigger_payload, git_url='foobar')
|
||||
|
||||
|
||||
def test_custom_gitlab():
|
||||
expected = {
|
||||
'commit': u'fb88379ee45de28a0a4590fddcbd8eff8b36026e',
|
||||
'ref': u'refs/heads/master',
|
||||
'git_url': u'git@gitlab.com:jsmith/somerepo.git',
|
||||
'commit_info': {
|
||||
'url': u'https://gitlab.com/jsmith/somerepo/commit/fb88379ee45de28a0a4590fddcbd8eff8b36026e',
|
||||
'date': u'2015-08-13T19:33:18+00:00',
|
||||
'message': u'Fix link\n',
|
||||
},
|
||||
}
|
||||
|
||||
assertSchema('gitlab_webhook', expected, custom_trigger_payload, git_url='git@gitlab.com:jsmith/somerepo.git')
|
||||
|
||||
|
||||
def test_custom_github():
|
||||
expected = {
|
||||
'commit': u'410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'ref': u'refs/heads/master',
|
||||
'default_branch': u'master',
|
||||
'git_url': u'git@github.com:jsmith/anothertest.git',
|
||||
'commit_info': {
|
||||
'url': u'https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'date': u'2015-09-11T14:26:16-04:00',
|
||||
'message': u'Update Dockerfile',
|
||||
'committer': {
|
||||
'username': u'jsmith',
|
||||
},
|
||||
'author': {
|
||||
'username': u'jsmith',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assertSchema('github_webhook', expected, custom_trigger_payload,
|
||||
git_url='git@github.com:jsmith/anothertest.git')
|
||||
|
||||
|
||||
def test_custom_bitbucket():
|
||||
expected = {
|
||||
"commit": u"af64ae7188685f8424040b4735ad12941b980d75",
|
||||
"ref": u"refs/heads/master",
|
||||
"git_url": u"git@bitbucket.org:jsmith/another-repo.git",
|
||||
"commit_info": {
|
||||
"url": u"https://bitbucket.org/jsmith/another-repo/commits/af64ae7188685f8424040b4735ad12941b980d75",
|
||||
"date": u"2015-09-10T20:40:54+00:00",
|
||||
"message": u"Dockerfile edited online with Bitbucket",
|
||||
"author": {
|
||||
"username": u"John Smith",
|
||||
"avatar_url": u"https://bitbucket.org/account/jsmith/avatar/32/",
|
||||
},
|
||||
"committer": {
|
||||
"username": u"John Smith",
|
||||
"avatar_url": u"https://bitbucket.org/account/jsmith/avatar/32/",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assertSchema('bitbucket_webhook', expected, custom_trigger_payload, git_url='git@bitbucket.org:jsmith/another-repo.git')
|
||||
|
||||
|
||||
def test_bitbucket_customer_payload_noauthor():
|
||||
expected = {
|
||||
"commit": "a0ec139843b2bb281ab21a433266ddc498e605dc",
|
||||
"ref": "refs/heads/master",
|
||||
"git_url": "git@bitbucket.org:somecoollabs/svc-identity.git",
|
||||
"commit_info": {
|
||||
"url": "https://bitbucket.org/somecoollabs/svc-identity/commits/a0ec139843b2bb281ab21a433266ddc498e605dc",
|
||||
"date": "2015-09-25T00:55:08+00:00",
|
||||
"message": "Update version.py to 0.1.2 [skip ci]\n\n(by utilitybelt/scripts/autotag_version.py)\n",
|
||||
"committer": {
|
||||
"username": "CodeShip Tagging",
|
||||
"avatar_url": "https://bitbucket.org/account/SomeCoolLabs_CodeShip/avatar/32/",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assertSchema('bitbucket_customer_example_noauthor', expected, bb_webhook)
|
||||
|
||||
|
||||
def test_bitbucket_customer_payload_tag():
|
||||
expected = {
|
||||
"commit": "a0ec139843b2bb281ab21a433266ddc498e605dc",
|
||||
"ref": "refs/tags/0.1.2",
|
||||
"git_url": "git@bitbucket.org:somecoollabs/svc-identity.git",
|
||||
"commit_info": {
|
||||
"url": "https://bitbucket.org/somecoollabs/svc-identity/commits/a0ec139843b2bb281ab21a433266ddc498e605dc",
|
||||
"date": "2015-09-25T00:55:08+00:00",
|
||||
"message": "Update version.py to 0.1.2 [skip ci]\n\n(by utilitybelt/scripts/autotag_version.py)\n",
|
||||
"committer": {
|
||||
"username": "CodeShip Tagging",
|
||||
"avatar_url": "https://bitbucket.org/account/SomeCoolLabs_CodeShip/avatar/32/",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assertSchema('bitbucket_customer_example_tag', expected, bb_webhook)
|
||||
|
||||
|
||||
def test_bitbucket_commit():
|
||||
ref = 'refs/heads/somebranch'
|
||||
default_branch = 'somebranch'
|
||||
repository_name = 'foo/bar'
|
||||
|
||||
def lookup_author(_):
|
||||
return {
|
||||
'user': {
|
||||
'display_name': 'cooluser',
|
||||
'avatar': 'http://some/avatar/url'
|
||||
}
|
||||
}
|
||||
|
||||
expected = {
|
||||
"commit": u"abdeaf1b2b4a6b9ddf742c1e1754236380435a62",
|
||||
"ref": u"refs/heads/somebranch",
|
||||
"git_url": u"git@bitbucket.org:foo/bar.git",
|
||||
"default_branch": u"somebranch",
|
||||
"commit_info": {
|
||||
"url": u"https://bitbucket.org/foo/bar/commits/abdeaf1b2b4a6b9ddf742c1e1754236380435a62",
|
||||
"date": u"2012-07-24 00:26:36",
|
||||
"message": u"making some changes\n",
|
||||
"author": {
|
||||
"avatar_url": u"http://some/avatar/url",
|
||||
"username": u"cooluser",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assertSchema('bitbucket_commit', expected, bb_commit, ref, default_branch,
|
||||
repository_name, lookup_author)
|
||||
|
||||
def test_bitbucket_webhook_payload():
|
||||
expected = {
|
||||
"commit": u"af64ae7188685f8424040b4735ad12941b980d75",
|
||||
"ref": u"refs/heads/master",
|
||||
"git_url": u"git@bitbucket.org:jsmith/another-repo.git",
|
||||
"commit_info": {
|
||||
"url": u"https://bitbucket.org/jsmith/another-repo/commits/af64ae7188685f8424040b4735ad12941b980d75",
|
||||
"date": u"2015-09-10T20:40:54+00:00",
|
||||
"message": u"Dockerfile edited online with Bitbucket",
|
||||
"author": {
|
||||
"username": u"John Smith",
|
||||
"avatar_url": u"https://bitbucket.org/account/jsmith/avatar/32/",
|
||||
},
|
||||
"committer": {
|
||||
"username": u"John Smith",
|
||||
"avatar_url": u"https://bitbucket.org/account/jsmith/avatar/32/",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assertSchema('bitbucket_webhook', expected, bb_webhook)
|
||||
|
||||
|
||||
def test_github_webhook_payload_slash_branch():
|
||||
expected = {
|
||||
'commit': u'410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'ref': u'refs/heads/slash/branch',
|
||||
'default_branch': u'master',
|
||||
'git_url': u'git@github.com:jsmith/anothertest.git',
|
||||
'commit_info': {
|
||||
'url': u'https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'date': u'2015-09-11T14:26:16-04:00',
|
||||
'message': u'Update Dockerfile',
|
||||
'committer': {
|
||||
'username': u'jsmith',
|
||||
},
|
||||
'author': {
|
||||
'username': u'jsmith',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assertSchema('github_webhook_slash_branch', expected, gh_webhook)
|
||||
|
||||
|
||||
def test_github_webhook_payload():
|
||||
expected = {
|
||||
'commit': u'410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'ref': u'refs/heads/master',
|
||||
'default_branch': u'master',
|
||||
'git_url': u'git@github.com:jsmith/anothertest.git',
|
||||
'commit_info': {
|
||||
'url': u'https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'date': u'2015-09-11T14:26:16-04:00',
|
||||
'message': u'Update Dockerfile',
|
||||
'committer': {
|
||||
'username': u'jsmith',
|
||||
},
|
||||
'author': {
|
||||
'username': u'jsmith',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
assertSchema('github_webhook', expected, gh_webhook)
|
||||
|
||||
|
||||
def test_github_webhook_payload_with_lookup():
|
||||
expected = {
|
||||
'commit': u'410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'ref': u'refs/heads/master',
|
||||
'default_branch': u'master',
|
||||
'git_url': u'git@github.com:jsmith/anothertest.git',
|
||||
'commit_info': {
|
||||
'url': u'https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'date': u'2015-09-11T14:26:16-04:00',
|
||||
'message': u'Update Dockerfile',
|
||||
'committer': {
|
||||
'username': u'jsmith',
|
||||
'url': u'http://github.com/jsmith',
|
||||
'avatar_url': u'http://some/avatar/url',
|
||||
},
|
||||
'author': {
|
||||
'username': u'jsmith',
|
||||
'url': u'http://github.com/jsmith',
|
||||
'avatar_url': u'http://some/avatar/url',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
def lookup_user(_):
|
||||
return {
|
||||
'html_url': 'http://github.com/jsmith',
|
||||
'avatar_url': 'http://some/avatar/url'
|
||||
}
|
||||
|
||||
assertSchema('github_webhook', expected, gh_webhook, lookup_user=lookup_user)
|
||||
|
||||
|
||||
def test_github_webhook_payload_missing_fields_with_lookup():
|
||||
expected = {
|
||||
'commit': u'410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'ref': u'refs/heads/master',
|
||||
'default_branch': u'master',
|
||||
'git_url': u'git@github.com:jsmith/anothertest.git',
|
||||
'commit_info': {
|
||||
'url': u'https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'date': u'2015-09-11T14:26:16-04:00',
|
||||
'message': u'Update Dockerfile'
|
||||
},
|
||||
}
|
||||
|
||||
def lookup_user(username):
|
||||
if not username:
|
||||
raise Exception('Fail!')
|
||||
|
||||
return {
|
||||
'html_url': 'http://github.com/jsmith',
|
||||
'avatar_url': 'http://some/avatar/url'
|
||||
}
|
||||
|
||||
assertSchema('github_webhook_missing', expected, gh_webhook, lookup_user=lookup_user)
|
||||
|
||||
|
||||
def test_gitlab_webhook_payload():
|
||||
expected = {
|
||||
'commit': u'fb88379ee45de28a0a4590fddcbd8eff8b36026e',
|
||||
'ref': u'refs/heads/master',
|
||||
'git_url': u'git@gitlab.com:jsmith/somerepo.git',
|
||||
'commit_info': {
|
||||
'url': u'https://gitlab.com/jsmith/somerepo/commit/fb88379ee45de28a0a4590fddcbd8eff8b36026e',
|
||||
'date': u'2015-08-13T19:33:18+00:00',
|
||||
'message': u'Fix link\n',
|
||||
},
|
||||
}
|
||||
|
||||
assertSchema('gitlab_webhook', expected, gl_webhook)
|
||||
|
||||
|
||||
def test_github_webhook_payload_known_issue():
|
||||
expected = {
|
||||
"commit": "118b07121695d9f2e40a5ff264fdcc2917680870",
|
||||
"ref": "refs/heads/master",
|
||||
"default_branch": "master",
|
||||
"git_url": "git@github.com:jsmith/docker-test.git",
|
||||
"commit_info": {
|
||||
"url": "https://github.com/jsmith/docker-test/commit/118b07121695d9f2e40a5ff264fdcc2917680870",
|
||||
"date": "2015-09-25T14:55:11-04:00",
|
||||
"message": "Fail",
|
||||
},
|
||||
}
|
||||
|
||||
assertSchema('github_webhook_noname', expected, gh_webhook)
|
||||
|
||||
|
||||
def test_github_webhook_payload_missing_fields():
|
||||
expected = {
|
||||
'commit': u'410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'ref': u'refs/heads/master',
|
||||
'default_branch': u'master',
|
||||
'git_url': u'git@github.com:jsmith/anothertest.git',
|
||||
'commit_info': {
|
||||
'url': u'https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c',
|
||||
'date': u'2015-09-11T14:26:16-04:00',
|
||||
'message': u'Update Dockerfile'
|
||||
},
|
||||
}
|
||||
|
||||
assertSchema('github_webhook_missing', expected, gh_webhook)
|
||||
|
||||
|
||||
def test_gitlab_webhook_nocommit_payload():
|
||||
assertSkipped('gitlab_webhook_nocommit', gl_webhook)
|
||||
|
||||
|
||||
def test_gitlab_webhook_multiple_commits():
|
||||
expected = {
|
||||
'commit': u'9a052a0b2fbe01d4a1a88638dd9fe31c1c56ef53',
|
||||
'ref': u'refs/heads/master',
|
||||
'git_url': u'git@gitlab.com:jsmith/some-test-project.git',
|
||||
'commit_info': {
|
||||
'url': u'https://gitlab.com/jsmith/some-test-project/commit/9a052a0b2fbe01d4a1a88638dd9fe31c1c56ef53',
|
||||
'date': u'2016-09-29T15:02:41+00:00',
|
||||
'message': u"Merge branch 'foobar' into 'master'\r\n\r\nAdd changelog\r\n\r\nSome merge thing\r\n\r\nSee merge request !1",
|
||||
'author': {
|
||||
'username': 'jsmith',
|
||||
'url': 'http://gitlab.com/jsmith',
|
||||
'avatar_url': 'http://some/avatar/url'
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
def lookup_user(_):
|
||||
return {
|
||||
'username': 'jsmith',
|
||||
'html_url': 'http://gitlab.com/jsmith',
|
||||
'avatar_url': 'http://some/avatar/url',
|
||||
}
|
||||
|
||||
assertSchema('gitlab_webhook_multicommit', expected, gl_webhook, lookup_user=lookup_user)
|
||||
|
||||
|
||||
def test_gitlab_webhook_for_tag():
|
||||
expected = {
|
||||
'commit': u'82b3d5ae55f7080f1e6022629cdb57bfae7cccc7',
|
||||
'commit_info': {
|
||||
'author': {
|
||||
'avatar_url': 'http://some/avatar/url',
|
||||
'url': 'http://gitlab.com/jsmith',
|
||||
'username': 'jsmith'
|
||||
},
|
||||
'date': '2015-08-13T19:33:18+00:00',
|
||||
'message': 'Fix link\n',
|
||||
'url': 'https://some/url',
|
||||
},
|
||||
'git_url': u'git@example.com:jsmith/example.git',
|
||||
'ref': u'refs/tags/v1.0.0',
|
||||
}
|
||||
|
||||
def lookup_user(_):
|
||||
return {
|
||||
'username': 'jsmith',
|
||||
'html_url': 'http://gitlab.com/jsmith',
|
||||
'avatar_url': 'http://some/avatar/url',
|
||||
}
|
||||
|
||||
def lookup_commit(repo_id, commit_sha):
|
||||
if commit_sha == '82b3d5ae55f7080f1e6022629cdb57bfae7cccc7':
|
||||
return {
|
||||
"id": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7",
|
||||
"message": "Fix link\n",
|
||||
"timestamp": "2015-08-13T19:33:18+00:00",
|
||||
"url": "https://some/url",
|
||||
"author_name": "Foo Guy",
|
||||
"author_email": "foo@bar.com",
|
||||
}
|
||||
|
||||
return None
|
||||
|
||||
assertSchema('gitlab_webhook_tag', expected, gl_webhook, lookup_user=lookup_user,
|
||||
lookup_commit=lookup_commit)
|
||||
|
||||
|
||||
def test_gitlab_webhook_for_tag_nocommit():
|
||||
assertSkipped('gitlab_webhook_tag', gl_webhook)
|
||||
|
||||
|
||||
def test_gitlab_webhook_for_tag_commit_sha_null():
|
||||
assertSkipped('gitlab_webhook_tag_commit_sha_null', gl_webhook)
|
||||
|
||||
|
||||
def test_gitlab_webhook_for_tag_known_issue():
|
||||
expected = {
|
||||
'commit': u'770830e7ca132856991e6db4f7fc0f4dbe20bd5f',
|
||||
'ref': u'refs/tags/thirdtag',
|
||||
'git_url': u'git@gitlab.com:someuser/some-test-project.git',
|
||||
'commit_info': {
|
||||
'url': u'https://gitlab.com/someuser/some-test-project/commit/770830e7ca132856991e6db4f7fc0f4dbe20bd5f',
|
||||
'date': u'2019-10-17T18:07:48Z',
|
||||
'message': u'Update Dockerfile',
|
||||
'author': {
|
||||
'username': 'someuser',
|
||||
'url': 'http://gitlab.com/someuser',
|
||||
'avatar_url': 'http://some/avatar/url',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
def lookup_user(_):
|
||||
return {
|
||||
'username': 'someuser',
|
||||
'html_url': 'http://gitlab.com/someuser',
|
||||
'avatar_url': 'http://some/avatar/url',
|
||||
}
|
||||
|
||||
assertSchema('gitlab_webhook_tag_commit_issue', expected, gl_webhook, lookup_user=lookup_user)
|
||||
|
||||
|
||||
def test_gitlab_webhook_payload_known_issue():
|
||||
expected = {
|
||||
'commit': u'770830e7ca132856991e6db4f7fc0f4dbe20bd5f',
|
||||
'ref': u'refs/tags/fourthtag',
|
||||
'git_url': u'git@gitlab.com:someuser/some-test-project.git',
|
||||
'commit_info': {
|
||||
'url': u'https://gitlab.com/someuser/some-test-project/commit/770830e7ca132856991e6db4f7fc0f4dbe20bd5f',
|
||||
'date': u'2019-10-17T18:07:48Z',
|
||||
'message': u'Update Dockerfile',
|
||||
},
|
||||
}
|
||||
|
||||
def lookup_commit(repo_id, commit_sha):
|
||||
if commit_sha == '770830e7ca132856991e6db4f7fc0f4dbe20bd5f':
|
||||
return {
|
||||
"added": [],
|
||||
"author": {
|
||||
"name": "Some User",
|
||||
"email": "someuser@somedomain.com"
|
||||
},
|
||||
"url": "https://gitlab.com/someuser/some-test-project/commit/770830e7ca132856991e6db4f7fc0f4dbe20bd5f",
|
||||
"message": "Update Dockerfile",
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"Dockerfile"
|
||||
],
|
||||
"id": "770830e7ca132856991e6db4f7fc0f4dbe20bd5f"
|
||||
}
|
||||
|
||||
return None
|
||||
|
||||
assertSchema('gitlab_webhook_known_issue', expected, gl_webhook, lookup_commit=lookup_commit)
|
||||
|
||||
|
||||
def test_gitlab_webhook_for_other():
|
||||
assertSkipped('gitlab_webhook_other', gl_webhook)
|
||||
|
||||
|
||||
def test_gitlab_webhook_payload_with_lookup():
|
||||
expected = {
|
||||
'commit': u'fb88379ee45de28a0a4590fddcbd8eff8b36026e',
|
||||
'ref': u'refs/heads/master',
|
||||
'git_url': u'git@gitlab.com:jsmith/somerepo.git',
|
||||
'commit_info': {
|
||||
'url': u'https://gitlab.com/jsmith/somerepo/commit/fb88379ee45de28a0a4590fddcbd8eff8b36026e',
|
||||
'date': u'2015-08-13T19:33:18+00:00',
|
||||
'message': u'Fix link\n',
|
||||
'author': {
|
||||
'username': 'jsmith',
|
||||
'url': 'http://gitlab.com/jsmith',
|
||||
'avatar_url': 'http://some/avatar/url',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
def lookup_user(_):
|
||||
return {
|
||||
'username': 'jsmith',
|
||||
'html_url': 'http://gitlab.com/jsmith',
|
||||
'avatar_url': 'http://some/avatar/url',
|
||||
}
|
||||
|
||||
assertSchema('gitlab_webhook', expected, gl_webhook, lookup_user=lookup_user)
|
||||
|
||||
|
||||
def test_github_webhook_payload_deleted_commit():
|
||||
expected = {
|
||||
'commit': u'456806b662cb903a0febbaed8344f3ed42f27bab',
|
||||
'commit_info': {
|
||||
'author': {
|
||||
'username': u'jsmith'
|
||||
},
|
||||
'committer': {
|
||||
'username': u'jsmith'
|
||||
},
|
||||
'date': u'2015-12-08T18:07:03-05:00',
|
||||
'message': (u'Merge pull request #1044 from jsmith/errerror\n\n' +
|
||||
'Assign the exception to a variable to log it'),
|
||||
'url': u'https://github.com/jsmith/somerepo/commit/456806b662cb903a0febbaed8344f3ed42f27bab'
|
||||
},
|
||||
'git_url': u'git@github.com:jsmith/somerepo.git',
|
||||
'ref': u'refs/heads/master',
|
||||
'default_branch': u'master',
|
||||
}
|
||||
|
||||
def lookup_user(_):
|
||||
return None
|
||||
|
||||
assertSchema('github_webhook_deletedcommit', expected, gh_webhook, lookup_user=lookup_user)
|
||||
|
||||
|
||||
def test_github_webhook_known_issue():
|
||||
def lookup_user(_):
|
||||
return None
|
||||
|
||||
assertSkipped('github_webhook_knownissue', gh_webhook, lookup_user=lookup_user)
|
||||
|
||||
|
||||
def test_bitbucket_webhook_known_issue():
|
||||
assertSkipped('bitbucket_knownissue', bb_webhook)
|
25
buildtrigger/test/test_triggerutil.py
Normal file
25
buildtrigger/test/test_triggerutil.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import re
|
||||
|
||||
import pytest
|
||||
|
||||
from buildtrigger.triggerutil import matches_ref
|
||||
|
||||
@pytest.mark.parametrize('ref, filt, matches', [
|
||||
('ref/heads/master', '.+', True),
|
||||
('ref/heads/master', 'heads/.+', True),
|
||||
('ref/heads/master', 'heads/master', True),
|
||||
('ref/heads/slash/branch', 'heads/slash/branch', True),
|
||||
('ref/heads/slash/branch', 'heads/.+', True),
|
||||
|
||||
('ref/heads/foobar', 'heads/master', False),
|
||||
('ref/heads/master', 'tags/master', False),
|
||||
|
||||
('ref/heads/master', '(((heads/alpha)|(heads/beta))|(heads/gamma))|(heads/master)', True),
|
||||
('ref/heads/alpha', '(((heads/alpha)|(heads/beta))|(heads/gamma))|(heads/master)', True),
|
||||
('ref/heads/beta', '(((heads/alpha)|(heads/beta))|(heads/gamma))|(heads/master)', True),
|
||||
('ref/heads/gamma', '(((heads/alpha)|(heads/beta))|(heads/gamma))|(heads/master)', True),
|
||||
|
||||
('ref/heads/delta', '(((heads/alpha)|(heads/beta))|(heads/gamma))|(heads/master)', False),
|
||||
])
|
||||
def test_matches_ref(ref, filt, matches):
|
||||
assert matches_ref(ref, re.compile(filt)) == matches
|
24
buildtrigger/test/triggerjson/bitbucket_commit.json
Normal file
24
buildtrigger/test/triggerjson/bitbucket_commit.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"files": [
|
||||
{
|
||||
"type": "added",
|
||||
"file": "AnotherFile.txt"
|
||||
},
|
||||
{
|
||||
"type": "modified",
|
||||
"file": "Readme"
|
||||
}
|
||||
],
|
||||
"raw_author": "Mark Anthony <manthony@example.com>",
|
||||
"utctimestamp": "2012-07-23 22:26:36+00:00",
|
||||
"author": "Mark Anthony",
|
||||
"timestamp": "2012-07-24 00:26:36",
|
||||
"node": "abdeaf1b2b4a6b9ddf742c1e1754236380435a62",
|
||||
"parents": [
|
||||
"86432202a2d5"
|
||||
],
|
||||
"branch": "master",
|
||||
"message": "making some changes\n",
|
||||
"revision": null,
|
||||
"size": -1
|
||||
}
|
|
@ -0,0 +1,199 @@
|
|||
{
|
||||
"actor": {
|
||||
"account_id": "SomeCoolLabs_CodeShip",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/users/SomeCoolLabs_CodeShip"
|
||||
},
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/account/SomeCoolLabs_CodeShip/avatar/32/"
|
||||
}
|
||||
},
|
||||
"type": "user",
|
||||
"display_name": "CodeShip Tagging"
|
||||
},
|
||||
"repository": {
|
||||
"full_name": "somecoollabs/svc-identity",
|
||||
"name": "svc-identity",
|
||||
"scm": "git",
|
||||
"type": "repository",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity"
|
||||
},
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/avatar/16/"
|
||||
}
|
||||
},
|
||||
"is_private": true,
|
||||
"owner": {
|
||||
"account_id": "somecoollabs",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/teams/somecoollabs"
|
||||
},
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/account/somecoollabs/avatar/32/"
|
||||
}
|
||||
},
|
||||
"type": "team",
|
||||
"display_name": "Some Cool Labs"
|
||||
}
|
||||
},
|
||||
"push": {
|
||||
"changes": [
|
||||
{
|
||||
"commits": [
|
||||
{
|
||||
"hash": "a0ec139843b2bb281ab21a433266ddc498e605dc",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commit/a0ec139843b2bb281ab21a433266ddc498e605dc"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/commits/a0ec139843b2bb281ab21a433266ddc498e605dc"
|
||||
}
|
||||
},
|
||||
"author": {
|
||||
"raw": "scripts/autotag_version.py <utilitybelt@somecoollabs.com>"
|
||||
},
|
||||
"type": "commit",
|
||||
"message": "Update version.py to 0.1.2 [skip ci]\n\n(by utilitybelt/scripts/autotag_version.py)\n"
|
||||
}
|
||||
],
|
||||
"created": false,
|
||||
"forced": false,
|
||||
"old": {
|
||||
"target": {
|
||||
"parents": [
|
||||
{
|
||||
"hash": "bd749165b0c50c65c15fc4df526b8e9df26eff10",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commit/bd749165b0c50c65c15fc4df526b8e9df26eff10"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/commits/bd749165b0c50c65c15fc4df526b8e9df26eff10"
|
||||
}
|
||||
},
|
||||
"type": "commit"
|
||||
},
|
||||
{
|
||||
"hash": "910b5624b74190dfaa51938d851563a4c5254926",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commit/910b5624b74190dfaa51938d851563a4c5254926"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/commits/910b5624b74190dfaa51938d851563a4c5254926"
|
||||
}
|
||||
},
|
||||
"type": "commit"
|
||||
}
|
||||
],
|
||||
"date": "2015-09-25T00:54:41+00:00",
|
||||
"type": "commit",
|
||||
"message": "Merged in create-update-user (pull request #3)\n\nCreate + update identity\n",
|
||||
"hash": "263736ecc250113fad56a93f83b712093554ad42",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commit/263736ecc250113fad56a93f83b712093554ad42"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/commits/263736ecc250113fad56a93f83b712093554ad42"
|
||||
}
|
||||
},
|
||||
"author": {
|
||||
"raw": "John Smith <j@smith.com>",
|
||||
"user": {
|
||||
"account_id": "jsmith",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/users/jsmith"
|
||||
},
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/account/jsmith/avatar/32/"
|
||||
}
|
||||
},
|
||||
"type": "user",
|
||||
"display_name": "John Smith"
|
||||
}
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/refs/branches/master"
|
||||
},
|
||||
"commits": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commits/master"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/branch/master"
|
||||
}
|
||||
},
|
||||
"name": "master",
|
||||
"type": "branch"
|
||||
},
|
||||
"links": {
|
||||
"diff": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/diff/a0ec139843b2bb281ab21a433266ddc498e605dc..263736ecc250113fad56a93f83b712093554ad42"
|
||||
},
|
||||
"commits": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commits?include=a0ec139843b2bb281ab21a433266ddc498e605dc&exclude=263736ecc250113fad56a93f83b712093554ad42"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/branches/compare/a0ec139843b2bb281ab21a433266ddc498e605dc..263736ecc250113fad56a93f83b712093554ad42"
|
||||
}
|
||||
},
|
||||
"new": {
|
||||
"target": {
|
||||
"parents": [
|
||||
{
|
||||
"hash": "263736ecc250113fad56a93f83b712093554ad42",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commit/263736ecc250113fad56a93f83b712093554ad42"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/commits/263736ecc250113fad56a93f83b712093554ad42"
|
||||
}
|
||||
},
|
||||
"type": "commit"
|
||||
}
|
||||
],
|
||||
"date": "2015-09-25T00:55:08+00:00",
|
||||
"type": "commit",
|
||||
"message": "Update version.py to 0.1.2 [skip ci]\n\n(by utilitybelt/scripts/autotag_version.py)\n",
|
||||
"hash": "a0ec139843b2bb281ab21a433266ddc498e605dc",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commit/a0ec139843b2bb281ab21a433266ddc498e605dc"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/commits/a0ec139843b2bb281ab21a433266ddc498e605dc"
|
||||
}
|
||||
},
|
||||
"author": {
|
||||
"raw": "scripts/autotag_version.py <utilitybelt@somecoollabs.com>"
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/refs/branches/master"
|
||||
},
|
||||
"commits": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commits/master"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/branch/master"
|
||||
}
|
||||
},
|
||||
"name": "master",
|
||||
"type": "branch"
|
||||
},
|
||||
"closed": false,
|
||||
"truncated": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
{
|
||||
"push": {
|
||||
"changes": [
|
||||
{
|
||||
"links": {
|
||||
"commits": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commits?include=a0ec139843b2bb281ab21a433266ddc498e605dc"
|
||||
}
|
||||
},
|
||||
"closed": false,
|
||||
"new": {
|
||||
"target": {
|
||||
"date": "2015-09-25T00:55:08+00:00",
|
||||
"links": {
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/commits/a0ec139843b2bb281ab21a433266ddc498e605dc"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commit/a0ec139843b2bb281ab21a433266ddc498e605dc"
|
||||
}
|
||||
},
|
||||
"message": "Update version.py to 0.1.2 [skip ci]\n\n(by utilitybelt/scripts/autotag_version.py)\n",
|
||||
"type": "commit",
|
||||
"parents": [
|
||||
{
|
||||
"links": {
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/commits/263736ecc250113fad56a93f83b712093554ad42"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commit/263736ecc250113fad56a93f83b712093554ad42"
|
||||
}
|
||||
},
|
||||
"hash": "263736ecc250113fad56a93f83b712093554ad42",
|
||||
"type": "commit"
|
||||
}
|
||||
],
|
||||
"hash": "a0ec139843b2bb281ab21a433266ddc498e605dc",
|
||||
"author": {
|
||||
"raw": "scripts/autotag_version.py <utilitybelt@somecoollabs.com>"
|
||||
}
|
||||
},
|
||||
"name": "0.1.2",
|
||||
"links": {
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/commits/tag/0.1.2"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/refs/tags/0.1.2"
|
||||
},
|
||||
"commits": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity/commits/0.1.2"
|
||||
}
|
||||
},
|
||||
"type": "tag"
|
||||
},
|
||||
"truncated": false,
|
||||
"created": true,
|
||||
"old": null,
|
||||
"forced": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"name": "svc-identity",
|
||||
"links": {
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/somecoollabs/svc-identity"
|
||||
},
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/somecoollabs/svc-identity/avatar/16/"
|
||||
}
|
||||
},
|
||||
"is_private": true,
|
||||
"type": "repository",
|
||||
"scm": "git",
|
||||
"owner": {
|
||||
"account_id": "somecoollabs",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/teams/somecoollabs"
|
||||
},
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/account/somecoollabs/avatar/32/"
|
||||
}
|
||||
},
|
||||
"display_name": "Some Cool Labs",
|
||||
"type": "team"
|
||||
},
|
||||
"full_name": "somecoollabs/svc-identity"
|
||||
},
|
||||
"actor": {
|
||||
"account_id": "SomeCoolLabs_CodeShip",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/users/SomeCoolLabs_CodeShip"
|
||||
},
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/account/SomeCoolLabs_CodeShip/avatar/32/"
|
||||
}
|
||||
},
|
||||
"display_name": "CodeShip Tagging",
|
||||
"type": "user"
|
||||
}
|
||||
}
|
68
buildtrigger/test/triggerjson/bitbucket_knownissue.json
Normal file
68
buildtrigger/test/triggerjson/bitbucket_knownissue.json
Normal file
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"push": {
|
||||
"changes": [
|
||||
|
||||
]
|
||||
},
|
||||
"actor": {
|
||||
"account_id": "jsmith",
|
||||
"display_name": "John Smith",
|
||||
"type": "user",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https:\/\/api.bitbucket.org\/2.0\/users\/jsmith"
|
||||
},
|
||||
"avatar": {
|
||||
"href": "https:\/\/bitbucket.org\/account\/jsmith\/avatar\/32\/"
|
||||
}
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"website": "",
|
||||
"scm": "git",
|
||||
"name": "slip-api",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https:\/\/api.bitbucket.org\/2.0\/repositories\/goldcuff\/slip-api"
|
||||
},
|
||||
"html": {
|
||||
"href": "https:\/\/bitbucket.org\/goldcuff\/slip-api"
|
||||
},
|
||||
"avatar": {
|
||||
"href": "https:\/\/bitbucket.org\/goldcuff\/slip-api\/avatar\/32\/"
|
||||
}
|
||||
},
|
||||
"project": {
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https:\/\/api.bitbucket.org\/2.0\/teams\/goldcuff\/projects\/SLIP"
|
||||
},
|
||||
"html": {
|
||||
"href": "https:\/\/bitbucket.org\/account\/user\/goldcuff\/projects\/SLIP"
|
||||
},
|
||||
"avatar": {
|
||||
"href": "https:\/\/bitbucket.org\/account\/user\/goldcuff\/projects\/SLIP\/avatar\/32"
|
||||
}
|
||||
},
|
||||
"type": "project",
|
||||
"name": "SLIP",
|
||||
"key": "SLIP"
|
||||
},
|
||||
"full_name": "goldcuff\/slip-api",
|
||||
"owner": {
|
||||
"account_id": "goldcuff",
|
||||
"display_name": "Goldcuff",
|
||||
"type": "team",
|
||||
"links": {
|
||||
"self": {
|
||||
"href": "https:\/\/api.bitbucket.org\/2.0\/teams\/goldcuff"
|
||||
},
|
||||
"avatar": {
|
||||
"href": "https:\/\/bitbucket.org\/account\/goldcuff\/avatar\/32\/"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "repository",
|
||||
"is_private": true
|
||||
}
|
||||
}
|
219
buildtrigger/test/triggerjson/bitbucket_webhook.json
Normal file
219
buildtrigger/test/triggerjson/bitbucket_webhook.json
Normal file
|
@ -0,0 +1,219 @@
|
|||
{
|
||||
"push": {
|
||||
"changes": [
|
||||
{
|
||||
"links": {
|
||||
"commits": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo/commits?include=af64ae7188685f8424040b4735ad12941b980d75&exclude=1784139225279a587e0afb151bed1f9ba3dd509e"
|
||||
},
|
||||
"diff": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo/diff/af64ae7188685f8424040b4735ad12941b980d75..1784139225279a587e0afb151bed1f9ba3dd509e"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/jsmith/another-repo/branches/compare/af64ae7188685f8424040b4735ad12941b980d75..1784139225279a587e0afb151bed1f9ba3dd509e"
|
||||
}
|
||||
},
|
||||
"old": {
|
||||
"name": "master",
|
||||
"links": {
|
||||
"commits": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo/commits/master"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/jsmith/another-repo/branch/master"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo/refs/branches/master"
|
||||
}
|
||||
},
|
||||
"type": "branch",
|
||||
"target": {
|
||||
"links": {
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/jsmith/another-repo/commits/1784139225279a587e0afb151bed1f9ba3dd509e"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo/commit/1784139225279a587e0afb151bed1f9ba3dd509e"
|
||||
}
|
||||
},
|
||||
"author": {
|
||||
"user": {
|
||||
"links": {
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/account/jsmith/avatar/32/"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/jsmith/"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/users/jsmith"
|
||||
}
|
||||
},
|
||||
"type": "user",
|
||||
"display_name": "John Smith",
|
||||
"account_id": "jsmith"
|
||||
},
|
||||
"raw": "John Smith <j@smith.com>"
|
||||
},
|
||||
"date": "2015-09-10T20:37:54+00:00",
|
||||
"parents": [
|
||||
{
|
||||
"links": {
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/jsmith/another-repo/commits/5329daa0961ec968de9ef36f30024bfa0da73103"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo/commit/5329daa0961ec968de9ef36f30024bfa0da73103"
|
||||
}
|
||||
},
|
||||
"type": "commit",
|
||||
"hash": "5329daa0961ec968de9ef36f30024bfa0da73103"
|
||||
}
|
||||
],
|
||||
"type": "commit",
|
||||
"message": "Dockerfile edited online with Bitbucket",
|
||||
"hash": "1784139225279a587e0afb151bed1f9ba3dd509e"
|
||||
}
|
||||
},
|
||||
"forced": false,
|
||||
"truncated": false,
|
||||
"commits": [
|
||||
{
|
||||
"author": {
|
||||
"user": {
|
||||
"links": {
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/account/jsmith/avatar/32/"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/users/jsmith"
|
||||
}
|
||||
},
|
||||
"type": "user",
|
||||
"display_name": "John Smith",
|
||||
"account_id": "jsmith"
|
||||
},
|
||||
"raw": "John Smith <j@smith.com>"
|
||||
},
|
||||
"links": {
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/jsmith/another-repo/commits/af64ae7188685f8424040b4735ad12941b980d75"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo/commit/af64ae7188685f8424040b4735ad12941b980d75"
|
||||
}
|
||||
},
|
||||
"message": "Dockerfile edited online with Bitbucket",
|
||||
"type": "commit",
|
||||
"hash": "af64ae7188685f8424040b4735ad12941b980d75"
|
||||
}
|
||||
],
|
||||
"new": {
|
||||
"name": "master",
|
||||
"links": {
|
||||
"commits": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo/commits/master"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/jsmith/another-repo/branch/master"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo/refs/branches/master"
|
||||
}
|
||||
},
|
||||
"type": "branch",
|
||||
"target": {
|
||||
"links": {
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/jsmith/another-repo/commits/af64ae7188685f8424040b4735ad12941b980d75"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo/commit/af64ae7188685f8424040b4735ad12941b980d75"
|
||||
}
|
||||
},
|
||||
"author": {
|
||||
"user": {
|
||||
"links": {
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/account/jsmith/avatar/32/"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/users/jsmith"
|
||||
}
|
||||
},
|
||||
"type": "user",
|
||||
"display_name": "John Smith",
|
||||
"account_id": "jsmith"
|
||||
},
|
||||
"raw": "John Smith <j@smith.com>"
|
||||
},
|
||||
"date": "2015-09-10T20:40:54+00:00",
|
||||
"parents": [
|
||||
{
|
||||
"links": {
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/jsmith/another-repo/commits/1784139225279a587e0afb151bed1f9ba3dd509e"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo/commit/1784139225279a587e0afb151bed1f9ba3dd509e"
|
||||
}
|
||||
},
|
||||
"type": "commit",
|
||||
"hash": "1784139225279a587e0afb151bed1f9ba3dd509e"
|
||||
}
|
||||
],
|
||||
"type": "commit",
|
||||
"message": "Dockerfile edited online with Bitbucket",
|
||||
"hash": "af64ae7188685f8424040b4735ad12941b980d75"
|
||||
}
|
||||
},
|
||||
"closed": false,
|
||||
"created": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"links": {
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/jsmith/another-repo/avatar/16/"
|
||||
},
|
||||
"html": {
|
||||
"href": "https://bitbucket.org/jsmith/another-repo"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/repositories/jsmith/another-repo"
|
||||
}
|
||||
},
|
||||
"full_name": "jsmith/another-repo",
|
||||
"type": "repository",
|
||||
"is_private": true,
|
||||
"name": "Another Repo",
|
||||
"owner": {
|
||||
"links": {
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/account/jsmith/avatar/32/"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/users/jsmith"
|
||||
}
|
||||
},
|
||||
"type": "user",
|
||||
"display_name": "John Smith",
|
||||
"account_id": "jsmith"
|
||||
},
|
||||
"scm": "git"
|
||||
},
|
||||
"actor": {
|
||||
"links": {
|
||||
"avatar": {
|
||||
"href": "https://bitbucket.org/account/jsmith/avatar/32/"
|
||||
},
|
||||
"self": {
|
||||
"href": "https://api.bitbucket.org/2.0/users/jsmith"
|
||||
}
|
||||
},
|
||||
"type": "user",
|
||||
"display_name": "John Smith",
|
||||
"account_id": "jsmith"
|
||||
}
|
||||
}
|
20
buildtrigger/test/triggerjson/custom_webhook.json
Normal file
20
buildtrigger/test/triggerjson/custom_webhook.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"commit": "1c002dd",
|
||||
"ref": "refs/heads/master",
|
||||
"default_branch": "master",
|
||||
"commit_info": {
|
||||
"url": "gitsoftware.com/repository/commits/1234567",
|
||||
"message": "initial commit",
|
||||
"date": "timestamp",
|
||||
"author": {
|
||||
"username": "user",
|
||||
"avatar_url": "gravatar.com/user.png",
|
||||
"url": "gitsoftware.com/users/user"
|
||||
},
|
||||
"committer": {
|
||||
"username": "user",
|
||||
"avatar_url": "gravatar.com/user.png",
|
||||
"url": "gitsoftware.com/users/user"
|
||||
}
|
||||
}
|
||||
}
|
153
buildtrigger/test/triggerjson/github_webhook.json
Normal file
153
buildtrigger/test/triggerjson/github_webhook.json
Normal file
|
@ -0,0 +1,153 @@
|
|||
{
|
||||
"ref": "refs/heads/master",
|
||||
"before": "9ea43cab474709d4a61afb7e3340de1ffc405b41",
|
||||
"after": "410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"created": false,
|
||||
"deleted": false,
|
||||
"forced": false,
|
||||
"base_ref": null,
|
||||
"compare": "https://github.com/jsmith/anothertest/compare/9ea43cab4747...410f4cdf8ff0",
|
||||
"commits": [
|
||||
{
|
||||
"id": "410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"distinct": true,
|
||||
"message": "Update Dockerfile",
|
||||
"timestamp": "2015-09-11T14:26:16-04:00",
|
||||
"url": "https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"author": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"committer": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"added": [],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"Dockerfile"
|
||||
]
|
||||
}
|
||||
],
|
||||
"head_commit": {
|
||||
"id": "410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"distinct": true,
|
||||
"message": "Update Dockerfile",
|
||||
"timestamp": "2015-09-11T14:26:16-04:00",
|
||||
"url": "https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"author": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"committer": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"added": [],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"Dockerfile"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"id": 1234567,
|
||||
"name": "anothertest",
|
||||
"full_name": "jsmith/anothertest",
|
||||
"owner": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com"
|
||||
},
|
||||
"private": false,
|
||||
"html_url": "https://github.com/jsmith/anothertest",
|
||||
"description": "",
|
||||
"fork": false,
|
||||
"url": "https://github.com/jsmith/anothertest",
|
||||
"forks_url": "https://api.github.com/repos/jsmith/anothertest/forks",
|
||||
"keys_url": "https://api.github.com/repos/jsmith/anothertest/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/jsmith/anothertest/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/jsmith/anothertest/teams",
|
||||
"hooks_url": "https://api.github.com/repos/jsmith/anothertest/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/jsmith/anothertest/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/jsmith/anothertest/events",
|
||||
"assignees_url": "https://api.github.com/repos/jsmith/anothertest/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/jsmith/anothertest/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/jsmith/anothertest/tags",
|
||||
"blobs_url": "https://api.github.com/repos/jsmith/anothertest/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/jsmith/anothertest/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/jsmith/anothertest/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/jsmith/anothertest/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/jsmith/anothertest/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/jsmith/anothertest/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/jsmith/anothertest/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/jsmith/anothertest/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/jsmith/anothertest/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/jsmith/anothertest/subscription",
|
||||
"commits_url": "https://api.github.com/repos/jsmith/anothertest/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/jsmith/anothertest/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/jsmith/anothertest/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/jsmith/anothertest/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/jsmith/anothertest/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/jsmith/anothertest/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/jsmith/anothertest/merges",
|
||||
"archive_url": "https://api.github.com/repos/jsmith/anothertest/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/jsmith/anothertest/downloads",
|
||||
"issues_url": "https://api.github.com/repos/jsmith/anothertest/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/jsmith/anothertest/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/jsmith/anothertest/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/jsmith/anothertest/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/jsmith/anothertest/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/jsmith/anothertest/releases{/id}",
|
||||
"created_at": 1430426945,
|
||||
"updated_at": "2015-04-30T20:49:05Z",
|
||||
"pushed_at": 1441995976,
|
||||
"git_url": "git://github.com/jsmith/anothertest.git",
|
||||
"ssh_url": "git@github.com:jsmith/anothertest.git",
|
||||
"clone_url": "https://github.com/jsmith/anothertest.git",
|
||||
"svn_url": "https://github.com/jsmith/anothertest",
|
||||
"homepage": null,
|
||||
"size": 144,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": null,
|
||||
"has_issues": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"open_issues_count": 0,
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"stargazers": 0,
|
||||
"master_branch": "master"
|
||||
},
|
||||
"pusher": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com"
|
||||
},
|
||||
"sender": {
|
||||
"login": "jsmith",
|
||||
"id": 1234567,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1234567?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/jsmith",
|
||||
"html_url": "https://github.com/jsmith",
|
||||
"followers_url": "https://api.github.com/users/jsmith/followers",
|
||||
"following_url": "https://api.github.com/users/jsmith/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/jsmith/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/jsmith/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/jsmith/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/jsmith/orgs",
|
||||
"repos_url": "https://api.github.com/users/jsmith/repos",
|
||||
"events_url": "https://api.github.com/users/jsmith/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/jsmith/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
199
buildtrigger/test/triggerjson/github_webhook_deletedcommit.json
Normal file
199
buildtrigger/test/triggerjson/github_webhook_deletedcommit.json
Normal file
|
@ -0,0 +1,199 @@
|
|||
{
|
||||
"ref": "refs/heads/master",
|
||||
"before": "c7fa613b99d509c0d4fcbf946f0415b5f024150b",
|
||||
"after": "456806b662cb903a0febbaed8344f3ed42f27bab",
|
||||
"created": false,
|
||||
"deleted": false,
|
||||
"forced": false,
|
||||
"base_ref": null,
|
||||
"compare": "https://github.com/jsmith/somerepo/compare/c7fa613b99d5...456806b662cb",
|
||||
"commits": [
|
||||
{
|
||||
"id": "e00365b225ad7f454982e9198756cc1ab5dc4428",
|
||||
"distinct": true,
|
||||
"message": "Assign the exception to a variable to log it",
|
||||
"timestamp": "2015-12-08T18:03:48-05:00",
|
||||
"url": "https://github.com/jsmith/somerepo/commit/e00365b225ad7f454982e9198756cc1ab5dc4428",
|
||||
"author": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"committer": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"added": [
|
||||
|
||||
],
|
||||
"removed": [
|
||||
|
||||
],
|
||||
"modified": [
|
||||
"storage/basestorage.py"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "456806b662cb903a0febbaed8344f3ed42f27bab",
|
||||
"distinct": true,
|
||||
"message": "Merge pull request #1044 from jsmith/errerror\n\nAssign the exception to a variable to log it",
|
||||
"timestamp": "2015-12-08T18:07:03-05:00",
|
||||
"url": "https://github.com/jsmith/somerepo/commit/456806b662cb903a0febbaed8344f3ed42f27bab",
|
||||
"author": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"committer": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"added": [
|
||||
|
||||
],
|
||||
"removed": [
|
||||
|
||||
],
|
||||
"modified": [
|
||||
"storage/basestorage.py"
|
||||
]
|
||||
}
|
||||
],
|
||||
"head_commit": {
|
||||
"id": "456806b662cb903a0febbaed8344f3ed42f27bab",
|
||||
"distinct": true,
|
||||
"message": "Merge pull request #1044 from jsmith/errerror\n\nAssign the exception to a variable to log it",
|
||||
"timestamp": "2015-12-08T18:07:03-05:00",
|
||||
"url": "https://github.com/jsmith/somerepo/commit/456806b662cb903a0febbaed8344f3ed42f27bab",
|
||||
"author": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"committer": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"added": [
|
||||
|
||||
],
|
||||
"removed": [
|
||||
|
||||
],
|
||||
"modified": [
|
||||
"storage/basestorage.py"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"id": 12345678,
|
||||
"name": "somerepo",
|
||||
"full_name": "jsmith/somerepo",
|
||||
"owner": {
|
||||
"name": "jsmith",
|
||||
"email": null
|
||||
},
|
||||
"private": true,
|
||||
"html_url": "https://github.com/jsmith/somerepo",
|
||||
"description": "Some Cool Repo",
|
||||
"fork": false,
|
||||
"url": "https://github.com/jsmith/somerepo",
|
||||
"forks_url": "https://api.github.com/repos/jsmith/somerepo/forks",
|
||||
"keys_url": "https://api.github.com/repos/jsmith/somerepo/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/jsmith/somerepo/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/jsmith/somerepo/teams",
|
||||
"hooks_url": "https://api.github.com/repos/jsmith/somerepo/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/jsmith/somerepo/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/jsmith/somerepo/events",
|
||||
"assignees_url": "https://api.github.com/repos/jsmith/somerepo/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/jsmith/somerepo/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/jsmith/somerepo/tags",
|
||||
"blobs_url": "https://api.github.com/repos/jsmith/somerepo/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/jsmith/somerepo/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/jsmith/somerepo/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/jsmith/somerepo/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/jsmith/somerepo/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/jsmith/somerepo/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/jsmith/somerepo/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/jsmith/somerepo/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/jsmith/somerepo/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/jsmith/somerepo/subscription",
|
||||
"commits_url": "https://api.github.com/repos/jsmith/somerepo/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/jsmith/somerepo/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/jsmith/somerepo/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/jsmith/somerepo/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/jsmith/somerepo/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/jsmith/somerepo/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/jsmith/somerepo/merges",
|
||||
"archive_url": "https://api.github.com/repos/jsmith/somerepo/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/jsmith/somerepo/downloads",
|
||||
"issues_url": "https://api.github.com/repos/jsmith/somerepo/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/jsmith/somerepo/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/jsmith/somerepo/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/jsmith/somerepo/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/jsmith/somerepo/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/jsmith/somerepo/releases{/id}",
|
||||
"created_at": 1415056063,
|
||||
"updated_at": "2015-11-12T05:16:51Z",
|
||||
"pushed_at": 1449616023,
|
||||
"git_url": "git://github.com/jsmith/somerepo.git",
|
||||
"ssh_url": "git@github.com:jsmith/somerepo.git",
|
||||
"clone_url": "https://github.com/jsmith/somerepo.git",
|
||||
"svn_url": "https://github.com/jsmith/somerepo",
|
||||
"homepage": "",
|
||||
"size": 183677,
|
||||
"stargazers_count": 3,
|
||||
"watchers_count": 3,
|
||||
"language": "Python",
|
||||
"has_issues": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": false,
|
||||
"has_pages": false,
|
||||
"forks_count": 8,
|
||||
"mirror_url": null,
|
||||
"open_issues_count": 188,
|
||||
"forks": 8,
|
||||
"open_issues": 188,
|
||||
"watchers": 3,
|
||||
"default_branch": "master",
|
||||
"stargazers": 3,
|
||||
"master_branch": "master",
|
||||
"organization": "jsmith"
|
||||
},
|
||||
"pusher": {
|
||||
"name": "jsmith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"organization": {
|
||||
"login": "jsmith",
|
||||
"id": 9876543,
|
||||
"url": "https://api.github.com/orgs/jsmith",
|
||||
"repos_url": "https://api.github.com/orgs/jsmith/repos",
|
||||
"events_url": "https://api.github.com/orgs/jsmith/events",
|
||||
"members_url": "https://api.github.com/orgs/jsmith/members{/member}",
|
||||
"public_members_url": "https://api.github.com/orgs/jsmith/public_members{/member}",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/5504624?v=3",
|
||||
"description": null
|
||||
},
|
||||
"sender": {
|
||||
"login": "jsmith",
|
||||
"id": 1234567,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/000000?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/jsmith",
|
||||
"html_url": "https://github.com/jsmith",
|
||||
"followers_url": "https://api.github.com/users/jsmith/followers",
|
||||
"following_url": "https://api.github.com/users/jsmith/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/jsmith/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/jsmith/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/jsmith/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/jsmith/orgs",
|
||||
"repos_url": "https://api.github.com/users/jsmith/repos",
|
||||
"events_url": "https://api.github.com/users/jsmith/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/jsmith/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
126
buildtrigger/test/triggerjson/github_webhook_knownissue.json
Normal file
126
buildtrigger/test/triggerjson/github_webhook_knownissue.json
Normal file
|
@ -0,0 +1,126 @@
|
|||
{
|
||||
"ref": "refs/heads/1.2.6",
|
||||
"before": "76a309ed96c72986eddffc02d2f4dda3fe689f10",
|
||||
"after": "0000000000000000000000000000000000000000",
|
||||
"created": false,
|
||||
"deleted": true,
|
||||
"forced": false,
|
||||
"base_ref": null,
|
||||
"compare": "https://github.com/jsmith/somerepo/compare/76a309ed96c7...000000000000",
|
||||
"commits": [
|
||||
|
||||
],
|
||||
"head_commit": null,
|
||||
"repository": {
|
||||
"id": 12345678,
|
||||
"name": "somerepo",
|
||||
"full_name": "jsmith/somerepo",
|
||||
"owner": {
|
||||
"name": "jsmith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"private": true,
|
||||
"html_url": "https://github.com/jsmith/somerepo",
|
||||
"description": "Dockerfile for some repo",
|
||||
"fork": false,
|
||||
"url": "https://github.com/jsmith/somerepo",
|
||||
"forks_url": "https://api.github.com/repos/jsmith/somerepo/forks",
|
||||
"keys_url": "https://api.github.com/repos/jsmith/somerepo/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/jsmith/somerepo/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/jsmith/somerepo/teams",
|
||||
"hooks_url": "https://api.github.com/repos/jsmith/somerepo/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/jsmith/somerepo/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/jsmith/somerepo/events",
|
||||
"assignees_url": "https://api.github.com/repos/jsmith/somerepo/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/jsmith/somerepo/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/jsmith/somerepo/tags",
|
||||
"blobs_url": "https://api.github.com/repos/jsmith/somerepo/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/jsmith/somerepo/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/jsmith/somerepo/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/jsmith/somerepo/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/jsmith/somerepo/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/jsmith/somerepo/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/jsmith/somerepo/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/jsmith/somerepo/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/jsmith/somerepo/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/jsmith/somerepo/subscription",
|
||||
"commits_url": "https://api.github.com/repos/jsmith/somerepo/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/jsmith/somerepo/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/jsmith/somerepo/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/jsmith/somerepo/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/jsmith/somerepo/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/jsmith/somerepo/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/jsmith/somerepo/merges",
|
||||
"archive_url": "https://api.github.com/repos/jsmith/somerepo/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/jsmith/somerepo/downloads",
|
||||
"issues_url": "https://api.github.com/repos/jsmith/somerepo/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/jsmith/somerepo/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/jsmith/somerepo/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/jsmith/somerepo/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/jsmith/somerepo/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/jsmith/somerepo/releases{/id}",
|
||||
"deployments_url": "https://api.github.com/repos/jsmith/somerepo/deployments",
|
||||
"created_at": 1461165926,
|
||||
"updated_at": "2016-11-03T18:20:01Z",
|
||||
"pushed_at": 1479313569,
|
||||
"git_url": "git://github.com/jsmith/somerepo.git",
|
||||
"ssh_url": "git@github.com:jsmith/somerepo.git",
|
||||
"clone_url": "https://github.com/jsmith/somerepo.git",
|
||||
"svn_url": "https://github.com/jsmith/somerepo",
|
||||
"homepage": "",
|
||||
"size": 3114,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": "Shell",
|
||||
"has_issues": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"open_issues_count": 0,
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"stargazers": 0,
|
||||
"master_branch": "master",
|
||||
"organization": "jsmith"
|
||||
},
|
||||
"pusher": {
|
||||
"name": "jsmith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"organization": {
|
||||
"login": "jsmith",
|
||||
"id": 9876543,
|
||||
"url": "https://api.github.com/orgs/jsmith",
|
||||
"repos_url": "https://api.github.com/orgs/jsmith/repos",
|
||||
"events_url": "https://api.github.com/orgs/jsmith/events",
|
||||
"hooks_url": "https://api.github.com/orgs/jsmith/hooks",
|
||||
"issues_url": "https://api.github.com/orgs/jsmith/issues",
|
||||
"members_url": "https://api.github.com/orgs/jsmith/members{/member}",
|
||||
"public_members_url": "https://api.github.com/orgs/jsmith/public_members{/member}",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1234567?v=3",
|
||||
"description": "Open Source Projects for Linux Containers"
|
||||
},
|
||||
"sender": {
|
||||
"login": "jsmith",
|
||||
"id": 12345678,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1234567?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/jsmith",
|
||||
"html_url": "https://github.com/jsmith",
|
||||
"followers_url": "https://api.github.com/users/jsmith/followers",
|
||||
"following_url": "https://api.github.com/users/jsmith/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/jsmith/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/jsmith/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/jsmith/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/jsmith/orgs",
|
||||
"repos_url": "https://api.github.com/users/jsmith/repos",
|
||||
"events_url": "https://api.github.com/users/jsmith/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/jsmith/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
133
buildtrigger/test/triggerjson/github_webhook_missing.json
Normal file
133
buildtrigger/test/triggerjson/github_webhook_missing.json
Normal file
|
@ -0,0 +1,133 @@
|
|||
{
|
||||
"ref": "refs/heads/master",
|
||||
"before": "9ea43cab474709d4a61afb7e3340de1ffc405b41",
|
||||
"after": "410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"created": false,
|
||||
"deleted": false,
|
||||
"forced": false,
|
||||
"base_ref": null,
|
||||
"compare": "https://github.com/jsmith/anothertest/compare/9ea43cab4747...410f4cdf8ff0",
|
||||
"commits": [
|
||||
{
|
||||
"id": "410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"distinct": true,
|
||||
"message": "Update Dockerfile",
|
||||
"timestamp": "2015-09-11T14:26:16-04:00",
|
||||
"url": "https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"added": [],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"Dockerfile"
|
||||
]
|
||||
}
|
||||
],
|
||||
"head_commit": {
|
||||
"id": "410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"distinct": true,
|
||||
"message": "Update Dockerfile",
|
||||
"timestamp": "2015-09-11T14:26:16-04:00",
|
||||
"url": "https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"added": [],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"Dockerfile"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"id": 12345678,
|
||||
"name": "anothertest",
|
||||
"full_name": "jsmith/anothertest",
|
||||
"owner": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com"
|
||||
},
|
||||
"private": false,
|
||||
"html_url": "https://github.com/jsmith/anothertest",
|
||||
"description": "",
|
||||
"fork": false,
|
||||
"url": "https://github.com/jsmith/anothertest",
|
||||
"forks_url": "https://api.github.com/repos/jsmith/anothertest/forks",
|
||||
"keys_url": "https://api.github.com/repos/jsmith/anothertest/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/jsmith/anothertest/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/jsmith/anothertest/teams",
|
||||
"hooks_url": "https://api.github.com/repos/jsmith/anothertest/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/jsmith/anothertest/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/jsmith/anothertest/events",
|
||||
"assignees_url": "https://api.github.com/repos/jsmith/anothertest/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/jsmith/anothertest/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/jsmith/anothertest/tags",
|
||||
"blobs_url": "https://api.github.com/repos/jsmith/anothertest/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/jsmith/anothertest/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/jsmith/anothertest/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/jsmith/anothertest/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/jsmith/anothertest/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/jsmith/anothertest/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/jsmith/anothertest/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/jsmith/anothertest/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/jsmith/anothertest/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/jsmith/anothertest/subscription",
|
||||
"commits_url": "https://api.github.com/repos/jsmith/anothertest/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/jsmith/anothertest/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/jsmith/anothertest/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/jsmith/anothertest/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/jsmith/anothertest/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/jsmith/anothertest/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/jsmith/anothertest/merges",
|
||||
"archive_url": "https://api.github.com/repos/jsmith/anothertest/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/jsmith/anothertest/downloads",
|
||||
"issues_url": "https://api.github.com/repos/jsmith/anothertest/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/jsmith/anothertest/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/jsmith/anothertest/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/jsmith/anothertest/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/jsmith/anothertest/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/jsmith/anothertest/releases{/id}",
|
||||
"created_at": 1430426945,
|
||||
"updated_at": "2015-04-30T20:49:05Z",
|
||||
"pushed_at": 1441995976,
|
||||
"git_url": "git://github.com/jsmith/anothertest.git",
|
||||
"ssh_url": "git@github.com:jsmith/anothertest.git",
|
||||
"clone_url": "https://github.com/jsmith/anothertest.git",
|
||||
"svn_url": "https://github.com/jsmith/anothertest",
|
||||
"homepage": null,
|
||||
"size": 144,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": null,
|
||||
"has_issues": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"open_issues_count": 0,
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"stargazers": 0,
|
||||
"master_branch": "master"
|
||||
},
|
||||
"pusher": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com"
|
||||
},
|
||||
"sender": {
|
||||
"login": "jsmith",
|
||||
"id": 1234567,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/4073002?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/jsmith",
|
||||
"html_url": "https://github.com/jsmith",
|
||||
"followers_url": "https://api.github.com/users/jsmith/followers",
|
||||
"following_url": "https://api.github.com/users/jsmith/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/jsmith/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/jsmith/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/jsmith/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/jsmith/orgs",
|
||||
"repos_url": "https://api.github.com/users/jsmith/repos",
|
||||
"events_url": "https://api.github.com/users/jsmith/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/jsmith/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
149
buildtrigger/test/triggerjson/github_webhook_noname.json
Normal file
149
buildtrigger/test/triggerjson/github_webhook_noname.json
Normal file
|
@ -0,0 +1,149 @@
|
|||
{
|
||||
"ref": "refs/heads/master",
|
||||
"before": "9716b516939221dc754a056e0f9ddf599e71d4b8",
|
||||
"after": "118b07121695d9f2e40a5ff264fdcc2917680870",
|
||||
"created": false,
|
||||
"deleted": false,
|
||||
"forced": false,
|
||||
"base_ref": null,
|
||||
"compare": "https://github.com/jsmith/docker-test/compare/9716b5169392...118b07121695",
|
||||
"commits": [
|
||||
{
|
||||
"id": "118b07121695d9f2e40a5ff264fdcc2917680870",
|
||||
"distinct": true,
|
||||
"message": "Fail",
|
||||
"timestamp": "2015-09-25T14:55:11-04:00",
|
||||
"url": "https://github.com/jsmith/docker-test/commit/118b07121695d9f2e40a5ff264fdcc2917680870",
|
||||
"author": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"committer": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"added": [],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"README.md"
|
||||
]
|
||||
}
|
||||
],
|
||||
"head_commit": {
|
||||
"id": "118b07121695d9f2e40a5ff264fdcc2917680870",
|
||||
"distinct": true,
|
||||
"message": "Fail",
|
||||
"timestamp": "2015-09-25T14:55:11-04:00",
|
||||
"url": "https://github.com/jsmith/docker-test/commit/118b07121695d9f2e40a5ff264fdcc2917680870",
|
||||
"author": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"committer": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"added": [],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"README.md"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"id": 1234567,
|
||||
"name": "docker-test",
|
||||
"full_name": "jsmith/docker-test",
|
||||
"owner": {
|
||||
"name": "jsmith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"private": false,
|
||||
"html_url": "https://github.com/jsmith/docker-test",
|
||||
"description": "",
|
||||
"fork": false,
|
||||
"url": "https://github.com/jsmith/docker-test",
|
||||
"forks_url": "https://api.github.com/repos/jsmith/docker-test/forks",
|
||||
"keys_url": "https://api.github.com/repos/jsmith/docker-test/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/jsmith/docker-test/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/jsmith/docker-test/teams",
|
||||
"hooks_url": "https://api.github.com/repos/jsmith/docker-test/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/jsmith/docker-test/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/jsmith/docker-test/events",
|
||||
"assignees_url": "https://api.github.com/repos/jsmith/docker-test/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/jsmith/docker-test/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/jsmith/docker-test/tags",
|
||||
"blobs_url": "https://api.github.com/repos/jsmith/docker-test/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/jsmith/docker-test/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/jsmith/docker-test/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/jsmith/docker-test/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/jsmith/docker-test/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/jsmith/docker-test/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/jsmith/docker-test/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/jsmith/docker-test/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/jsmith/docker-test/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/jsmith/docker-test/subscription",
|
||||
"commits_url": "https://api.github.com/repos/jsmith/docker-test/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/jsmith/docker-test/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/jsmith/docker-test/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/jsmith/docker-test/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/jsmith/docker-test/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/jsmith/docker-test/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/jsmith/docker-test/merges",
|
||||
"archive_url": "https://api.github.com/repos/jsmith/docker-test/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/jsmith/docker-test/downloads",
|
||||
"issues_url": "https://api.github.com/repos/jsmith/docker-test/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/jsmith/docker-test/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/jsmith/docker-test/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/jsmith/docker-test/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/jsmith/docker-test/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/jsmith/docker-test/releases{/id}",
|
||||
"created_at": 1442254053,
|
||||
"updated_at": "2015-09-14T18:07:33Z",
|
||||
"pushed_at": 1443207315,
|
||||
"git_url": "git://github.com/jsmith/docker-test.git",
|
||||
"ssh_url": "git@github.com:jsmith/docker-test.git",
|
||||
"clone_url": "https://github.com/jsmith/docker-test.git",
|
||||
"svn_url": "https://github.com/jsmith/docker-test",
|
||||
"homepage": null,
|
||||
"size": 108,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": null,
|
||||
"has_issues": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"open_issues_count": 0,
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"stargazers": 0,
|
||||
"master_branch": "master"
|
||||
},
|
||||
"pusher": {
|
||||
"name": "jsmith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"sender": {
|
||||
"login": "jsmith",
|
||||
"id": 1234567,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1234567?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/jsmith",
|
||||
"html_url": "https://github.com/jsmith",
|
||||
"followers_url": "https://api.github.com/users/jsmith/followers",
|
||||
"following_url": "https://api.github.com/users/jsmith/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/jsmith/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/jsmith/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/jsmith/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/jsmith/orgs",
|
||||
"repos_url": "https://api.github.com/users/jsmith/repos",
|
||||
"events_url": "https://api.github.com/users/jsmith/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/jsmith/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
153
buildtrigger/test/triggerjson/github_webhook_slash_branch.json
Normal file
153
buildtrigger/test/triggerjson/github_webhook_slash_branch.json
Normal file
|
@ -0,0 +1,153 @@
|
|||
{
|
||||
"ref": "refs/heads/slash/branch",
|
||||
"before": "9ea43cab474709d4a61afb7e3340de1ffc405b41",
|
||||
"after": "410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"created": false,
|
||||
"deleted": false,
|
||||
"forced": false,
|
||||
"base_ref": null,
|
||||
"compare": "https://github.com/jsmith/anothertest/compare/9ea43cab4747...410f4cdf8ff0",
|
||||
"commits": [
|
||||
{
|
||||
"id": "410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"distinct": true,
|
||||
"message": "Update Dockerfile",
|
||||
"timestamp": "2015-09-11T14:26:16-04:00",
|
||||
"url": "https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"author": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"committer": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"added": [],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"Dockerfile"
|
||||
]
|
||||
}
|
||||
],
|
||||
"head_commit": {
|
||||
"id": "410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"distinct": true,
|
||||
"message": "Update Dockerfile",
|
||||
"timestamp": "2015-09-11T14:26:16-04:00",
|
||||
"url": "https://github.com/jsmith/anothertest/commit/410f4cdf8ff09b87f245b13845e8497f90b90a4c",
|
||||
"author": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"committer": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com",
|
||||
"username": "jsmith"
|
||||
},
|
||||
"added": [],
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"Dockerfile"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"id": 1234567,
|
||||
"name": "anothertest",
|
||||
"full_name": "jsmith/anothertest",
|
||||
"owner": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com"
|
||||
},
|
||||
"private": false,
|
||||
"html_url": "https://github.com/jsmith/anothertest",
|
||||
"description": "",
|
||||
"fork": false,
|
||||
"url": "https://github.com/jsmith/anothertest",
|
||||
"forks_url": "https://api.github.com/repos/jsmith/anothertest/forks",
|
||||
"keys_url": "https://api.github.com/repos/jsmith/anothertest/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/jsmith/anothertest/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/jsmith/anothertest/teams",
|
||||
"hooks_url": "https://api.github.com/repos/jsmith/anothertest/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/jsmith/anothertest/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/jsmith/anothertest/events",
|
||||
"assignees_url": "https://api.github.com/repos/jsmith/anothertest/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/jsmith/anothertest/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/jsmith/anothertest/tags",
|
||||
"blobs_url": "https://api.github.com/repos/jsmith/anothertest/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/jsmith/anothertest/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/jsmith/anothertest/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/jsmith/anothertest/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/jsmith/anothertest/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/jsmith/anothertest/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/jsmith/anothertest/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/jsmith/anothertest/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/jsmith/anothertest/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/jsmith/anothertest/subscription",
|
||||
"commits_url": "https://api.github.com/repos/jsmith/anothertest/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/jsmith/anothertest/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/jsmith/anothertest/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/jsmith/anothertest/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/jsmith/anothertest/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/jsmith/anothertest/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/jsmith/anothertest/merges",
|
||||
"archive_url": "https://api.github.com/repos/jsmith/anothertest/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/jsmith/anothertest/downloads",
|
||||
"issues_url": "https://api.github.com/repos/jsmith/anothertest/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/jsmith/anothertest/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/jsmith/anothertest/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/jsmith/anothertest/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/jsmith/anothertest/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/jsmith/anothertest/releases{/id}",
|
||||
"created_at": 1430426945,
|
||||
"updated_at": "2015-04-30T20:49:05Z",
|
||||
"pushed_at": 1441995976,
|
||||
"git_url": "git://github.com/jsmith/anothertest.git",
|
||||
"ssh_url": "git@github.com:jsmith/anothertest.git",
|
||||
"clone_url": "https://github.com/jsmith/anothertest.git",
|
||||
"svn_url": "https://github.com/jsmith/anothertest",
|
||||
"homepage": null,
|
||||
"size": 144,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": null,
|
||||
"has_issues": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": false,
|
||||
"forks_count": 0,
|
||||
"mirror_url": null,
|
||||
"open_issues_count": 0,
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"stargazers": 0,
|
||||
"master_branch": "master"
|
||||
},
|
||||
"pusher": {
|
||||
"name": "jsmith",
|
||||
"email": "jsmith@users.noreply.github.com"
|
||||
},
|
||||
"sender": {
|
||||
"login": "jsmith",
|
||||
"id": 1234567,
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1234567?v=3",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/jsmith",
|
||||
"html_url": "https://github.com/jsmith",
|
||||
"followers_url": "https://api.github.com/users/jsmith/followers",
|
||||
"following_url": "https://api.github.com/users/jsmith/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/jsmith/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/jsmith/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/jsmith/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/jsmith/orgs",
|
||||
"repos_url": "https://api.github.com/users/jsmith/repos",
|
||||
"events_url": "https://api.github.com/users/jsmith/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/jsmith/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false
|
||||
}
|
||||
}
|
54
buildtrigger/test/triggerjson/gitlab_webhook.json
Normal file
54
buildtrigger/test/triggerjson/gitlab_webhook.json
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"object_kind": "push",
|
||||
"before": "11fcaca195e8b17ca7e3dc47d9608d5b6b892f45",
|
||||
"after": "fb88379ee45de28a0a4590fddcbd8eff8b36026e",
|
||||
"ref": "refs/heads/master",
|
||||
"checkout_sha": "fb88379ee45de28a0a4590fddcbd8eff8b36026e",
|
||||
"message": null,
|
||||
"user_id": 98765,
|
||||
"user_name": "John Smith",
|
||||
"user_email": "j@smith.com",
|
||||
"project_id": 12344567,
|
||||
"repository": {
|
||||
"name": "somerepo",
|
||||
"url": "git@gitlab.com:jsmith/somerepo.git",
|
||||
"description": "",
|
||||
"homepage": "https://gitlab.com/jsmith/somerepo",
|
||||
"git_http_url": "https://gitlab.com/jsmith/somerepo.git",
|
||||
"git_ssh_url": "git@gitlab.com:jsmith/somerepo.git",
|
||||
"visibility_level": 20
|
||||
},
|
||||
"commits": [
|
||||
{
|
||||
"id": "fb88379ee45de28a0a4590fddcbd8eff8b36026e",
|
||||
"message": "Fix link\n",
|
||||
"timestamp": "2015-08-13T19:33:18+00:00",
|
||||
"url": "https://gitlab.com/jsmith/somerepo/commit/fb88379ee45de28a0a4590fddcbd8eff8b36026e",
|
||||
"author": {
|
||||
"name": "Jane Smith",
|
||||
"email": "jane@smith.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "4ca166bc0b511f21fa331873f260f1a7cb38d723",
|
||||
"message": "Do Some Cool Thing",
|
||||
"timestamp": "2015-08-13T15:52:15+00:00",
|
||||
"url": "https://gitlab.com/jsmith/somerepo/commit/4ca166bc0b511f21fa331873f260f1a7cb38d723",
|
||||
"author": {
|
||||
"name": "Jane Smith",
|
||||
"email": "jane@smith.com"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "11fcaca195e8b17ca7e3dc47d9608d5b6b892f45",
|
||||
"message": "Merge another cool thing",
|
||||
"timestamp": "2015-08-13T09:31:47+00:00",
|
||||
"url": "https://gitlab.com/jsmith/somerepo/commit/11fcaca195e8b17ca7e3dc47d9608d5b6b892f45",
|
||||
"author": {
|
||||
"name": "Kate Smith",
|
||||
"email": "kate@smith.com"
|
||||
}
|
||||
}
|
||||
],
|
||||
"total_commits_count": 3
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"ref": "refs/tags/fourthtag",
|
||||
"user_id": 4797254,
|
||||
"object_kind": "tag_push",
|
||||
"repository": {
|
||||
"git_ssh_url": "git@gitlab.com:someuser/some-test-project.git",
|
||||
"name": "Some test project",
|
||||
"url": "git@gitlab.com:someuser/some-test-project.git",
|
||||
"git_http_url": "https://gitlab.com/someuser/some-test-project.git",
|
||||
"visibility_level": 0,
|
||||
"homepage": "https://gitlab.com/someuser/some-test-project",
|
||||
"description": "Some test project"
|
||||
},
|
||||
"event_name": "tag_push",
|
||||
"commits": [
|
||||
{
|
||||
"added": [],
|
||||
"author": {
|
||||
"name": "Some User",
|
||||
"email": "someuser@somedomain.com"
|
||||
},
|
||||
"url": "https://gitlab.com/someuser/some-test-project/commit/770830e7ca132856991e6db4f7fc0f4dbe20bd5f",
|
||||
"timestamp": "2019-10-17T18:07:48Z",
|
||||
"message": "Update Dockerfile",
|
||||
"removed": [],
|
||||
"modified": [
|
||||
"Dockerfile"
|
||||
],
|
||||
"id": "770830e7ca132856991e6db4f7fc0f4dbe20bd5f"
|
||||
}
|
||||
],
|
||||
"after": "770830e7ca132856991e6db4f7fc0f4dbe20bd5f",
|
||||
"project": {
|
||||
"git_ssh_url": "git@gitlab.com:someuser/some-test-project.git",
|
||||
"ci_config_path": null,
|
||||
"web_url": "https://gitlab.com/someuser/some-test-project",
|
||||
"description": "Some test project",
|
||||
"url": "git@gitlab.com:someuser/some-test-project.git",
|
||||
"namespace": "Some User",
|
||||
"default_branch": "master",
|
||||
"homepage": "https://gitlab.com/someuser/some-test-project",
|
||||
"git_http_url": "https://gitlab.com/someuser/some-test-project.git",
|
||||
"avatar_url": null,
|
||||
"ssh_url": "git@gitlab.com:someuser/some-test-project.git",
|
||||
"http_url": "https://gitlab.com/someuser/some-test-project.git",
|
||||
"path_with_namespace": "someuser/some-test-project",
|
||||
"visibility_level": 0,
|
||||
"id": 14838571,
|
||||
"name": "Some test project"
|
||||
},
|
||||
"user_username": "someuser",
|
||||
"checkout_sha": "770830e7ca132856991e6db4f7fc0f4dbe20bd5f",
|
||||
"total_commits_count": 1,
|
||||
"before": "0000000000000000000000000000000000000000",
|
||||
"user_avatar": "https://secure.gravatar.com/avatar/0ea05bdf5c3f2cb8aac782a4a2ac3177?s=80&d=identicon",
|
||||
"message": "",
|
||||
"project_id": 14838571,
|
||||
"user_name": "Some User",
|
||||
"user_email": "",
|
||||
"push_options": {}
|
||||
}
|
100
buildtrigger/test/triggerjson/gitlab_webhook_multicommit.json
Normal file
100
buildtrigger/test/triggerjson/gitlab_webhook_multicommit.json
Normal file
|
@ -0,0 +1,100 @@
|
|||
{
|
||||
"object_kind": "push",
|
||||
"event_name": "push",
|
||||
"before": "0da5b5ebb397f0a8569c97f28e266c718607e8da",
|
||||
"after": "9a052a0b2fbe01d4a1a88638dd9fe31c1c56ef53",
|
||||
"ref": "refs\/heads\/master",
|
||||
"checkout_sha": "9a052a0b2fbe01d4a1a88638dd9fe31c1c56ef53",
|
||||
"message": null,
|
||||
"user_id": 750047,
|
||||
"user_name": "John Smith",
|
||||
"user_email": "j@smith.com",
|
||||
"user_avatar": "https:\/\/secure.gravatar.com\/avatar\/32784623495678234678234?s=80&d=identicon",
|
||||
"project_id": 1756744,
|
||||
"project": {
|
||||
"name": "some-test-project",
|
||||
"description": "",
|
||||
"web_url": "https:\/\/gitlab.com\/jsmith\/some-test-project",
|
||||
"avatar_url": null,
|
||||
"git_ssh_url": "git@gitlab.com:jsmith\/some-test-project.git",
|
||||
"git_http_url": "https:\/\/gitlab.com\/jsmith\/some-test-project.git",
|
||||
"namespace": "jsmith",
|
||||
"visibility_level": 0,
|
||||
"path_with_namespace": "jsmith\/some-test-project",
|
||||
"default_branch": "master",
|
||||
"homepage": "https:\/\/gitlab.com\/jsmith\/some-test-project",
|
||||
"url": "git@gitlab.com:jsmith\/some-test-project.git",
|
||||
"ssh_url": "git@gitlab.com:jsmith\/some-test-project.git",
|
||||
"http_url": "https:\/\/gitlab.com\/jsmith\/some-test-project.git"
|
||||
},
|
||||
"commits": [
|
||||
{
|
||||
"id": "f00a0a6a71118721ac1f586bf79650170042609f",
|
||||
"message": "Add changelog",
|
||||
"timestamp": "2016-09-29T14:59:23+00:00",
|
||||
"url": "https:\/\/gitlab.com\/jsmith\/some-test-project\/commit\/f00a0a6a71118721ac1f586bf79650170042609f",
|
||||
"author": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"added": [
|
||||
"CHANGELOG"
|
||||
],
|
||||
"modified": [
|
||||
|
||||
],
|
||||
"removed": [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "cc66287314cb154c986665a6c29377ef42edee60",
|
||||
"message": "Add new file",
|
||||
"timestamp": "2016-09-29T15:02:01+00:00",
|
||||
"url": "https:\/\/gitlab.com\/jsmith\/some-test-project\/commit\/cc66287314cb154c986665a6c29377ef42edee60",
|
||||
"author": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"added": [
|
||||
"YetAnotherFIle"
|
||||
],
|
||||
"modified": [
|
||||
|
||||
],
|
||||
"removed": [
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "9a052a0b2fbe01d4a1a88638dd9fe31c1c56ef53",
|
||||
"message": "Merge branch 'foobar' into 'master'\r\n\r\nAdd changelog\r\n\r\nSome merge thing\r\n\r\nSee merge request !1",
|
||||
"timestamp": "2016-09-29T15:02:41+00:00",
|
||||
"url": "https:\/\/gitlab.com\/jsmith\/some-test-project\/commit\/9a052a0b2fbe01d4a1a88638dd9fe31c1c56ef53",
|
||||
"author": {
|
||||
"name": "John Smith",
|
||||
"email": "j@smith.com"
|
||||
},
|
||||
"added": [
|
||||
"CHANGELOG",
|
||||
"YetAnotherFIle"
|
||||
],
|
||||
"modified": [
|
||||
|
||||
],
|
||||
"removed": [
|
||||
|
||||
]
|
||||
}
|
||||
],
|
||||
"total_commits_count": 3,
|
||||
"repository": {
|
||||
"name": "some-test-project",
|
||||
"url": "git@gitlab.com:jsmith\/some-test-project.git",
|
||||
"description": "",
|
||||
"homepage": "https:\/\/gitlab.com\/jsmith\/some-test-project",
|
||||
"git_http_url": "https:\/\/gitlab.com\/jsmith\/some-test-project.git",
|
||||
"git_ssh_url": "git@gitlab.com:jsmith\/some-test-project.git",
|
||||
"visibility_level": 0
|
||||
}
|
||||
}
|
44
buildtrigger/test/triggerjson/gitlab_webhook_nocommit.json
Normal file
44
buildtrigger/test/triggerjson/gitlab_webhook_nocommit.json
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"object_kind": "push",
|
||||
"event_name": "push",
|
||||
"before": "cc66287314cb154c986665a6c29377ef42edee60",
|
||||
"after": "0000000000000000000000000000000000000000",
|
||||
"ref": "refs\/heads\/foobar",
|
||||
"checkout_sha": null,
|
||||
"message": null,
|
||||
"user_id": 750047,
|
||||
"user_name": "John Smith",
|
||||
"user_email": "j@smith.com",
|
||||
"user_avatar": "https:\/\/secure.gravatar.com\/avatar\/2348972348972348973?s=80&d=identicon",
|
||||
"project_id": 1756744,
|
||||
"project": {
|
||||
"name": "some-test-project",
|
||||
"description": "",
|
||||
"web_url": "https:\/\/gitlab.com\/jsmith\/some-test-project",
|
||||
"avatar_url": null,
|
||||
"git_ssh_url": "git@gitlab.com:jsmith\/some-test-project.git",
|
||||
"git_http_url": "https:\/\/gitlab.com\/jsmith\/some-test-project.git",
|
||||
"namespace": "jsmith",
|
||||
"visibility_level": 0,
|
||||
"path_with_namespace": "jsmith\/some-test-project",
|
||||
"default_branch": "master",
|
||||
"homepage": "https:\/\/gitlab.com\/jsmith\/some-test-project",
|
||||
"url": "git@gitlab.com:jsmith\/some-test-project.git",
|
||||
"ssh_url": "git@gitlab.com:jsmith\/some-test-project.git",
|
||||
"http_url": "https:\/\/gitlab.com\/jsmith\/some-test-project.git"
|
||||
},
|
||||
"commits": [
|
||||
|
||||
],
|
||||
"total_commits_count": 0,
|
||||
"repository": {
|
||||
"name": "some-test-project",
|
||||
"url": "git@gitlab.com:jsmith\/some-test-project.git",
|
||||
"description": "",
|
||||
"homepage": "https:\/\/gitlab.com\/jsmith\/some-test-project",
|
||||
"git_http_url": "https:\/\/gitlab.com\/jsmith\/some-test-project.git",
|
||||
"git_ssh_url": "git@gitlab.com:jsmith\/some-test-project.git",
|
||||
"visibility_level": 0
|
||||
}
|
||||
}
|
||||
|
14
buildtrigger/test/triggerjson/gitlab_webhook_other.json
Normal file
14
buildtrigger/test/triggerjson/gitlab_webhook_other.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"object_kind": "someother",
|
||||
"ref": "refs/tags/v1.0.0",
|
||||
"checkout_sha": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7",
|
||||
"repository":{
|
||||
"name": "Example",
|
||||
"url": "ssh://git@example.com/jsmith/example.git",
|
||||
"description": "",
|
||||
"homepage": "http://example.com/jsmith/example",
|
||||
"git_http_url":"http://example.com/jsmith/example.git",
|
||||
"git_ssh_url":"git@example.com:jsmith/example.git",
|
||||
"visibility_level":0
|
||||
}
|
||||
}
|
38
buildtrigger/test/triggerjson/gitlab_webhook_tag.json
Normal file
38
buildtrigger/test/triggerjson/gitlab_webhook_tag.json
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"object_kind": "tag_push",
|
||||
"before": "0000000000000000000000000000000000000000",
|
||||
"after": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7",
|
||||
"ref": "refs/tags/v1.0.0",
|
||||
"checkout_sha": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7",
|
||||
"user_id": 1,
|
||||
"user_name": "John Smith",
|
||||
"user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
|
||||
"project_id": 1,
|
||||
"project":{
|
||||
"name":"Example",
|
||||
"description":"",
|
||||
"web_url":"http://example.com/jsmith/example",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@example.com:jsmith/example.git",
|
||||
"git_http_url":"http://example.com/jsmith/example.git",
|
||||
"namespace":"Jsmith",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"jsmith/example",
|
||||
"default_branch":"master",
|
||||
"homepage":"http://example.com/jsmith/example",
|
||||
"url":"git@example.com:jsmith/example.git",
|
||||
"ssh_url":"git@example.com:jsmith/example.git",
|
||||
"http_url":"http://example.com/jsmith/example.git"
|
||||
},
|
||||
"repository":{
|
||||
"name": "Example",
|
||||
"url": "ssh://git@example.com/jsmith/example.git",
|
||||
"description": "",
|
||||
"homepage": "http://example.com/jsmith/example",
|
||||
"git_http_url":"http://example.com/jsmith/example.git",
|
||||
"git_ssh_url":"git@example.com:jsmith/example.git",
|
||||
"visibility_level":0
|
||||
},
|
||||
"commits": [],
|
||||
"total_commits_count": 0
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"after": "770830e7ca132856991e6db4f7fc0f4dbe20bd5f",
|
||||
"before": "0000000000000000000000000000000000000000",
|
||||
"checkout_sha": "770830e7ca132856991e6db4f7fc0f4dbe20bd5f",
|
||||
"commits": [
|
||||
{
|
||||
"added": [],
|
||||
"author": {
|
||||
"name": "Some User",
|
||||
"email": "some.user@someplace.com"
|
||||
},
|
||||
"id": "770830e7ca132856991e6db4f7fc0f4dbe20bd5f",
|
||||
"message": "Update Dockerfile",
|
||||
"modified": [
|
||||
"Dockerfile"
|
||||
],
|
||||
"removed": [],
|
||||
"timestamp": "2019-10-17T18:07:48Z",
|
||||
"url": "https://gitlab.com/someuser/some-test-project/commit/770830e7ca132856991e6db4f7fc0f4dbe20bd5f"
|
||||
}
|
||||
],
|
||||
"event_name": "tag_push",
|
||||
"message": "",
|
||||
"object_kind": "tag_push",
|
||||
"project": {
|
||||
"avatar_url": null,
|
||||
"ci_config_path": null,
|
||||
"default_branch": "master",
|
||||
"description": "Some test project",
|
||||
"git_http_url": "https://gitlab.com/someuser/some-test-project.git",
|
||||
"git_ssh_url": "git@gitlab.com:someuser/some-test-project.git",
|
||||
"homepage": "https://gitlab.com/someuser/some-test-project",
|
||||
"http_url": "https://gitlab.com/someuser/some-test-project.git",
|
||||
"id": 14838571,
|
||||
"name": "Some test project",
|
||||
"namespace": "Joey Schorr",
|
||||
"path_with_namespace": "someuser/some-test-project",
|
||||
"ssh_url": "git@gitlab.com:someuser/some-test-project.git",
|
||||
"url": "git@gitlab.com:someuser/some-test-project.git",
|
||||
"visibility_level": 0,
|
||||
"web_url": "https://gitlab.com/someuser/some-test-project"
|
||||
},
|
||||
"project_id": 14838571,
|
||||
"push_options": {},
|
||||
"ref": "refs/tags/thirdtag",
|
||||
"repository": {
|
||||
"description": "Some test project",
|
||||
"git_http_url": "https://gitlab.com/someuser/some-test-project.git",
|
||||
"git_ssh_url": "git@gitlab.com:someuser/some-test-project.git",
|
||||
"homepage": "https://gitlab.com/someuser/some-test-project",
|
||||
"name": "Some test project",
|
||||
"url": "git@gitlab.com:someuser/some-test-project.git",
|
||||
"visibility_level": 0
|
||||
},
|
||||
"total_commits_count": 1,
|
||||
"user_avatar": "https://secure.gravatar.com/avatar/someavatar?s=80&d=identicon",
|
||||
"user_email": "",
|
||||
"user_id": 4797254,
|
||||
"user_name": "Some User",
|
||||
"user_username": "someuser"
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"object_kind": "tag_push",
|
||||
"before": "0000000000000000000000000000000000000000",
|
||||
"after": "82b3d5ae55f7080f1e6022629cdb57bfae7cccc7",
|
||||
"ref": "refs/tags/v1.0.0",
|
||||
"checkout_sha": null,
|
||||
"user_id": 1,
|
||||
"user_name": "John Smith",
|
||||
"user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
|
||||
"project_id": 1,
|
||||
"project":{
|
||||
"name":"Example",
|
||||
"description":"",
|
||||
"web_url":"http://example.com/jsmith/example",
|
||||
"avatar_url":null,
|
||||
"git_ssh_url":"git@example.com:jsmith/example.git",
|
||||
"git_http_url":"http://example.com/jsmith/example.git",
|
||||
"namespace":"Jsmith",
|
||||
"visibility_level":0,
|
||||
"path_with_namespace":"jsmith/example",
|
||||
"default_branch":"master",
|
||||
"homepage":"http://example.com/jsmith/example",
|
||||
"url":"git@example.com:jsmith/example.git",
|
||||
"ssh_url":"git@example.com:jsmith/example.git",
|
||||
"http_url":"http://example.com/jsmith/example.git"
|
||||
},
|
||||
"repository":{
|
||||
"name": "Example",
|
||||
"url": "ssh://git@example.com/jsmith/example.git",
|
||||
"description": "",
|
||||
"homepage": "http://example.com/jsmith/example",
|
||||
"git_http_url":"http://example.com/jsmith/example.git",
|
||||
"git_ssh_url":"git@example.com:jsmith/example.git",
|
||||
"visibility_level":0
|
||||
},
|
||||
"commits": [],
|
||||
"total_commits_count": 0
|
||||
}
|
Reference in a new issue