add webhook password
This commit is contained in:
parent
d847415a41
commit
afb9fe2235
|
@ -4,14 +4,11 @@ import requests
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
token = "abc"
|
||||||
request_data = {
|
request_data = {
|
||||||
"project": "testproject",
|
"project": "testproject",
|
||||||
"comments": "testcomment",
|
"comments": "testcomment",
|
||||||
}
|
}
|
||||||
request_headers = {
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
"Accept": "text/plain",
|
|
||||||
}
|
|
||||||
|
|
||||||
ty = "/change_hook/base"
|
ty = "/change_hook/base"
|
||||||
path =".buildbot"
|
path =".buildbot"
|
||||||
|
@ -97,10 +94,15 @@ def _get_dockerfile_contents(jobname):
|
||||||
return res + dockerfile_extra_contents[os_codename]
|
return res + dockerfile_extra_contents[os_codename]
|
||||||
|
|
||||||
|
|
||||||
def trigger_child_hooks(buildbotUrl: str, repository, branch, directory=".buildbot"):
|
def trigger_child_hooks(buildbotUrl: str, repository, branch, directory=".buildbot", secret):
|
||||||
request_url = buildbotUrl + ty
|
request_url = buildbotUrl + ty
|
||||||
# List all jobs in the directory
|
# List all jobs in the directory
|
||||||
jobs = list_jobs(directory)
|
jobs = list_jobs(directory)
|
||||||
|
request_headers = {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
'Authorization': f'token {secret}',
|
||||||
|
"Accept": "text/plain",
|
||||||
|
}
|
||||||
|
|
||||||
# Check if build.sh or test.sh exists in each of the jobs
|
# Check if build.sh or test.sh exists in each of the jobs
|
||||||
for job in jobs:
|
for job in jobs:
|
||||||
|
@ -122,4 +124,5 @@ def trigger_child_hooks(buildbotUrl: str, repository, branch, directory=".buildb
|
||||||
"branch": branch,
|
"branch": branch,
|
||||||
"jobname": job,
|
"jobname": job,
|
||||||
}
|
}
|
||||||
|
|
||||||
requests.post(request_url, headers=request_headers, data=request_data)
|
requests.post(request_url, headers=request_headers, data=request_data)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user