Skip to content

Commit 017eec2

Browse files
committed
[ISV-1429] Enhance Operator pipeline logs
1 parent 3b6deba commit 017eec2

File tree

6 files changed

+26
-2
lines changed

6 files changed

+26
-2
lines changed

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-ci-pipeline.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,8 @@ spec:
484484
- name: pyxis_url
485485
value: "$(tasks.set-env.results.pyxis_url)"
486486
- name: pipeline_name
487+
value: "$(context.pipeline.name)"
488+
- name: pipelinerun_name
487489
value: "$(context.pipelineRun.name)"
488490
- name: pyxis_api_key_secret_name
489491
value: "$(params.pyxis_api_key_secret_name)"

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-hosted-pipeline.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,11 +893,15 @@ spec:
893893
value: "$(tasks.certification-project-check.results.certification_project_id)"
894894
- name: bundle_version
895895
value: "$(tasks.validate-pr-title.results.bundle_version)"
896+
- name: git_pr_url
897+
value: $(params.git_pr_url)
896898
- name: package_name
897899
value: "$(tasks.validate-pr-title.results.operator_name)"
898900
- name: pyxis_url
899901
value: "$(tasks.set-env.results.pyxis_url)"
900902
- name: pipeline_name
903+
value: "$(context.pipeline.name)"
904+
- name: pipelinerun_name
901905
value: "$(context.pipelineRun.name)"
902906
- name: pyxis_ssl_secret_name
903907
value: "$(params.pyxis_ssl_secret_name)"

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-release-pipeline.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,15 @@ spec:
527527
value: "$(tasks.certification-project-check.results.certification_project_id)"
528528
- name: bundle_version
529529
value: "$(tasks.bundle-path-validation.results.bundle_version)"
530+
- name: git_pr_url
531+
value: $(params.git_pr_url)
530532
- name: package_name
531533
value: "$(tasks.bundle-path-validation.results.package_name)"
532534
- name: pyxis_url
533535
value: "$(tasks.set-env.results.pyxis_url)"
534536
- name: pipeline_name
537+
value: "$(context.pipeline.name)"
538+
- name: pipelinerun_name
535539
value: "$(context.pipelineRun.name)"
536540
- name: pyxis_ssl_secret_name
537541
value: "$(params.pyxis_ssl_secret_name)"

ansible/roles/operator-pipeline/templates/openshift/tasks/upload-pipeline-logs.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ spec:
3333
- name: package_name
3434
description: Operator package name
3535
- name: pipeline_name
36+
description: Tekton pipeline name to identify which pipeline the logs are coming from
37+
- name: pipelinerun_name
3638
description: Tekton pipeline run name where logs will be gathered from
39+
- name: git_pr_url
40+
description: URL to the pull request associated with the pipeline run
41+
default: ""
3742
results:
3843
- name: pipeline_log_url
3944
workspaces:
@@ -52,7 +57,7 @@ spec:
5257
5358
echo "Getting pipeline logs"
5459
55-
tkn pipelinerun logs "$(params.pipeline_name)" > $(workspaces.source.path)/pipeline.logs
60+
tkn pipelinerun logs "$(params.pipelinerun_name)" > $(workspaces.source.path)/$(params.pipeline_name).log
5661
5762
- name: upload-pipeline-logs
5863
image: "$(params.pipeline_image)"
@@ -81,8 +86,9 @@ spec:
8186
--operator-version "$(params.bundle_version)" \
8287
--operator-package-name "$(params.package_name)" \
8388
--certification-hash "$(params.md5sum)" \
89+
--pull-request-url "$(params.git_pr_url)" \
8490
--pyxis-url "$(params.pyxis_url)" \
85-
--path $(workspaces.source.path)/pipeline.logs \
91+
--path $(workspaces.source.path)/$(params.pipeline_name).log \
8692
--type pipeline-logs \
8793
--output pipeline-logs-artifact.json \
8894
--verbose

operator-pipeline-images/operatorcert/entrypoints/upload_artifacts.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ def setup_argparser() -> Any: # pragma: no cover
3838
)
3939
parser.add_argument("--operator-version", help="Operator version", required=True)
4040
parser.add_argument("--path", help="Path to artifact", required=True)
41+
parser.add_argument(
42+
"--pull-request-url",
43+
help="URL to the pull request associated with the cert project.",
44+
)
4145
parser.add_argument(
4246
"--type",
4347
choices=[
@@ -113,6 +117,8 @@ def upload_artifact(args: Any, file_path: str, org_id: Any = None) -> Dict[str,
113117
}
114118
if org_id:
115119
artifact_payload["org_id"] = org_id
120+
if args.pull_request_url:
121+
artifact_payload["pull_request_url"] = args.pull_request_url
116122
return pyxis.post(upload_url, artifact_payload)
117123

118124

operator-pipeline-images/tests/entrypoints/test_upload_artifacts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def test_upload_artifact(mock_post: MagicMock, mock_b64) -> None:
2323
args.operator_package_name = "foo"
2424
args.operator_version = "1.0"
2525
args.cert_project_id = "123123"
26+
args.pull_request_url = "http://bar.com/"
2627

2728
mock_b64.return_value = b"a"
2829
filename = "operator-pipeline-images/tests/data/preflight.log"
@@ -39,6 +40,7 @@ def test_upload_artifact(mock_post: MagicMock, mock_b64) -> None:
3940
"operator_package_name": args.operator_package_name,
4041
"version": args.operator_version,
4142
"org_id": 1,
43+
"pull_request_url": args.pull_request_url,
4244
},
4345
)
4446

0 commit comments

Comments
 (0)