Skip to content

Commit

Permalink
TEST: job completed
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Aug 4, 2023
1 parent adff88e commit b14ec61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions baldrick/blueprints/circleci.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def circleci_new_handler():
logger.debug(f"Got {pformat(payload)} on /circleci/v2")
# Validate we have the keys we need, otherwise ignore the push
required_keys = {
'workflow',
'job',
'pipeline',
}

Expand Down Expand Up @@ -104,8 +104,8 @@ def circleci_new_handler():
"v2",
payload,
request.headers,
payload["workflow"].get("status"),
payload["job"].get("status"),
vcs["revision"],
payload["pipeline"]["number"])
payload["job"]["number"])

return "CirleCI Webhook Finished"
7 changes: 5 additions & 2 deletions baldrick/plugins/circleci_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

@circleci_webhook_handler
def set_commit_status_for_artifacts(repo_handler, webhook_version, payload, headers, status, revision, build_number):
if webhook_version == "v2" and payload.get("type") != "workflow-completed":
logger.debug("Ignoring not 'workflow-completed' webhook.")
if webhook_version == "v2" and payload.get("type") != "job-completed":
msg = "Ignoring not 'job-completed' webhook."
logger.debug(msg)
return

ci_config = repo_handler.get_config_value("circleci_artifacts", {})
if not ci_config.get("enabled", False):
Expand Down Expand Up @@ -43,6 +45,7 @@ def set_commit_status_for_artifacts(repo_handler, webhook_version, payload, head
def get_artifacts_from_build(repo, build_num): # pragma: no cover
base_url = "https://circleci.com/api/v1.1"
query_url = f"{base_url}/project/github/{repo}/{build_num}/artifacts"
logger.debug(f"Getting build {query_url}")
response = requests.get(query_url)
assert response.ok, response.content
return response.json()
Expand Down

0 comments on commit b14ec61

Please sign in to comment.