Skip to content

Commit

Permalink
revert to output json
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad committed Sep 4, 2023
1 parent 26b234e commit f8a4475
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions build-system/scripts/generate_circleci_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def get_already_built_circleci_job_names(circleci_jobs):
# Helper for multiprocessing
def _get_already_built_manifest_job_names(manifest_name):
content_hash = subprocess.check_output(['calculate_content_hash', manifest_name]).decode("utf-8")
subprocess.check_call(["ensure_repo", manifest_name])
completed = subprocess.run(["check_rebuild", f"cache-{content_hash}", manifest_name], stdout=subprocess.DEVNULL)
if completed.returncode == 0:
return manifest_name
Expand Down Expand Up @@ -75,7 +74,7 @@ def remove_jobs_from_workflow(jobs, to_remove):
# The CircleCI workflow as a JSON string (Replace this with your actual workflow)

# Convert the JSON string to a Python dictionary
workflow_dict = yaml.load('.circleci/config.yml')
workflow_dict = yaml.safe_load(open('.circleci/config.yml'))

# # List of jobs to remove
jobs_to_remove = list(get_already_built_circleci_job_names(workflow_dict["jobs"]))
Expand All @@ -87,5 +86,5 @@ def remove_jobs_from_workflow(jobs, to_remove):
workflow_dict["workflows"]["system"]["jobs"] = remove_jobs_from_workflow(workflow_dict["workflows"]["system"]["jobs"], jobs_to_remove)
workflow_dict["workflows"]["system"]["when"] = {"equal":["system","<< pipeline.parameters.workflow >>"]}
# Convert the new workflow back to JSON string
new_workflow_json_str = yaml.dumps(workflow_dict, indent=2)
new_workflow_json_str = json.dumps(workflow_dict, indent=2)
print(new_workflow_json_str)

0 comments on commit f8a4475

Please sign in to comment.