TT#86202 release_dashboard: add username parameter on trigger_hotfix

Change-Id: I8a22ba8c42bdda16010488e0eb3872bdae45a83d
changes/35/41935/1
Victor Seva 5 years ago
parent 0eafac88ff
commit b006bb4fb4

@ -33,7 +33,7 @@ hotfix_url = (
"{base}/job/release-tools-runner/buildWithParameters?"
"token={token}&action={action}&branch={branch}&"
"PROJECTNAME={project}&repository={project}&"
"push={push}&uuid={uuid}"
"push={push}&uuid={uuid}&remote_user={user}"
)
@ -45,7 +45,7 @@ def get_response(url):
return response
def trigger_hotfix(project, branch, push="yes"):
def trigger_hotfix(project, branch, user, push="yes"):
flow_uuid = uuid.uuid4()
params = {
"base": settings.JENKINS_URL,
@ -55,12 +55,12 @@ def trigger_hotfix(project, branch, push="yes"):
"project": urllib.parse.quote(project),
"push": urllib.parse.quote(push),
"uuid": flow_uuid,
"user": user.username,
}
url = hotfix_url.format(**params)
if settings.DEBUG:
logger.debug("Debug mode, would trigger: %s", url)
# raise Exception("debug error")
logger.warn("Debug mode, would trigger: %s", url)
else:
openurl(url)
return "%s/job/release-tools-runner/" % settings.JENKINS_URL

@ -109,7 +109,9 @@ def hotfix_build(request, branch, project):
json_data = json.loads(request.body.decode("utf-8"))
if json_data["push"] == "no":
logger.warn("dryrun for %s:%s", project, branch)
url = build.trigger_hotfix(project, branch, json_data["push"])
url = build.trigger_hotfix(
project, branch, request.user, json_data["push"]
)
return JsonResponse({"url": url})

Loading…
Cancel
Save