Build list of required jobs in generate-workflow (#4326)

* Build list of required jobs in generate-workflow

Dump the list of all the jobs in the same format that is required for
configuration in opentelemetry-admin terraform config files so that
we don't miss required jobs.

* Serialize also misc jobs

* Document what this script is about
This commit is contained in:
Riccardo Magliocchetti
2026-03-12 14:59:20 +01:00
committed by GitHub
parent 78c948b15f
commit 22879d6b9f
3 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
"""
This script builds a text file with the list of required checks based on
the tox environments. Similarly to the system we are using to build the
github workflows.
The output is in the format than can be cut-and-pasted into the python-contrib
terraform configuration in the admin repository.
"""
from pathlib import Path
from generate_workflows_lib import (
get_lint_job_datas,
get_misc_job_datas,
get_test_job_datas,
get_tox_envs,
)
tox_ini_path = Path(__file__).parent.parent.parent.joinpath("tox.ini")
def get_gh_contexts_from_jobs(job_datas):
def get_job_name(job):
if isinstance(job, str):
return job
return job["ui_name"]
return [
f""" {{ context = "{get_job_name(job)}" }},\n"""
for job in job_datas
]
jobs = sorted(
get_gh_contexts_from_jobs(get_lint_job_datas(get_tox_envs(tox_ini_path)))
+ get_gh_contexts_from_jobs(
get_test_job_datas(get_tox_envs(tox_ini_path), ["ubuntu-latest"])
)
+ get_gh_contexts_from_jobs(get_misc_job_datas(get_tox_envs(tox_ini_path)))
)
with open("opentelemetry-admin-jobs.txt", "w") as f:
for job in jobs:
f.write(job)

3
.gitignore vendored
View File

@@ -61,3 +61,6 @@ target
# Benchmark result files
*-benchmark.json
# opentelemetry-admin jobs
opentelemetry-admin-jobs.txt

View File

@@ -1117,6 +1117,7 @@ deps =
commands =
python {toxinidir}/.github/workflows/generate_workflows.py
python {toxinidir}/.github/workflows/generate_required_checks.py
[testenv:shellcheck]