git-obs Metadata
After cloning a git repo, we only have a remote URL.
That is not sufficient data for running commands as osc build
and we need to provide information that binds the current checkout
with a build environment that is a project in an OBS instance.
Since we don’t want to be providing the values by hand any time we run
osc or git-obs, we need to store the information.
Using git config turned to be quite cumbersome, because
we need to store relatively large files such as buildinfo and buildconfig.
We ended up using the following locations:
.git/obs/<branch>/meta.jsonfor metadata
.git/obs/<branch>/cache/*for buildconfig, buildinfo, last_buildroot and any other disposable files
Resolving metadata
The following sections describe the order in which individual fields should be resolved.
The actual code and workflow are different.
All the metadata that should be retrieved from Gitea need to be manually stored
using git-obs -G <login> meta pull into the local metadata store.
Project checkout
apiurlread
obs_apiurlfrom.git/obs/<branch>/meta.yamlread
obs_apiurlfrom_manifest(should be the default)read
_apiurlfrom.oscthat is next to.gitread
obs_apiurlfrom Gitearepo:
obs/configurationfile:
configuration.yamlbranch:
main
projectread
obs_projectfrom.git/obs/<branch>/meta.yamlread
obs_projectfrom_manifest(should be the default)read
_projectfrom.oscthat is next to.git
package- not applicable
Standalone package checkout
apiurlread
obs_apiurlfrom.git/obs/<branch>/meta.yamlread
obs_apiurlfrom Gitearepo:
<owner>/_ObsPrjfile:
_manifestbranch: matching the current branch of the package
read
obs_apiurlfrom Gitearepo:
obs/configurationfile:
configuration.yamlbranch: main
projectread
obs_projectfrom.git/obs/<branch>/meta.yamlread
obs_projectfrom Gitearepo:
<owner>/_ObsPrjfile:
_manifestbranch: matching the current branch of the package
packageread
obs_packagefrom.git/obs/<branch>/meta.yamlread
repofrom the current remote URLuse the directory name
Preconditions for the following scenarios
Project in the parent directory tree must be detected first.
The package must be located under a location specified in project’s
_manifest.
Package checkout in a project checkout (package lives in a submodule)
apiurlread
obs_apiurlfrom.git/obs/<branch>/meta.yamlread
obs_apiurlfrom the parent “Project checkout” (see above)branch: current
the project checkout lives in the directory tree above the current git’s topdir
projectread
obs_projectfrom.git/obs/<branch>/meta.yamlread
obs_projectfrom the parent “Project checkout” (see above)branch: current
the project checkout lives in the directory tree above the current git’s topdir
packageread
obs_packagefrom.git/obs/<branch>/meta.yamlread
repofrom the current remote URLuse the directory name
Package directory in a project checkout (package lives in the project)
apiurlread
obs_apiurlfrom.git/obs/<branch>/meta.yamlread
obs_apiurlfrom the parent “Project checkout” (see above)branch: current
the project checkout lives in the same git repo
projectread
obs_projectfrom.git/obs/<branch>/meta.yamlread
obs_projectfrom the parent “Project checkout” (see above)branch: current
the project checkout lives in the same git repo
packageuse the directory name