Skip to content
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

Convert RPMs from sysvinit to systemd + other cleanups #224

Closed
wants to merge 4 commits into from

Conversation

ekohl
Copy link
Contributor

@ekohl ekohl commented Dec 20, 2021

I started to convert the sysvinit script to systemd but got distraced with some other code I had to modify to get it to work. It's not entirely done yet, but I wanted to share some preparation work.

@basil
Copy link
Member

basil commented Jan 17, 2022

I extracted the cleanup stuff into separate PRs and merged it.

@ekohl
Copy link
Contributor Author

ekohl commented Jan 17, 2022

Thanks. I've rebased it and left out all comments that were already merged. No real change otherwise, but it keeps the PR smaller.

@basil
Copy link
Member

basil commented Jan 17, 2022

And now that we have a build, you can see that it's failing. Just wait until we have tests!

Since EL7 systemd is the default init system. This moves away from the
legacy sysvinit script to a native unit file.

It no longer ships the sysconfig file by default, but it is still read
for compatibility. Users are encouraged to use systemd drop in files
which are a more native solution.

The deprecated PreReq is replaced with a stricter Requires(pre). Ideally
sysusers would be used, but the packaging macros in EL7 are different
from more modern versions. For now this can be considered a TODO.
Mock guarantees a fresh build environment that respects BuildRequires.
It uses EL7 since that's the lowest compatibility level. It does mean it
may use suboptimal macros for the platform.
@ekohl
Copy link
Contributor Author

ekohl commented Jan 17, 2022

I've been trying to figure out why it failed, but it looks like it uses rpmbuild now which doesn't respect BuildRequires. Any thoughts on using mock instead? I've pushed a commit that uses EL7 and works for me.

@@ -13,7 +13,8 @@ cp "$WAR" $D/SOURCES/jenkins.war

pushd $D
mkdir -p BUILD RPMS SRPMS
rpmbuild -ba --define="_topdir $PWD" --define="_tmppath $PWD/tmp" --define="ver $VERSION" SPECS/jenkins.spec
rpmbuild -bs --define="_topdir $PWD" --define="_tmppath $PWD/tmp" --define="ver $VERSION" SPECS/jenkins.spec
mock --define="ver $VERSION" --resultdir=RPMS --root=epel-7-x86_64 SRPMS/*.rpm
Copy link
Member

@timja timja Jan 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll either need to install mock in the build or add it to the docker image:
https://github.com/jenkins-infra/docker-packaging/blob/main/Dockerfile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be hard: I don't think mock is packaged on Ubuntu 18.04 nor if it works in a container, but you also won't have the right RPM macros present with rpmbuild. I'll need to think about this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no clue if that mock is new enough. For now I've tried a hack. If it works, I can send a PR to docker-packaging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, clearly that hack doesn't work. There's no sudo and the non-root user isn't allowed to install packages.

@basil
Copy link
Member

basil commented Jan 19, 2022

Just wait until we have tests!

As of today automated testing has been added for:

  • AlmaLinux 8
  • CentOS Stream 8
  • Debian 10
  • Debian 11
  • Fedora 34
  • Fedora 35
  • openSUSE Leap 15
  • Oracle Linux 8
  • Rocky Linux 8
  • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 21.04
  • Ubuntu 21.10
  • Ubuntu 22.04

Just wait until the tests do more than starting Jenkins!

@basil
Copy link
Member

basil commented Jan 29, 2022

This PR was an excellent start.

#266 takes it to the finish line.

Please help me test it.

@basil
Copy link
Member

basil commented Feb 16, 2022

Closing in favor of #266. Many thanks for your contributions in this area, @ekohl! You were a great help.

@basil basil closed this Feb 16, 2022
@ekohl ekohl deleted the rpm-systemd branch February 16, 2022 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants