Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bloom/commands/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import os
import pkg_resources
import platform
import requests
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -296,6 +297,16 @@ def validate_github_url(url, url_type):
return True


def infer_release_repo_from_env(repository):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a docstring to this function describing the environment variable's behavior.

base = os.environ.get('BLOOM_RELEASE_REPO_BASE', None)
if base is None:
return None
url = base + repository + '-release.git'
r = requests.get(url)
if r.status_code == requests.codes.ok:
return url


def get_repo_uri(repository, distro):
url = None
# Fetch the distro file
Expand All @@ -309,6 +320,8 @@ def get_repo_uri(repository, distro):
matches = difflib.get_close_matches(repository, distribution_file.repositories)
if matches:
info(fmt("@{yf}Did you mean one of these: '" + "', '".join([m for m in matches]) + "'?"))
if url is None:
url = infer_release_repo_from_env(repository)
if url is None:
info("Could not determine release repository url for repository '{0}' of distro '{1}'"
.format(repository, distro))
Expand Down