add webhook password
This commit is contained in:
parent
d847415a41
commit
afb9fe2235
|
@ -4,14 +4,11 @@ import requests
|
|||
import re
|
||||
|
||||
|
||||
token = "abc"
|
||||
request_data = {
|
||||
"project": "testproject",
|
||||
"comments": "testcomment",
|
||||
}
|
||||
request_headers = {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept": "text/plain",
|
||||
}
|
||||
|
||||
ty = "/change_hook/base"
|
||||
path =".buildbot"
|
||||
|
@ -97,10 +94,15 @@ def _get_dockerfile_contents(jobname):
|
|||
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
|
||||
# List all jobs in the 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
|
||||
for job in jobs:
|
||||
|
@ -122,4 +124,5 @@ def trigger_child_hooks(buildbotUrl: str, repository, branch, directory=".buildb
|
|||
"branch": branch,
|
||||
"jobname": job,
|
||||
}
|
||||
|
||||
requests.post(request_url, headers=request_headers, data=request_data)
|
||||
|
|
Loading…
Reference in New Issue