-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package: specfile #15
Conversation
As we've now vendored our dependencies let's enable dependabot in the same way we use it in our other Go projects. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
Provide a spec file for `image-builder-cli`. The spec file is based on `osbuild-composer`'s spec file except it is simplified as (some) usecases would currently cloud the intent of the specfile. We can add back RHEL conditionals when/if we start shipping and building for RHEL. Some tools from `osbuild-composer` are also included; most notably the one that generates bundled dependencies from vendored modules. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
Supports to package `vendor/` directory which is not part of the repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I really like this approach!
I'm sorry, but as far as I can tell, this won't work for releasing to Fedora, CS, and RHEL. Once we start using GitHub action to push release tags, GH will generate the tarball for us, and it will miss the vendored packages. This PR solves only RPM builds in CI using Makefile using a full repo checkout, which won't work with downstream repositories. The problem that needs to be solved is that the release tarball attached to GH releases needs to contain all vendored code. EDIT: OK, with the modified release action, this should work. Looking forward to see this work in action 🤔 |
I'm still not fully on-board as I've had to deal with people excluding/including things in release tarballs way too often while packaging stuff. I'm not entirely up to date on the Go macros but do they use the actual release tarballs or do they check out the tag from git? We'd also need to run I prefer that a certain |
Makefile
Outdated
|
||
$(RPM_TARBALL): | ||
mkdir -p $(CURDIR)/rpmbuild/SOURCES | ||
git archive --prefix=image-builder-cli-$(COMMIT)/ --format=tar.gz HEAD > $(RPM_TARBALL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably consider release tags v*
so that our release tarballs have a nice filename that consists only of the name and version but no commit ref.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - I'll align, how this repo will be versioned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makefile
Outdated
|
||
RPM_TARBALL_UNCOMPRESSED=$(RPM_TARBALL:.tar.gz=.tar) | ||
|
||
$(RPM_TARBALL): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tarball should ontain SPEC file with proper Provides
for bundled code, so the commands executed in the $(RPM_SPECFILE)
target should be executed also on the SPEC that ends up in the release tarball.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hint!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix it - but it's wrong here too
https://github.com/osbuild/osbuild-composer/releases/tag/v127
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is a bug in our osbuild-composer tarball. We do not have proper provides for bundled code in CS/RHEL. :-/
Makefile
Outdated
# | ||
|
||
RPM_SPECFILE=rpmbuild/SPECS/image-builder-cli.spec | ||
RPM_TARBALL=rpmbuild/SOURCES/image-builder-cli-$(COMMIT).tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tarball should IMO contain also the release version, not just the commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily, the action will take care, that the release contains the tarball with vendored stuff already.
It is - |
Makefile
Outdated
# pre-fetched but evaluated at time of use. | ||
# | ||
|
||
VERSION := $(shell (cd "$(SRCDIR)" && grep "^Version:" image-builder-cli.spec | sed 's/[^[:digit:]]*\([[:digit:]]\+\).*/\1/')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should take potential "dot" versions into consideration. Such as 12.1
, since we use that for backporting. Moreover, this variable does not seem to be used anywhere at all.
me too 😄🎉 |
PackIt builds from commits (and releases) but the
That works well when you have network access in your build environment. While I have that on my own workstation I don't have it everywhere. |
That's the point of this approach, that the release contains the vendor directory.
So you'll just download the source tarball with vendored stuff |
Which doesn't exist for each commit, only tagged releases? |
Packit needs expects the archive path to be printed when specifying a custom action to build the archive. See [0]. [0] https://packit.dev/docs/configuration/actions#create-archive Signed-off-by: Tomáš Hozza <thozza@redhat.com>
The answer is YES, Packit will need to have a custom action to build the archive with vendored code for PRs. |
For now, Packit should trigger COPR buils for PRs and merges to the `main` branch. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
The release artifact should contain the spec file including the bundle information.
Packit needs golang to be installed when we build SRPM, because we need to vendor code to generate the archive. Moreover, we need to vendor code to be able to modify SPEC port upstream clone to include bundled code. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
|
||
actions: | ||
get-current-version: bash -c "git describe --tags --abbrev=0 | sed 's|v||'" | ||
post-upstream-clone: "./tools/rpm_spec_add_provides_bundle.sh" | ||
post-upstream-clone: bash -c "go mod vendor && ./tools/rpm_spec_add_provides_bundle.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Let's undraft this one, I've closed #14 as efforts seem to be more focused on this PR and while I have my own opinions it's not really important enough if everyone else doesn't want I'd really like if we have RPMs shipping today :) |
FWIW, I never get || and && correctly in Bash for the first time :D Also handle the case then the repository does not contain any version tags yet by defaulting to "1". Signed-off-by: Tomáš Hozza <thozza@redhat.com>
A service for building customized OS artifacts, such as VM images and OSTree | ||
commits, that uses osbuild under the hood. Besides building images for local | ||
usage, it can also upload images directly to cloud. | ||
|
||
It is compatible with composer-cli and cockpit-composer clients. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was probably not changed when copied over from osbuild-composer. We should update it.
BuildRequires: systemd | ||
BuildRequires: krb5-devel | ||
BuildRequires: python3-docutils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if they are still relevant, because we do not interact with systemd or Koji (krb5) and I'm not sure about docs...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are likely leftovers from the copy :)
# Build requirements of 'github.com/containers/storage' package | ||
BuildRequires: device-mapper-devel | ||
%if 0%{?fedora} | ||
BuildRequires: systemd-rpm-macros |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is, in my opinion, not needed because we do not enable/disable/start/stop/restart any services as part of the RPM installation process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are likely leftovers from the copy :)
@schuellerf the sources archive should really be named
|
Sound really reasonable, but why would this work with |
SPEC always uses the next version that will be released. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
RPM tooling expects the source tarball to match the name of the package, suffixed with the version in the SPEC file. Modify the Makefile to comply with this expectation. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
So, 33d65c2 fixed build in COPR (and would make things work in downstream distros), but it broke the |
This would work only for CI or local invocations of |
For the record, cockpit does something similar for node_modules, so it's a viable method. :) See: |
This is a maybe controversial version of #14 which tries to avoid commiting
vendor/
but patching source tar ball.Prerequisite to testing osbuild/release-action#25