containerbuildsystem/atomic-reactor

Container builds don't have ['extra']['source'] fields

Closed this issue · 5 comments

Hello,
This was originally open in koji and I got redirected here: https://pagure.io/koji/issue/1607
Could you check? Description:

Greenwave (https://pagure.io/greenwave/) needs at some point to ask some information to koji: the commit hash from a build. At the moment, what Greenwave does, is extracting from the build the field "source", however, that field may be referring to the branch name rather than a specific commit.

We were considering using instead: build['extra']['source']['original_url']
we used to, but we dropped it because it looks like containers don't have the ['extra']['source'] in the build.
ref to the commit that dropped that: https://pagure.io/greenwave/c/58cbab67dfa5416c88d3e89f13c2eff0b45e54df

Is there any reason why container don't have this field? Is it possible to get it filled? It would be useful to us.

If you want to see the code for more context, here it is:
https://pagure.io/greenwave/blob/master/f/greenwave/resources.py#_142

Thank you!

Giulia

Hi Giulia,

I am transferring this issue to atomic reactor since it is here where we set the koji build metadata.

We recently changed the way OSBS deals with git repositories. Currently, the source field in the koji build metadata is set as {source_uri}#{git_commit} [1]. git_commit here it is fetched by running git rev-parse HEAD [2] in the repository root path, i.e., it is set to be the commit hash.

You could fetch the ref from build['extra']['source']['original_url'] to make sure you get the git commit hash for RPM packages and fall back to build['source'] for now, so you also have the commit hash for container image builds.

Now for your question, I don't see why we could not add the extra.source.original_url to the metadata. But then we'd be just duplicating the source field (unless there's some semantic to the the original_url name, but then it would have a different purpose from the one you actually need).

@twaugh, @rcerven, thoughts?

[1] https://github.com/containerbuildsystem/atomic-reactor/blob/master/atomic_reactor/plugins/exit_koji_import.py#L436
[2] https://github.com/containerbuildsystem/osbs-client/blob/master/osbs/utils.py#L303

I would like to know where extra.source.original_url is documented as the expected place content generators should put this.

OSBS-7827

@twaugh, I'm not sure if it's documented anywhere, but it appears to be something that happened about 2 years ago: https://pagure.io/koji/issue/550

Closing as not a bug