Skip to content

run createrepo via docker#2856

Merged
vilmibm merged 7 commits intotrunkfrom
fix-rpms
Feb 1, 2021
Merged

run createrepo via docker#2856
vilmibm merged 7 commits intotrunkfrom
fix-rpms

Conversation

@vilmibm
Copy link
Contributor

@vilmibm vilmibm commented Jan 27, 2021

Fixes #2851

As of Ubuntu 20.04, the createrepo command is no longer installable via official packages.

We'd like to run our linux packaging automation on Ubuntu 20.04, so we needed a new way of running
createrepo until it's re-packaged in Ubuntu 21.04.

This PR adds a script that users Docker to run a precompiled C version of createrepo in a Fedora
environment.

OPEN QUESTION : should we speed up the docker stuff, here? In theory I'd like to avoid having to re-pull the fedora base every run of our release pipeline. Is a docker hub image the answer? or is there another approach? I'll point out though that it didn't "feel" like it took that long in my prerelease test runs.

@vilmibm vilmibm requested review from mislav and samcoe January 27, 2021 00:56
Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

This looks good! I would just like to see pwd mounting between host and container filesystems to avoid the potentially brittle copying of files that are being worked on.

If we wanted to speed up the creation on this container, perhaps we can pre-package it and publish on GitHub Packages?

RUN yum install -y createrepo_c
RUN mkdir /packages
CMD touch /tmp/foo
COPY dist/*.rpm /packages/
Copy link
Contributor

@mislav mislav Jan 27, 2021

Choose a reason for hiding this comment

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

This copies rpm files from the host filesystem into the container, bloating it and preventing container reuse.

Would it be better to instead mount the directory from the host into the container using Docker volumes? That way the createrepo command can operate on rpm files and create the necessary directory structure straight on the host, without having to copy anything to-and-from the container.

Something like:

## Dockerfile:
...
ENTRYPOINT ["createrepo"]

## usage on the host:
docker run --rm --volume "$PWD":/packages --workdir /packages createrepo "$@"

Now the current working directory is mounted as /packages inside the container and the createrepo command should be able to easily access it, including writing back to it.

@vilmibm
Copy link
Contributor Author

vilmibm commented Jan 27, 2021

Thanks very much for the docker tip @mislav , I was learning all this stuff for the first time and am much happier with the volume+run solution. This should be good to go now and if you're okay with punting on optimizing the speed of this I am too.

@vilmibm vilmibm requested a review from mislav January 27, 2021 19:30
Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Looks great. Thank you for testing this out!

@vilmibm vilmibm merged commit de5c04f into trunk Feb 1, 2021
@mislav mislav deleted the fix-rpms branch March 23, 2021 11:46
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.

Fix release job

3 participants