Skip to content

Commit

Permalink
finally results are referenced differently
Browse files Browse the repository at this point in the history
* STONEBLD-2192

Signed-off-by: Robert Cerven <[email protected]>
  • Loading branch information
rcerven committed Mar 1, 2024
1 parent 14c34f7 commit b5e3a57
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion atomic_reactor/plugins/gather_builds_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import json
from typing import Any, Dict, Optional

from atomic_reactor.plugin import Plugin
Expand Down Expand Up @@ -110,7 +111,7 @@ def _get_build_metadata(self, platform: str):
"""
pullspec_image = self._determine_image_pullspec(platform)
buildroot = get_buildroot(platform)
build_host = self._get_hostname_for_platform(platform)
build_host = json.loads(self._get_hostname_for_platform(platform))
output_files, _ = get_output(workflow=self.workflow, buildroot_id=build_host,
pullspec=pullspec_image, platform=platform,
source_build=False)
Expand Down
2 changes: 1 addition & 1 deletion requirements-devel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ opentelemetry-semantic-conventions==0.40b0
# opentelemetry-sdk
opentelemetry-util-http==0.40b0
# via opentelemetry-instrumentation-requests
osbs-client @ git+https://github.com/containerbuildsystem/osbs-client@2bd03f4e0e5edc474b6236c5c128620d988f79a3
osbs-client @ git+https://github.com/rcerven/osbs-client@5601822bfe7af6f42e0434c6256dcd4e5816c5a7
# via -r requirements.in
otel-extensions==0.2.5
# via -r otel-requirements.in
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jsonschema
paramiko>=2.10.1
PyYAML
ruamel.yaml
git+https://github.com/containerbuildsystem/osbs-client@2bd03f4e0e5edc474b6236c5c128620d988f79a3#egg=osbs-client
git+https://github.com/rcerven/osbs-client@5601822bfe7af6f42e0434c6256dcd4e5816c5a7#egg=osbs-client
# cannot build cryptography with rust for version >= 3.5
cryptography < 3.5
requests
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ opentelemetry-semantic-conventions==0.41b0
# opentelemetry-sdk
opentelemetry-util-http==0.41b0
# via opentelemetry-instrumentation-requests
osbs-client @ git+https://github.com/containerbuildsystem/osbs-client@2bd03f4e0e5edc474b6236c5c128620d988f79a3
osbs-client @ git+https://github.com/rcerven/osbs-client@5601822bfe7af6f42e0434c6256dcd4e5816c5a7
# via -r requirements.in
otel-extensions==0.2.5
# via -r otel-requirements.in
Expand Down
2 changes: 1 addition & 1 deletion tekton/pipelines/binary-container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
- name: platforms_result
value: $(tasks.binary-container-prebuild.results.platforms_result)
- name: annotations
value: $(tasks.binary-container-exit.results.annotations)
value: $(finally.binary-container-exit.results.annotations)

tasks:
- name: clone
Expand Down
11 changes: 6 additions & 5 deletions tests/plugins/test_gather_builds_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
of the BSD license. See the LICENSE file for details.
"""

import json
import re
from unittest.mock import patch
from atomic_reactor.inner import DockerBuildWorkflow
Expand Down Expand Up @@ -147,8 +148,8 @@ def test_gather_builds_metadata(has_s390x_build_logs, workflow: DockerBuildWorkf

flexmock(RemoteHost).should_receive('rpms_installed').and_return(package_list)

task_results = {'binary-container-build-x86-64': {'task_result': X86_64_HOST},
'binary-container-build-s390x': {'task_result': S390X_HOST}}
task_results = {'binary-container-build-x86-64': {'task_result': json.dumps(X86_64_HOST)},
'binary-container-build-s390x': {'task_result': json.dumps(S390X_HOST)}}
flexmock(workflow.osbs).should_receive('get_task_results').and_return(task_results)

plugin = GatherBuildsMetadataPlugin(workflow)
Expand Down Expand Up @@ -200,7 +201,7 @@ def test_gather_builds_metadata(has_s390x_build_logs, workflow: DockerBuildWorkf


@pytest.mark.parametrize(("task_results", "remote_hosts", "error_msg"), (
({'binary-container-build-x86-64': {'task_result': X86_64_HOST}},
({'binary-container-build-x86-64': {'task_result': json.dumps(X86_64_HOST)}},
REMOTE_HOST_CONFIG,
f"unable to obtain installed rpms on: {X86_64_HOST}"),
Expand All @@ -212,11 +213,11 @@ def test_gather_builds_metadata(has_s390x_build_logs, workflow: DockerBuildWorkf
REMOTE_HOST_CONFIG,
"unable to find build host for platform: x86_64"),
({'binary-container-build-x86-64': {'task_result': X86_64_HOST}},
({'binary-container-build-x86-64': {'task_result': json.dumps(X86_64_HOST)}},
REMOTE_HOST_CONFIG_MISSING_X86_64,
"unable to find remote hosts for platform: x86_64"),
({'binary-container-build-x86-64': {'task_result': X86_64_HOST}},
({'binary-container-build-x86-64': {'task_result': json.dumps(X86_64_HOST)}},
REMOTE_HOST_CONFIG_MISSING_SPECIFIC_X86_64,
f"unable to get remote host instance: {X86_64_HOST}"),
))
Expand Down

0 comments on commit b5e3a57

Please sign in to comment.