Skip to content

Commit

Permalink
Make BuildParams instance attributes in BuildSpec
Browse files Browse the repository at this point in the history
The BuildParams in BuildSpec were defined as class attributes.
This caused those attributes to not be unique among multiple
worker builds, muddling the values. This changes makes them
instance attributes to guarantee isolation.

Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
  • Loading branch information
lcarva committed Sep 12, 2017
1 parent cb5ac40 commit 09aba32
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 65 deletions.
132 changes: 67 additions & 65 deletions osbs/build/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,73 +115,75 @@ def value(self, val): # pylint: disable=W0221


class BuildSpec(object):
git_uri = BuildParam('git_uri')
git_ref = BuildParam('git_ref', default=DEFAULT_GIT_REF)
git_branch = BuildParam('git_branch')
user = UserParam()
component = BuildParam('component')
registry_uris = RegistryURIsParam()
registry_secrets = BuildParam('registry_secrets', allow_none=True)
source_registry_uri = SourceRegistryURIParam()
openshift_uri = BuildParam('openshift_uri')
builder_openshift_url = BuildParam('builder_openshift_url')
name = BuildIDParam()
yum_repourls = BuildParam("yum_repourls")
use_auth = BuildParam("use_auth", allow_none=True)
build_image = BuildParam('build_image')
build_imagestream = BuildParam('build_imagestream')
proxy = BuildParam("proxy", allow_none=True)
trigger_imagestreamtag = BuildParam('trigger_imagestreamtag')
imagestream_name = BuildParam('imagestream_name')
imagestream_url = BuildParam('imagestream_url')
imagestream_insecure_registry = BuildParam('imagestream_insecure_registry')
sources_command = BuildParam("sources_command", allow_none=True)
architecture = BuildParam("architecture")
vendor = BuildParam("vendor", allow_none=True)
build_host = BuildParam("build_host")
authoritative_registry = BuildParam("authoritative_registry", allow_none=True)
distribution_scope = BuildParam("distribution_scope", allow_none=True)
registry_api_versions = BuildParam("registry_api_versions")
koji_target = BuildParam("koji_target", allow_none=True)
kojiroot = BuildParam("kojiroot", allow_none=True)
kojihub = BuildParam("kojihub", allow_none=True)
koji_certs_secret = BuildParam("koji_certs_secret", allow_none=True)
koji_task_id = BuildParam("koji_task_id", allow_none=True)
filesystem_koji_task_id = BuildParam("filesystem_koji_task_id", allow_none=True)
koji_use_kerberos = BuildParam("koji_use_kerberos", allow_none=True)
koji_kerberos_principal = BuildParam("koji_kerberos_principal", allow_none=True)
koji_kerberos_keytab = BuildParam("koji_kerberos_keytab", allow_none=True)
image_tag = BuildParam("image_tag")
pulp_secret = BuildParam("pulp_secret", allow_none=True)
pulp_registry = BuildParam("pulp_registry", allow_none=True)
smtp_host = BuildParam("smtp_host", allow_none=True)
smtp_from = BuildParam("smtp_from", allow_none=True)
smtp_additional_addresses = BuildParam("smtp_additional_addresses", allow_none=True)
smtp_error_addresses = BuildParam("smtp_error_addresses", allow_none=True)
smtp_email_domain = BuildParam("smtp_email_domain", allow_none=True)
smtp_to_submitter = BuildParam("smtp_to_submitter", allow_none=True)
smtp_to_pkgowner = BuildParam("smtp_to_pkgowner", allow_none=True)
nfs_server_path = BuildParam("nfs_server_path", allow_none=True)
nfs_dest_dir = BuildParam("nfs_dest_dir", allow_none=True)
builder_build_json_dir = BuildParam("builder_build_json_dir", allow_none=True)
platforms = BuildParam("platforms", allow_none=True)
platform = BuildParam("platform", allow_none=True)
build_type = BuildParam("build_type", allow_none=True)
release = BuildParam("release", allow_none=True)
reactor_config_secret = BuildParam("reactor_config_secret", allow_none=True)
client_config_secret = BuildParam("client_config_secret", allow_none=True)
token_secrets = BuildParam("token_secrets", allow_none=True)
arrangement_version = BuildParam("arrangement_version", allow_none=True)
info_url_format = BuildParam("info_url_format", allow_none=True)
artifacts_allowed_domains = BuildParam("artifacts_allowed_domains", allow_none=True)
equal_labels = BuildParam("equal_labels", allow_none=True)
koji_upload_dir = BuildParam("koji_upload_dir", allow_none=True)
yum_proxy = BuildParam("yum_proxy", allow_none=True)
koji_parent_build = BuildParam("koji_parent_build", allow_none=True)
group_manifests = BuildParam("group_manifests", allow_none=True)
prefer_schema1_digest = BuildParam("prefer_schema1_digest", allow_none=True)

def __init__(self):

self.git_uri = BuildParam('git_uri')
self.git_ref = BuildParam('git_ref', default=DEFAULT_GIT_REF)
self.git_branch = BuildParam('git_branch')
self.user = UserParam()
self.component = BuildParam('component')
self.registry_uris = RegistryURIsParam()
self.registry_secrets = BuildParam('registry_secrets', allow_none=True)
self.source_registry_uri = SourceRegistryURIParam()
self.openshift_uri = BuildParam('openshift_uri')
self.builder_openshift_url = BuildParam('builder_openshift_url')
self.name = BuildIDParam()
self.yum_repourls = BuildParam("yum_repourls")
self.use_auth = BuildParam("use_auth", allow_none=True)
self.build_image = BuildParam('build_image')
self.build_imagestream = BuildParam('build_imagestream')
self.proxy = BuildParam("proxy", allow_none=True)
self.trigger_imagestreamtag = BuildParam('trigger_imagestreamtag')
self.imagestream_name = BuildParam('imagestream_name')
self.imagestream_url = BuildParam('imagestream_url')
self.imagestream_insecure_registry = BuildParam('imagestream_insecure_registry')
self.sources_command = BuildParam("sources_command", allow_none=True)
self.architecture = BuildParam("architecture")
self.vendor = BuildParam("vendor", allow_none=True)
self.build_host = BuildParam("build_host")
self.authoritative_registry = BuildParam("authoritative_registry", allow_none=True)
self.distribution_scope = BuildParam("distribution_scope", allow_none=True)
self.registry_api_versions = BuildParam("registry_api_versions")
self.koji_target = BuildParam("koji_target", allow_none=True)
self.kojiroot = BuildParam("kojiroot", allow_none=True)
self.kojihub = BuildParam("kojihub", allow_none=True)
self.koji_certs_secret = BuildParam("koji_certs_secret", allow_none=True)
self.koji_task_id = BuildParam("koji_task_id", allow_none=True)
self.filesystem_koji_task_id = BuildParam("filesystem_koji_task_id", allow_none=True)
self.koji_use_kerberos = BuildParam("koji_use_kerberos", allow_none=True)
self.koji_kerberos_principal = BuildParam("koji_kerberos_principal", allow_none=True)
self.koji_kerberos_keytab = BuildParam("koji_kerberos_keytab", allow_none=True)
self.image_tag = BuildParam("image_tag")
self.pulp_secret = BuildParam("pulp_secret", allow_none=True)
self.pulp_registry = BuildParam("pulp_registry", allow_none=True)
self.smtp_host = BuildParam("smtp_host", allow_none=True)
self.smtp_from = BuildParam("smtp_from", allow_none=True)
self.smtp_additional_addresses = BuildParam("smtp_additional_addresses", allow_none=True)
self.smtp_error_addresses = BuildParam("smtp_error_addresses", allow_none=True)
self.smtp_email_domain = BuildParam("smtp_email_domain", allow_none=True)
self.smtp_to_submitter = BuildParam("smtp_to_submitter", allow_none=True)
self.smtp_to_pkgowner = BuildParam("smtp_to_pkgowner", allow_none=True)
self.nfs_server_path = BuildParam("nfs_server_path", allow_none=True)
self.nfs_dest_dir = BuildParam("nfs_dest_dir", allow_none=True)
self.builder_build_json_dir = BuildParam("builder_build_json_dir", allow_none=True)
self.platforms = BuildParam("platforms", allow_none=True)
self.platform = BuildParam("platform", allow_none=True)
self.build_type = BuildParam("build_type", allow_none=True)
self.release = BuildParam("release", allow_none=True)
self.reactor_config_secret = BuildParam("reactor_config_secret", allow_none=True)
self.client_config_secret = BuildParam("client_config_secret", allow_none=True)
self.token_secrets = BuildParam("token_secrets", allow_none=True)
self.arrangement_version = BuildParam("arrangement_version", allow_none=True)
self.info_url_format = BuildParam("info_url_format", allow_none=True)
self.artifacts_allowed_domains = BuildParam("artifacts_allowed_domains", allow_none=True)
self.equal_labels = BuildParam("equal_labels", allow_none=True)
self.koji_upload_dir = BuildParam("koji_upload_dir", allow_none=True)
self.yum_proxy = BuildParam("yum_proxy", allow_none=True)
self.koji_parent_build = BuildParam("koji_parent_build", allow_none=True)
self.group_manifests = BuildParam("group_manifests", allow_none=True)
self.prefer_schema1_digest = BuildParam("prefer_schema1_digest", allow_none=True)

self.required_params = [
self.git_uri,
self.git_ref,
Expand Down
1 change: 1 addition & 0 deletions tests/build_/test_build_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -2242,6 +2242,7 @@ def test_render_prod_custom_site_plugin_override(self):

def test_has_version(self):
br = BuildRequest(INPUTS_PATH)
br.set_params(**get_sample_prod_params())
br.render()
assert 'client_version' in br.dj.dock_json

Expand Down

0 comments on commit 09aba32

Please sign in to comment.