diff --git a/doc/configuration.rst b/doc/configuration.rst index 0535ae97..ba0f5040 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -1849,8 +1849,10 @@ they are not scratch builds). A value for ``yum_repourls`` will be created automatically and point at a repository in the current compose. You can add extra repositories with ``repo`` key having a list of urls pointing to ``.repo`` files or just - variant uid, Pungi will create the .repo file for that variant. ``gpgkey`` - can be specified to enable gpgcheck in repo files for variants. + variant uid, Pungi will create the .repo file for that variant. If + specific URL is used in the ``repo``, the ``$COMPOSE_ID`` variable in + the ``repo`` string will be replaced with the real compose ID. + ``gpgkey`` can be specified to enable gpgcheck in repo files for variants. **osbs_registries** (*dict*) -- It is possible to configure extra information about where to diff --git a/pungi/phases/osbs.py b/pungi/phases/osbs.py index 411f05a7..4f4a2980 100644 --- a/pungi/phases/osbs.py +++ b/pungi/phases/osbs.py @@ -128,7 +128,7 @@ class OSBSThread(WorkerThread): file pointing to that location and return the URL to .repo file. """ if "://" in repo: - return repo + return repo.replace("$COMPOSE_ID", compose.compose_id) if repo.startswith("/"): # The repo is an absolute path on the filesystem diff --git a/tests/test_osbs_phase.py b/tests/test_osbs_phase.py index 04e98c19..b37fa178 100644 --- a/tests/test_osbs_phase.py +++ b/tests/test_osbs_phase.py @@ -330,7 +330,12 @@ class OSBSThreadTest(helpers.PungiTestCase): "git_branch": "f24-docker", "name": "my-name", "version": "1.0", - "repo": ["Everything", "http://pkgs.example.com/my.repo", "/extra/repo"], + "repo": [ + "Everything", + "http://pkgs.example.com/my.repo", + "/extra/repo", + "http://cts.localhost/$COMPOSE_ID/repo", + ], } self.compose.conf["translate_paths"].append(("/extra", "http://example.com")) self._setupMock(KojiWrapper) @@ -347,6 +352,7 @@ class OSBSThreadTest(helpers.PungiTestCase): "http://root/work/global/tmp-Everything/compose-rpms-Everything-1.repo", "http://pkgs.example.com/my.repo", "http://root/work/global/tmp/compose-rpms-local-1.repo", + "http://cts.localhost/%s/repo" % self.compose.compose_id, ], } self._assertCorrectCalls(options)