Skip to content

Use Puppet::PUPPETVERSION to get version string#263

Closed
glarizza wants to merge 1 commit intopuppetlabs:2.7.xfrom
glarizza:feature/2.7.x/Rakefile_DMG
Closed

Use Puppet::PUPPETVERSION to get version string#263
glarizza wants to merge 1 commit intopuppetlabs:2.7.xfrom
glarizza:feature/2.7.x/Rakefile_DMG

Conversation

@glarizza
Copy link
Copy Markdown

@glarizza glarizza commented Dec 9, 2011

Previously, git describe was being used to get the puppet version,
however this breaks the Jenkins builds. Puppet::PUPPETVERSION is
the better choice here (though we lose the 'rc' tags at the end).

@jhelwig
Copy link
Copy Markdown
Contributor

jhelwig commented Dec 9, 2011

So, I don't think this change is the right way to fix this. I think git describe is the right way to get the version, but always populating variables that are only used when running specific tasks is the wrong way to go. The @variable declarations should probably go in a "setup" task that the others depend on.

@glarizza
Copy link
Copy Markdown
Author

glarizza commented Dec 9, 2011

Spoke with Jacob and I agree with his logic. Refactoring now and will push when I'm done.

@stahnma
Copy link
Copy Markdown
Contributor

stahnma commented Dec 9, 2011

Please don't merge this until I can review

On Dec 8, 2011, at 19:25, Gary Larizzareply@reply.github.com wrote:

Previously, git describe was being used to get the puppet version,
however this breaks the Jenkins builds. Puppet::PUPPETVERSION is
the better choice here (though we lose the 'rc' tags at the end).

You can merge this Pull Request by running:

git pull https://github.com/glarizza/puppet-1 feature/2.7.x/Rakefile_DMG

Or you can view, comment on it, or merge it online at:

#263

-- Commit Summary --

  • Build a Rake task for building Apple Packages

-- File Changes --

M tasks/rake/apple.rake (4)

-- Patch Links --

https://github.com/puppetlabs/puppet/pull/263.patch
https://github.com/puppetlabs/puppet/pull/263.diff


Reply to this email directly or view it on GitHub:
#263

@jhelwig
Copy link
Copy Markdown
Contributor

jhelwig commented Dec 9, 2011

I reverted the original commit, until this can be properly reviewed and merged. Before this can be merged in my revert will need to be reverted (0022f47).

The goal is to have our release managers build all Puppet packages
within Rake, and so this commit adds a rake task (apple_package) that
will build a DMG-encapsulated package for OS X and put it into the
pkg/apple directory off of the Puppet Root.

To accomplish this goal, a folder structure is created in
/tmp/puppet/puppet-#{version} that mirrors the structure needed for
Apple's Packagemaker CLI tool to build a package for OS X. Next, the
necessary files are copied from the Puppet source into the structure in
/tmp/puppet/puppet-#{version} and then packagemaker is run
(targeting that folder structure) to build an initial package. Hdiutil
then encapsulates that package into a DMG, and the file is finally
copied into the pkg/apple directory.

Namespace package:apple rake task

To align with the current rake workflow, the action to build an Apple
package should be namespaced under the package action. This commit does
that. Checks have also been added to ensure that the package:apple task
is run as root (which is necessary for OS X) and that the packagemaker
binary is installed (as its necessary for the task). If neither is true,
the task will fail sanely (as opposed to a stack trace).

Use git describe to get Puppet version

Using `git describe` over Puppet::PUPPETVERSION to get the current
Puppet version allows us to pull in the 'RCx' tag which can be used to
build the package. `git describe` is split on the hyphen ( - ) to remove
all the additional cruft at the end. Finally, the package minor version
splits on 'rc' since prototype.plist can only contain integers and not
string data.

Install into /usr/lib/ruby/site_ruby

In order to support 10.4 (which will be dropped in 2.8.x), we must
install puppet into /usr/lib/ruby/site_ruby/1.8 as opposed to
/Library/Ruby/Site/1.8. The prototype.plist file we bundle with the
package we create sets the IFPkgFlagFollowLinks key to true, so as long
as the symlink exists the package we build will respect it.

There IS a bug in OS X
(http://openradar.appspot.com/9202152) where the symlink in
/usr/lib/ruby/site_ruby is incorrect PRIOR to the first time the OS is
booted, but the symlink gets fixed at first boot. Users who build a
previously-unbooted-pristine-image of OS X and who also intend to
install Puppet on that image BEFORE it is booted may need to modify
their package to target /Library/Ruby/Site/1.8, however we cannot do
this at this time as OS X 10.4 DOES NOT have a /Library/Ruby/Site/1.8
folder.

Add :setup task to populate variables

There were problems with using `git describe` within a global
scope to set the @Version variable (namely that our Jenkins jobs
would try and evaluate this with custom tags that don't match our
release tags).  To remedy this, the class instance variables are
now getting set in a :setup task that is getting called by the
package:apple tasks. The Jenkins jobs never attempt to run this
task and the build doesn't fail (yay!). Doing this also preserves
the 'rc' tags that we desired.

Let @Version reflect full version of git describe

The version we use for building the package should always be the
full string output by `git describe`. Because release will ALWAYS
be on a tag that isn't ahead of a commit (and thus won't be
appended by a hyphen and string data), their packages will always
be clean. For anyone else who runs the rake task, we want the
package to reflect their position in relation to a tag (which is
what `git describe` gives you).

For the @package_{major,minor}_version variables, we DO need ONLY
integers, hence the splitting on the hyphen and removing 'rc' should
it exist.
@glarizza glarizza closed this Jan 9, 2012
hlindberg pushed a commit to hlindberg/puppet that referenced this pull request Oct 16, 2014
(maint) Move Puppet 2.6 and 2.7 under "Unsupported Releases" in the Release Notes
melissa pushed a commit to melissa/puppet that referenced this pull request Mar 30, 2018
(PCP-174) Acceptance - skip un-configured service
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