This is an automated email from the ASF dual-hosted git repository.
arm pushed a commit to branch gha-distributions
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/gha-distributions by this push:
new 8f9c280 Specify workflow name based on platform - we'll kick off the
right one
8f9c280 is described below
commit 8f9c2809fd2e2fbd0ab6cd8d5ddce45352f3e850
Author: Alastair McFarlane <[email protected]>
AuthorDate: Thu Jan 8 16:16:50 2026 +0000
Specify workflow name based on platform - we'll kick off the right one
---
atr/models/sql.py | 8 ++++++++
atr/post/distribution.py | 2 ++
atr/storage/writers/distributions.py | 2 ++
atr/tasks/gha.py | 12 ++++++------
4 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/atr/models/sql.py b/atr/models/sql.py
index 880b202..958e098 100644
--- a/atr/models/sql.py
+++ b/atr/models/sql.py
@@ -53,6 +53,7 @@ sqlmodel.SQLModel.metadata = sqlalchemy.MetaData(
@dataclasses.dataclass(frozen=True)
class DistributionPlatformValue:
name: str
+ gh_slug: str
template_url: str
template_staging_url: str | None = None
requires_owner_namespace: bool = False
@@ -95,12 +96,14 @@ class CheckResultStatusIgnore(str, enum.Enum):
class DistributionPlatform(enum.Enum):
ARTIFACT_HUB = DistributionPlatformValue(
name="Artifact Hub",
+ gh_slug="artifacthub",
template_url="https://artifacthub.io/api/v1/packages/helm/{owner_namespace}/{package}/{version}",
template_staging_url="https://staging.artifacthub.io/api/v1/packages/helm/{owner_namespace}/{package}/{version}",
requires_owner_namespace=True,
)
DOCKER_HUB = DistributionPlatformValue(
name="Docker Hub",
+ gh_slug="dockerhub",
template_url="https://hub.docker.com/v2/namespaces/{owner_namespace}/repositories/{package}/tags/{version}",
# TODO: Need to use staging tags?
#
template_staging_url="https://hub.docker.com/v2/namespaces/{owner_namespace}/repositories/{package}/tags/{version}",
@@ -108,6 +111,7 @@ class DistributionPlatform(enum.Enum):
)
# GITHUB = DistributionPlatformValue(
# name="GitHub",
+ # gh_slug="github",
#
template_url="https://api.github.com/repos/{owner_namespace}/{package}/releases/tags/v{version}",
# # Combine with {"prerelease": true}
#
template_staging_url="https://api.github.com/repos/{owner_namespace}/{package}/releases",
@@ -115,6 +119,7 @@ class DistributionPlatform(enum.Enum):
# )
MAVEN = DistributionPlatformValue(
name="Maven Central",
+ gh_slug="maven",
template_url="https://search.maven.org/solrsearch/select?q=g:{owner_namespace}+AND+a:{package}+AND+v:{version}&core=gav&rows=20&wt=json",
# Java ASF projects use staging URLs along the lines of
#
https://repository.apache.org/content/repositories/orgapachePROJECT-NNNN/
@@ -123,17 +128,20 @@ class DistributionPlatform(enum.Enum):
)
NPM = DistributionPlatformValue(
name="npm",
+ gh_slug="npm",
# TODO: Need to parse dist-tags
template_url="https://registry.npmjs.org/{package}",
)
NPM_SCOPED = DistributionPlatformValue(
name="npm (scoped)",
+ gh_slug="npm",
# TODO: Need to parse dist-tags
template_url="https://registry.npmjs.org/@{owner_namespace}/{package}",
requires_owner_namespace=True,
)
PYPI = DistributionPlatformValue(
name="PyPI",
+ gh_slug="pypi",
template_url="https://pypi.org/pypi/{package}/{version}/json",
template_staging_url="https://test.pypi.org/pypi/{package}/{version}/json",
)
diff --git a/atr/post/distribution.py b/atr/post/distribution.py
index 88fb5f1..c5f3428 100644
--- a/atr/post/distribution.py
+++ b/atr/post/distribution.py
@@ -98,6 +98,7 @@ async def automate_form_process_page(
error="Project does not have a release policy configured, or no
GitHub repository is specified",
)
repo = release.release_policy.github_repository_name
+ workflow = f"distribute-{sql_platform.value.gh_slug}.yml"
async with
storage.write_as_committee_member(committee_name=committee.name) as w:
try:
await w.distributions.automate(
@@ -106,6 +107,7 @@ async def automate_form_process_page(
dd.owner_namespace,
"apache",
repo,
+ workflow,
project,
version,
release.latest_revision_number,
diff --git a/atr/storage/writers/distributions.py
b/atr/storage/writers/distributions.py
index 91839f8..753264f 100644
--- a/atr/storage/writers/distributions.py
+++ b/atr/storage/writers/distributions.py
@@ -104,6 +104,7 @@ class CommitteeMember(CommitteeParticipant):
owner_namespace: str | None,
owner: str,
repo: str,
+ workflow: str,
project_name: str,
version_name: str,
revision_number: str | None,
@@ -124,6 +125,7 @@ class CommitteeMember(CommitteeParticipant):
owner=owner,
repo=repo,
ref="main", # TODO: Un-hardcode
+ workflow=workflow,
arguments={},
).model_dump(),
asf_uid=util.unwrap(self.__asf_uid),
diff --git a/atr/tasks/gha.py b/atr/tasks/gha.py
index cd9a458..00dde60 100644
--- a/atr/tasks/gha.py
+++ b/atr/tasks/gha.py
@@ -46,6 +46,7 @@ class DistributionWorkflow(schema.Strict):
owner: str = schema.description("Github owner of the repository")
repo: str = schema.description("Repository in which to start the workflow")
ref: str = schema.description("Git ref to trigger the workflow")
+ workflow: str = schema.description("Workflow to trigger")
namespace: str = schema.description("Namespace to distribute to")
package: str = schema.description("Package to distribute")
version: str = schema.description("Version to distribute")
@@ -59,7 +60,6 @@ class DistributionWorkflow(schema.Strict):
@checks.with_model(DistributionWorkflow)
async def trigger_workflow(args: DistributionWorkflow) -> results.Results |
None:
unique_id = f"{args.name}-{uuid.uuid4()}"
- workflow_id = "distribute-test.yml"
# release, committee = await
shared.distribution.release_validated_and_committee(
# args.project,
# args.version,
@@ -81,14 +81,14 @@ async def trigger_workflow(args: DistributionWorkflow) ->
results.Results | None
}
headers = {"Accept": "application/vnd.github+json", "Authorization":
f"Bearer {config.get().GITHUB_TOKEN}"}
log.info(
- f"Triggering Github workflow {args.owner}/{args.repo}/{workflow_id}
with args: {
+ f"Triggering Github workflow {args.owner}/{args.repo}/{args.workflow}
with args: {
json.dumps(args.arguments, indent=2)
}"
)
async with aiohttp.ClientSession() as session:
try:
async with session.post(
-
f"{_BASE_URL}/{args.owner}/{args.repo}/actions/workflows/{workflow_id}/dispatches",
+
f"{_BASE_URL}/{args.owner}/{args.repo}/actions/workflows/{args.workflow}/dispatches",
headers=headers,
json=payload,
) as response:
@@ -102,9 +102,9 @@ async def trigger_workflow(args: DistributionWorkflow) ->
results.Results | None
run = await _wait_for_completion(session, args, headers, run_id,
unique_id)
if run.get("status") in _FAILED_STATUSES:
- _fail(f"Github workflow {args.owner}/{args.repo}/{workflow_id} run
{run_id} failed with error")
+ _fail(f"Github workflow {args.owner}/{args.repo}/{args.workflow}
run {run_id} failed with error")
if run.get("status") in _COMPLETED_STATUSES:
- log.info(f"Workflow {args.owner}/{args.repo}/{workflow_id} run
{run_id} completed successfully")
+ log.info(f"Workflow {args.owner}/{args.repo}/{args.workflow} run
{run_id} completed successfully")
await _record_distribution(
"committee.name",
"release",
@@ -117,7 +117,7 @@ async def trigger_workflow(args: DistributionWorkflow) ->
results.Results | None
return results.DistributionWorkflow(
kind="distribution_workflow", name=args.name, run_id=run_id,
url=run.get("html_url", "")
)
- _fail(f"Timed out waiting for GitHub workflow
{args.owner}/{args.repo}/{workflow_id}")
+ _fail(f"Timed out waiting for GitHub workflow
{args.owner}/{args.repo}/{args.workflow}")
async def _record_distribution(
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]