mirror of https://git.sr.ht/~sircmpwn/hub.sr.ht
hubsrht: Use repository visibility for builds
This commit is contained in:
parent
f362bd8835
commit
c4e50c633e
|
@ -107,7 +107,8 @@ git am -3 /tmp/{payload["id"]}.patch"""
|
|||
}))
|
||||
|
||||
b = builds.submit_build(project.owner, manifest, build_note,
|
||||
tags=[repo.name, "patches", key], execute=False, valid=valid)
|
||||
tags=[repo.name, "patches", key], execute=False, valid=valid,
|
||||
visibility=repo.visibility)
|
||||
ids.append(b["id"])
|
||||
build_url = f"{buildsrht}/{project.owner.canonical_name}/job/{b['id']}"
|
||||
lists.patchset_update_tool(ml.owner, tool_id, "WAITING",
|
||||
|
|
|
@ -572,14 +572,40 @@ class TodoService(SrhtService):
|
|||
self.put(user, None, url, payload)
|
||||
|
||||
class BuildService(SrhtService):
|
||||
def submit_build(self, user, manifest, note, tags, execute=True, valid=None):
|
||||
return self.post(user, valid, f"{_buildsrht}/api/jobs", {
|
||||
"manifest": yaml.dump(manifest.to_dict(), default_flow_style=False),
|
||||
"tags": tags,
|
||||
"note": note,
|
||||
"secrets": False,
|
||||
"execute": execute,
|
||||
def submit_build(self, user, manifest, note, tags, execute=True, valid=None, visibility=None):
|
||||
query = """
|
||||
mutation SubmitBuild(
|
||||
$manifest: String!,
|
||||
$note: String,
|
||||
$tags: [String!],
|
||||
$secrets: Boolean,
|
||||
$execute: Boolean,
|
||||
$visibility: Visibility,
|
||||
) {
|
||||
submit(
|
||||
manifest: $manifest,
|
||||
note: $note,
|
||||
tags: $tags,
|
||||
secrets: $secrets,
|
||||
execute: $execute,
|
||||
visibility: $visibility,
|
||||
) {
|
||||
id
|
||||
}
|
||||
}
|
||||
"""
|
||||
r = self.post(user, valid, f"{_buildsrht_api}/query", {
|
||||
"query": query,
|
||||
"variables": {
|
||||
"manifest": yaml.dump(manifest.to_dict(), default_flow_style=False),
|
||||
"tags": tags,
|
||||
"note": note,
|
||||
"secrets": False,
|
||||
"execute": execute,
|
||||
"visibility": visibility.value if visibility else None,
|
||||
},
|
||||
})
|
||||
return r["data"]["submit"]
|
||||
|
||||
def create_group(self, user, job_ids, note, triggers, valid=None):
|
||||
return self.post(user, valid, f"{_buildsrht}/api/job-group", {
|
||||
|
|
Loading…
Reference in New Issue