Skip to content

Commit

Permalink
Merge pull request #210 from umccr/enhancement/try-catch-json-output
Browse files Browse the repository at this point in the history
  • Loading branch information
alexiswl authored Oct 23, 2023
2 parents 259dcab + 67bd4e0 commit d445b72
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion subcommands/github_actions/build_workflow_release_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import os
import re
from argparse import ArgumentError
from json import JSONDecodeError
from tempfile import TemporaryDirectory
from urllib.parse import urldefrag
from zipfile import ZipFile
Expand Down Expand Up @@ -1014,9 +1015,19 @@ def create_and_commit_v2_bundles(self):
if not create_cwl_workflow_from_github_release_returncode == 0:
logger.error(f"{create_cwl_workflow_from_github_release_stdout}")
logger.error(f"{create_cwl_workflow_from_github_release_stderr}")
raise ChildProcessError

# Collect pipeline
pipeline_id = json.loads(create_cwl_workflow_from_github_release_stdout)["pipeline_id"]
try:
pipeline_id_json_dict = json.loads(create_cwl_workflow_from_github_release_stdout)
except JSONDecodeError:
logger.error(f"Could not get release from {create_cwl_workflow_from_github_release_stdout}")
raise JSONDecodeError

if 'pipeline_id' not in pipeline_id_json_dict:
logger.error(f"Could not get pipeline id key {pipeline_id_json_dict}")
raise KeyError
pipeline_id = pipeline_id_json_dict.get("pipeline_id")

# Release pipeline
release_pipeline_command = release_pipeline_command_prefix + [pipeline_id]
Expand All @@ -1032,6 +1043,7 @@ def create_and_commit_v2_bundles(self):
if not release_pipeline_returncode == 0:
logger.error(f"{release_pipeline_stdout}")
logger.error(f"{release_pipeline_stderr}")
raise ChildProcessError

# Update pipeline list
pipeline_ids_by_project_by_tenant[tenant_name][pipeline_project_id] = pipeline_id
Expand Down

0 comments on commit d445b72

Please sign in to comment.