Changeset View
Changeset View
Standalone View
Standalone View
contrib/buildbot/server.py
Show First 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | def build_diff(): | ||||
create_server.diff_targets[target_phid] = build_target | create_server.diff_targets[target_phid] = build_target | ||||
return SUCCESS, 200 | return SUCCESS, 200 | ||||
@app.route("/land", methods=['POST']) | @app.route("/land", methods=['POST']) | ||||
def land(): | def land(): | ||||
data = get_json_request_data(request) | data = get_json_request_data(request) | ||||
revision = data['revision'] | revision = data.get('revision', None) | ||||
if not revision: | diff = data.get('diff', None) | ||||
if not revision and not diff: | |||||
return FAILURE, 400 | |||||
commitMessage = data.get('commitMessage', None) | |||||
if diff and not commitMessage: | |||||
return FAILURE, 400 | return FAILURE, 400 | ||||
# conduitToken is expected to be encrypted and will be decrypted by the | # conduitToken is expected to be encrypted and will be decrypted by the | ||||
# land bot. | # land bot. | ||||
conduitToken = data['conduitToken'] | conduitToken = data.get('conduitToken', None) | ||||
if not conduitToken: | if not conduitToken: | ||||
return FAILURE, 400 | return FAILURE, 400 | ||||
committerName = data['committerName'] | committerName = data.get('committerName', None) | ||||
if not committerName: | if not committerName: | ||||
return FAILURE, 400 | return FAILURE, 400 | ||||
committerEmail = data['committerEmail'] | committerEmail = data.get('committerEmail', None) | ||||
if not committerEmail: | if not committerEmail: | ||||
return FAILURE, 400 | return FAILURE, 400 | ||||
properties = [{ | properties = [{ | ||||
'name': 'env.ABC_REVISION', | |||||
'value': revision, | |||||
}, { | |||||
'name': 'env.ABC_CONDUIT_TOKEN', | 'name': 'env.ABC_CONDUIT_TOKEN', | ||||
'value': conduitToken, | 'value': conduitToken, | ||||
}, { | }, { | ||||
'name': 'env.ABC_COMMITTER_NAME', | 'name': 'env.ABC_COMMITTER_NAME', | ||||
'value': committerName, | 'value': committerName, | ||||
}, { | }, { | ||||
'name': 'env.ABC_COMMITTER_EMAIL', | 'name': 'env.ABC_COMMITTER_EMAIL', | ||||
'value': committerEmail, | 'value': committerEmail, | ||||
}] | }] | ||||
if revision: | |||||
properties += [{ | |||||
'name': 'env.ABC_REVISION', | |||||
'value': revision, | |||||
}] | |||||
if diff: | |||||
properties += [{ | |||||
'name': 'env.ABC_DIFF', | |||||
'value': diff, | |||||
}, { | |||||
'name': 'env.ABC_COMMIT_MESSAGE', | |||||
'value': commitMessage, | |||||
}] | |||||
output = tc.trigger_build( | output = tc.trigger_build( | ||||
LANDBOT_BUILD_TYPE, | LANDBOT_BUILD_TYPE, | ||||
'master', | 'master', | ||||
UNRESOLVED, | UNRESOLVED, | ||||
properties) | properties) | ||||
if output: | if output: | ||||
return output | return output | ||||
return FAILURE, 500 | return FAILURE, 500 | ||||
▲ Show 20 Lines • Show All 611 Lines • Show Last 20 Lines |