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

(maint) Make builds reproducible #8916

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcharaoui
Copy link
Contributor

@jcharaoui jcharaoui commented Jun 10, 2022

When the standard SOURCE_DATE_EPOCH environment variable is set, this patch causes the default certificate name and manpages to become deterministic, helping the reproducibility of Puppet builds.

This patch has been in use in the Debian packaging of Puppet for some time, without issue.

@jcharaoui jcharaoui requested a review from a team as a code owner Jun 10, 2022
@jcharaoui jcharaoui requested a review from a team Jun 10, 2022
@puppetlabs-jenkins
Copy link
Collaborator

puppetlabs-jenkins commented Jun 10, 2022

Can one of the admins verify this patch?

When the standard SOURCE_DATE_EPOCH environment variable is set, this
patch causes the default certificate name and manpages to become
deterministic, helping the reproducibility of Puppet builds.

This patch has been in use in the Debian packaging of Puppet for some
time, without issue.
@CLAassistant
Copy link

CLAassistant commented Jun 10, 2022

CLA assistant check
All committers have signed the CLA.

@anarcat
Copy link

anarcat commented Jun 13, 2022

just for clarity here, @jcharaoui has already signed the CLA here, it's @lamby that needs to sign it as well now.

@lamby
Copy link

lamby commented Jun 13, 2022

Done. 👍

@@ -806,7 +806,7 @@ def self.initialize_default_settings!(settings)
# We have to downcase the fqdn, because the current ssl stuff (as opposed to in master) doesn't have good facilities for
# manipulating naming.
:certname => {
:default => lambda { Puppet::Settings.default_certname.downcase },
:default => lambda { ENV.has_key?('SOURCE_DATE_EPOCH') ? '(node\'s fully qualified domain name)' : Puppet::Settings.default_certname.downcase },
Copy link
Contributor

@joshcooper joshcooper Jun 14, 2022

Choose a reason for hiding this comment

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

I don't think this change is necessary anymore due to 5b954fd. You may also want to handle the srv_domain setting in a similar way, as currently it is sensitive to the domain fact on the host you're running the rake task on.

Copy link

@lamby lamby Jun 15, 2022

Choose a reason for hiding this comment

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

To be clear, you mean we can safely back out this particular hunk (ie. for :certname), but we need to make a change almost identical to this one or make a change similar to 5b954fd that applies to srv_domain?

Copy link

@lamby lamby Jul 11, 2022

Choose a reason for hiding this comment

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

ping @joshcooper ? :)

Copy link
Contributor

@ekohl ekohl Jul 11, 2022

Choose a reason for hiding this comment

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

Not @joshcooper, but how I read it it's the latter: apply a similar solution to srv_domain.

Copy link

@lamby lamby Jul 12, 2022

Choose a reason for hiding this comment

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

Great. This isn't actually my PR permission-wise, so here's my diff: https://gist.github.com/lamby/00daaaf9e8f397ffcd3eb0b80185cdc7/raw @jcharaoui can you add this new hunk to your PR and force-push?

Copy link
Contributor

@ekohl ekohl Jul 12, 2022

Choose a reason for hiding this comment

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

I think what @joshcooper meant is that ideally a similar solution is used. 5b954fd changes it so https://puppet.com/docs/puppet/7/configuration.html#certname is rendered with a sane default. You can see in https://puppet.com/docs/puppet/7/configuration.html#srv-domain that it does indeed leak the domain name. Ideally the mechanism used to make the reference correct would also be applied during manpage generation. Your current solution can break the application at runtime.

Perhaps it's something that should be applied in https://github.com/puppetlabs/puppet/blob/main/tasks/manpages.rake or extracted to some common helper so the help face can apply it too.

@mhashizume
Copy link
Contributor

mhashizume commented Sep 1, 2022

Hi @jcharaoui , thank you for your contribution! I think for the sake of consistency, we'd like to maintain how certname is set in defaults.rb as is for now.

Would you be able to resubmit this PR with only the manpages change? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants