self.codename = self.job_config.get("codename")
self.os_version = self._get_version()
self.branch = self.job_config.get("branch")
+ self.tag = self.job_config.get("tag")
self.ref = self.job_config.get("ref")
self.distro = self._get_distro(
distro=self.os_type,
self.job_config, 'branch')
sha1 = _get_config_value_for_remote(self.ctx, self.remote,
self.job_config, 'sha1')
+ ref = None
else:
- sha1 = self.sha1
+ ref = self.ref
+ tag = self.tag
branch = self.branch
+ sha1 = self.sha1
- if tag:
+ if ref:
+ uri = 'ref'/ + ref
+ elif tag:
uri = 'ref/' + tag
elif branch:
uri = 'ref/' + branch
elif sha1:
uri = 'sha1/' + sha1
else:
- # FIXME: Should master be the default?
- log.debug("defaulting to master branch")
+ log.warning("defaulting to master branch")
uri = getattr(self, 'ref', 'ref/master')
return uri
expected = 'ref/jewel'
assert result == expected
+ @patch("teuthology.packaging.config")
+ def test_init_from_config_tag_ref(self, m_config):
+ m_config.baseurl_template = \
+ 'http://{host}/{proj}-{pkg_type}-{dist}-{arch}-{flavor}/{uri}'
+ m_config.gitbuilder_host = "gitbuilder.ceph.com"
+ config = dict(
+ os_type="ubuntu",
+ os_version="14.04",
+ tag='v10.0.1',
+ )
+ gp = packaging.GitbuilderProject("ceph", config)
+ result = gp.uri_reference
+ expected = 'ref/v10.0.1'
+ assert result == expected
+
+ @patch("teuthology.packaging.config")
+ def test_init_from_config_tag_overrides_branch_ref(self, m_config):
+ m_config.baseurl_template = \
+ 'http://{host}/{proj}-{pkg_type}-{dist}-{arch}-{flavor}/{uri}'
+ m_config.gitbuilder_host = "gitbuilder.ceph.com"
+ config = dict(
+ os_type="ubuntu",
+ os_version="14.04",
+ branch='jewel',
+ tag='v10.0.1',
+ )
+ gp = packaging.GitbuilderProject("ceph", config)
+ result = gp.uri_reference
+ expected = 'ref/v10.0.1'
+ assert result == expected
+
@patch("teuthology.packaging.config")
@patch("teuthology.packaging._get_config_value_for_remote")
@patch("teuthology.packaging._get_response")