Allow specifying $COMPOSE_ID in the `repo` value for osbs phase.

There should be an option for `yum_repourls` to point to static
URL, for example when CTS is used. The idea is that instead of
setting `repo` to `AppStream`, we could use link similar to this one:

`https://cts.localhost/api/1/composes/$COMPOSE_ID/repo/?variant=AppStream`

This would be translated to real static link during the OSBS phase:

`https://cts.localhost/api/1/composes/CentOS-Stream-9-20210803.0/repo/?variant=AppStream`

That way this statis link would appear in the yum_repourls.

Merges: https://pagure.io/pungi/pull-request/1543
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
This commit is contained in:
Jan Kaluza 2021-09-09 08:49:31 +02:00 committed by Lubomír Sedlář
parent 20dc4beb6b
commit 195bfbefa4
3 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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)