Skip to content

Commit

Permalink
convert binary build git url to https url with 'git' in path based on…
Browse files Browse the repository at this point in the history
… a option

* STONEBLD-1497

Signed-off-by: Robert Cerven <rcerven@redhat.com>
  • Loading branch information
rcerven committed Jul 12, 2023
1 parent e2a8768 commit 412112e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions atomic_reactor/plugins/fetch_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
from atomic_reactor.download import download_url
from atomic_reactor.utils.pnc import PNCUtil

try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse


class FetchSourcesPlugin(Plugin):
"""Download sources that may be used in further steps to compose Source Containers"""
Expand Down Expand Up @@ -201,8 +206,16 @@ def _get_cache_allowlist(self) -> List[Dict[str, Any]]:

def check_lookaside_cache_usage(self):
"""Check usage of lookaside cache, and fail if used"""
src_config = self.workflow.conf.source_container
rh_git_url = src_config.get('rh_git_url')
git_uri, git_commit = self.koji_build['source'].split('#')

if rh_git_url:
parsed = urlparse(git_uri)
if parsed.scheme == 'git':
new_path = '/git' + parsed.path
git_uri = parsed._replace(path=new_path, scheme='https').geturl()

source = GitSource('git', git_uri, provider_params={'git_commit': git_commit})
source_path = source.get()
sources_cache_file = os.path.join(source_path, 'sources')
Expand Down
5 changes: 5 additions & 0 deletions atomic_reactor/schemas/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,11 @@
"description": "Openshift memory request for build",
"type": "string",
"examples": ["1Gi", "3Gi"]
},
"rh_git_url": {
"description": "Convert binary build git url to RH one",
"type": "boolean",
"default": false
}
},
"additionalProperties": false
Expand Down

0 comments on commit 412112e

Please sign in to comment.