Skip to content

ci: enhance build process#2755

Merged
georglauterbach merged 12 commits intomasterfrom
ci/build-process
Sep 21, 2022
Merged

ci: enhance build process#2755
georglauterbach merged 12 commits intomasterfrom
ci/build-process

Conversation

@georglauterbach
Copy link
Copy Markdown
Member

@georglauterbach georglauterbach commented Aug 30, 2022

Description

Enhances Dockerfile by

  1. outsourcing packages installation
  2. using COPY --link for ClamAV anti-virus bytecode

I am not sure whether using DOCKER_BUILDKIT is a breaking change. Technically not, because the build process is not taken into account for SemVer, right?

PS: Sorry for the noise in the commit message. Accidentally commit the wrong files first with wrong description.
PPS: Note, this reverts #1965 implicitly. That is okay, since Debian 11 now ships with the latest version of Fail2Ban

Type of change

  • Improvement (non-breaking change that does improve existing functionality)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or the documentation under docs/)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

This new script is a clean way of handling the installation of packages.
I think the huge `RUN` command in `Dockerfile` was hard to read and
maintain.

Using a script is a non-issue, as the image is rebuilt whenever the
script is touched.

Moreover, this commit implicitly removed the explicit Fail2Ban
installation and therefore #1965, BECAUSE Debian 11 now ships with the
latest and greatest Fail2Ban version (even more up-to-date than out
current version it seems).
This commit should have the commit message of the previous commit.

The previous commit added the appropriate envionment for building with
BuildKit, and adds the `COPY --link` directive to use the official
ClamAV image to copy the anti-virus bytecode. Therefore, we can drop the
`frashclam` command.
@georglauterbach georglauterbach added area/ci area/scripts kind/improvement Improve an existing feature, configuration file or the documentation labels Aug 30, 2022
@georglauterbach georglauterbach self-assigned this Aug 30, 2022
Comment thread target/scripts/helpers/log.sh Outdated
Copy link
Copy Markdown
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Just a few questions in the feedback, and some optional improvements.

The only change that I'd like to see is it looks like you might have forgotten to remove the FAIL2BAN_* ARGs that #1965 introduced?

All packages are accounted for still which is appreciated before dropping them in a follow-up 👍


I am not sure whether using DOCKER_BUILDKIT is a breaking change.
Technically not, because the build process is not taken into account for SemVer, right?

I don't think it is, but it should be mentioned in release notes maybe? Not sure if it affects anyone that isn't using make build or running their own build command (eg: Docker Compose can do this to extend an image, but in that case I think it just pulls our released image and there is no compatibility issue?)


appease the linting gods

Gotta love that commit title 😄

Comment thread target/scripts/build/packages.sh Outdated
Comment thread target/scripts/build/packages.sh
Comment thread Dockerfile
Comment thread target/scripts/build/packages.sh Outdated
Comment thread target/scripts/build/packages.sh
Comment thread Dockerfile
Comment thread target/scripts/build/packages.sh Outdated
Comment thread target/scripts/build/packages.sh Outdated
Comment thread target/scripts/build/packages.sh Outdated
@georglauterbach
Copy link
Copy Markdown
Member Author

georglauterbach commented Aug 31, 2022

I removed the left-over Fail2Ban ARGs from Dockerfile too :)

polarathene
polarathene previously approved these changes Sep 1, 2022
Copy link
Copy Markdown
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

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

🎉

Copy link
Copy Markdown
Member

@casperklein casperklein left a comment

Choose a reason for hiding this comment

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

Moreover, this commit implicitly removed the explicit Fail2Ban
installation and therefore #1965, BECAUSE Debian 11 now ships with the
latest and greatest Fail2Ban version

I would like to stick with the official debian package from fail2ban. This way we ensure, to get the latest version (also in the future, when Debian might stick with an older version as happen in the past).

While we at it, don't we want to use the most recent dovecot version too? 😉

Comment thread target/scripts/build/packages.sh Outdated
@polarathene
Copy link
Copy Markdown
Member

I would like to stick with the official debian package from fail2ban

Do you mind if we bring that back in a follow-up PR that is introduced as a separate stage?

While we at it, don't we want to use the most recent dovecot version too?

Likewise, I don't mind this if we keep everything required to support it as a separate stage.

This way the changes between switching from the Debian package manager to pulling in external packages to support has cleaner history of changes.

Eventually, I'd like to evaluate using/supporting a different base image such as Alpine, so keeping such changes isolated is helpful.

polarathene
polarathene previously approved these changes Sep 3, 2022
@georglauterbach
Copy link
Copy Markdown
Member Author

I would like to stick with the official debian package from fail2ban. This way we ensure, to get the latest version (also in the future, when Debian might stick with an older version as happen in the past).

I don't quiet get that. With this PR, we're basically using apt-get install fail2ban - this is what I understand as "the official Debian package". Could you elaborate, please?:)

@polarathene
Copy link
Copy Markdown
Member

this is what I understand as "the official Debian package". Could you elaborate, please?:)

I think he was referring to the .deb release from the official Github releases? (aka FAIL2BAN_DEB_URL that was used to pull the release).

There's not been a new release for sometime since though, and the next Debian release (expected around mid 2023?) may not get it (depending on if a release happens before the cutoff point for Debian). There is over 350 commits of updates since 11.2 release, so if that happens we may have to install from Github releases again, instead of just the fail2ban package (currently the latest 11.2 release).

I'm not fussed either way, but if we don't use the package, it should be contained in it's own stage. @casperklein could contribute that after this PR is merged?

@georglauterbach
Copy link
Copy Markdown
Member Author

georglauterbach commented Sep 9, 2022

CI seems to be working as expected with #2753 🎉 (This will now save 13 min on every PR check due to the ARM image being build in parallel 👍🏼)

@polarathene
Copy link
Copy Markdown
Member

TL;DR: I don't have a strong enough opinion about the fail2ban decision. I'd rather see this PR get resolved, whatever makes that easier to happen is fine by me.


Serious question: Is this really worth it? IMO, this should be in the new introduced packages.sh and handled there.

I was preferring a separate stage because it interested me in building an image without fail2ban, or being able to change the base image to something like alpine where .deb would not be supported.

This would apply for pretty much anything in packages.sh though, and I don't have a strong need for fail2ban being isolated (it'd be more work beyond this since we have other support in scripts related to it, and tbh I doubt I'll find the time).


I'm fine with it being maintained in packages.sh as it's own function call 👍

Dockerfile is also fine, but it seems like a bunch of extra noise for something that is just a package. Upstream has had many commits, but I haven't seen a release in a while.

I don't know when a new release of f2b will happen or how important that is to the users of our image.

We could do the same for dovecot and postfix and whatever other packages too, but how many users need it, and if they do is Debian the right choice for a base image, or is something that updates packages more frequently like Alpine better? (I'm sure it has it's own share of problems too)


As a maintainer, what I care most about (and for any future maintainers if we're lucky), is that we have something well organized and scoped.

I'd like to say it'd be a git blame away, but we all know how frustrating that can be to track down the original PR for something to get more context on why the project chose to do something, and what in the project is related to a feature/change (@georglauterbach for example originally wanted to mix in changes for rspamd into this PR, which would contribute to the problem)

casperklein
casperklein previously approved these changes Sep 16, 2022
Copy link
Copy Markdown
Member

@casperklein casperklein left a comment

Choose a reason for hiding this comment

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

Alright. I am still not 100% convinced, but I don't want to be the blocker here.

I bet, that the time will come when Debian again will offer not the latest version of f2b. Especially with security related software, I prefer the latest version with it's features.
"But then we can add it again".. Yeah. But that's just extra work in the future while now it would be an ease to keep the current f2b solution.

Dovecot/F2B are both very easy to keep up2date, as they offer .deb files or a repository. For Postfix unfortunately, there isn't such a option.

@georglauterbach
Copy link
Copy Markdown
Member Author

Okay, alright :)

Next week, I will tackle the cache issue in our CI and take care of the Fail2Ban concern raised here.

@casperklein
Copy link
Copy Markdown
Member

Not sure if I understand you correctly. Are you going to adjust this PR or merge it soon? If the later one, I'll provide a follow up with f2b included in packages.sh and optional if there is consensus also with Dovecot.

@georglauterbach
Copy link
Copy Markdown
Member Author

georglauterbach commented Sep 17, 2022

Not sure if I understand you correctly. Are you going to adjust this PR or merge it soon? If the later one, I'll provide a follow up with f2b included in packages.sh and optional if there is consensus also with Dovecot.

I was about to do the former, but if you want to do the latter, I won't hinder you. I will need to resolve conflicts in either way. Adding the Dovecot package via .deb files seems like a good idea, so maybe a follow-up is a good idea after all (especially since the changes would be more coherent then)?

@polarathene
Copy link
Copy Markdown
Member

I'll provide a follow up with f2b included in packages.sh and optional if there is consensus also with Dovecot.

👍 for adding Dovecot. I would appreciate if both f2b and dovecot live in their own separate function calls in packages.sh though if not too much trouble. Just a preference though, approach it however you like :)

@georglauterbach
Copy link
Copy Markdown
Member Author

georglauterbach commented Sep 18, 2022

@casperklein which way do you prefer? Shall I integrate the changes into this PR or shall I or will you do a follow up PR? I prefer a follow-up 🙈

@casperklein
Copy link
Copy Markdown
Member

Follow up 👍

@georglauterbach
Copy link
Copy Markdown
Member Author

Follow up 👍

👍 Then I will provide a follow up. I will resolve conflicts for this PR on Monday and then we can merge this :)

@casperklein
Copy link
Copy Markdown
Member

I meant, I'll provide a follow up. I've already something prepared 😉

@georglauterbach
Copy link
Copy Markdown
Member Author

I meant, I'll provide a follow up. I've already something prepared 😉

Very nice 🚀

I saw that all other actions are using v3.1.1, and v3.1 does not
actually work properly, so I updated to the latest version
@georglauterbach
Copy link
Copy Markdown
Member Author

I resolved the merge conflicts and updated the docker/build-push action so that the version used across our repository is the same everywhere.

@georglauterbach georglauterbach merged commit 32c508a into master Sep 21, 2022
@georglauterbach georglauterbach deleted the ci/build-process branch September 21, 2022 07:31
@casperklein
Copy link
Copy Markdown
Member

There's not been a new release for sometime since though

Boom, there it is 🚀

@polarathene
Copy link
Copy Markdown
Member

I bet, that the time will come when Debian again will offer not the latest version of f2b. Especially with security related software, I prefer the latest version with it's features.

Ok, I didn't expect the release to happen that soon after making such a statement 😆 😅

That just leaves postsrsd (which has been fixed quickly after reporting the bug) for the ulimit issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci area/scripts kind/improvement Improve an existing feature, configuration file or the documentation priority/high priority/medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants