def test_multiple_tags(self): self.repo.create_tag('env-testing2-1') self.repo.create_tag('env-testing1-2') self.repo.create_tag('env-testing1-1') r = deploy.tags_by_env(self.repo) self.assert_tagnamed( r, { 'testing1': ['env-testing1-1', 'env-testing1-2'], 'testing2': ['env-testing2-1'] })
def create_rpmbuild_content(repo, target): env_tags = tags_by_env(repo) for branch in repo.branches: # We only want environment branches, not manifest branches. if not branch.name.startswith(manifest_branch_prefix): manifest_branch_name = manifest_branch_prefix + branch.name # If there is no equivalent manifest branch, we need to # skip this environment. if manifest_branch_name not in repo.branches: continue manifest_branch = repo.branches[manifest_branch_name] branch.checkout() labelled_tags = tags_by_label( os.path.join(repo.working_dir, 'labels')) # We want to deploy all tags which have a label, as well as the latest tag. if env_tags.get(branch.name): latest_tag = max(env_tags[branch.name], key=lambda t: t.commit.committed_date) labelled_tags['latest'] = latest_tag.name #--------------- New for this --------- # Keep track of the labels which have tags - its those we want. tags = [] envs = [] for label, tag in labelled_tags.items(): deployed_name = tag.split('-', 2)[2] label_target = deployed_name label_location = os.path.join(target, branch.name, label) env = '{}-{}'.format(branch.name, label) tags.append(tag) envs.append(env) # If we wanted RPMS for each label, enable this. # create_rpmbuild_for_label(env, tag, target) for tag in tags: create_rpmbuild_for_tag(repo, tag, target)
def test_simple_tag(self): self.repo.create_tag('env-testing-abc') r = deploy.tags_by_env(self.repo) self.assert_tagnamed(r, {'testing': ['env-testing-abc']})
def test_no_tags(self): r = deploy.tags_by_env(self.repo) self.assertEqual(r, {})
def test_multiple_tags(self): self.repo.create_tag("env-testing2-1") self.repo.create_tag("env-testing1-2") self.repo.create_tag("env-testing1-1") r = deploy.tags_by_env(self.repo) self.assert_tagnamed(r, {"testing1": ["env-testing1-1", "env-testing1-2"], "testing2": ["env-testing2-1"]})
def test_simple_tag(self): self.repo.create_tag("env-testing-abc") r = deploy.tags_by_env(self.repo) self.assert_tagnamed(r, {"testing": ["env-testing-abc"]})