Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #454 from vfreex/fix-golang-build
Browse files Browse the repository at this point in the history
Fix golang image build
  • Loading branch information
joepvd authored Jun 29, 2021
2 parents e9e24fc + 70271e6 commit eb3f34d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
15 changes: 12 additions & 3 deletions doozerlib/distgit.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,13 @@ def wait(n):
# built so that push_image will have a fixed point of reference and not detect any
# subsequent builds.
push_version, push_release = ('', '')
if not scratch:
_, push_version, push_release = self.metadata.get_latest_build_info()
if not dry_run and not scratch:
# Use tag based get_latest_build because golang builder images don't follow the version numbering scheme like normal OCP images.
with self.runtime.shared_koji_client_session() as koji_api:
builds = koji_api.listTagged(self.metadata.default_brew_tag(), package=self.metadata.get_component_name(), type="image", inherit=False)
latest_build = util.find_latest_build(builds, self.runtime.assembly)
push_version = latest_build["version"]
push_release = latest_build["release"]
record["message"] = "Success"
record["status"] = 0
self.build_status = True
Expand Down Expand Up @@ -1117,7 +1122,11 @@ def _build_container(self, target_image, target, signing_intent, repo_type, repo
else:
if repo_type and not repo_list: # If --repo was not specified on the command line
repo_file = f".oit/{repo_type}.repo"
existence, repo_url = self.cgit_file_available(repo_file)
if not dry_run:
existence, repo_url = self.cgit_file_available(repo_file)
else:
self.logger.warning("[DRY RUN] Would have checked if cgit repo file is present.")
existence, repo_url = True, f"https://cgit.example.com/{repo_file}"
if not existence:
raise FileNotFoundError(f"Repo file {repo_file} is not available on cgit; cgit cache may not be reflecting distgit in a timely manner.")
repo_list = [repo_url]
Expand Down
6 changes: 4 additions & 2 deletions doozerlib/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ def rebuild(self):


class Metadata(object):

def __init__(self, meta_type, runtime, data_obj: Dict, commitish: Optional[str] = None, prevent_cloning: Optional[bool] = False):
def __init__(self, meta_type: str, runtime, data_obj: Dict, commitish: Optional[str] = None, prevent_cloning: Optional[bool] = False):
"""
:param meta_type - a string. Index to the sub-class <'rpm'|'image'>.
:param runtime - a Runtime object.
Expand Down Expand Up @@ -190,6 +189,9 @@ def candidate_brew_tag(self):
def hotfix_brew_tag(self):
return f'{self.branch()}-hotfix'

def default_brew_tag(self):
return self.hotfix_brew_tag() if self.runtime.hotfix else self.candidate_brew_tag()

def default_brew_target(self):
return NotImplementedError()

Expand Down

0 comments on commit eb3f34d

Please sign in to comment.