Giter Site home page Giter Site logo

omnibus's Introduction

Omnibus Icon Omnibus

Gem Version Build Status

Umbrella Project: Chef Foundation

Project State: Active

Issues Response Time Maximum: 14 days

Pull Request Response Time Maximum: 14 days

Easily create full-stack installers for your project across a variety of platforms.

Seth Chisamore and Christopher Maier of CHEF gave an introductory talk on Omnibus at ChefConf 2013, entitled Eat the Whole Bowl: Building a Full-Stack Installer with Omnibus:

This project is managed by the CHEF Release Engineering team. For more information on the Release Engineering team's contribution, triage, and release process, please consult the CHEF Release Engineering OSS Management Guide.

Prerequisites

Omnibus is designed to run with a minimal set of prerequisites. You will need the following:

  • Ruby 2.6+

Get Started

Omnibus provides both a DSL for defining Omnibus projects for your software, as well as a command-line tool for generating installer artifacts from that definition.

To get started, install Omnibus locally on your workstation.

$ gem install omnibus

You can now create an Omnibus project in your current directory by using the project generator feature.

$ omnibus new $MY_PROJECT_NAME

This will generate a complete project skeleton in the directory omnibus-$MY_PROJECT_NAME

By default this will make a directory called omnibus-$MY_PROJECT_NAME assuming you're keeping your omnibus config separate from the repo. However, keeping it in your repo is a common practice, so feel to rename this directory to omnibus and place it in the top level of your projects source repo.

$ cd omnibus-$MY_PROJECT_NAME
$ bundle install --binstubs

More details can be found in the generated project's README file.

Omnibus determines the platform for which to build an installer based on the platform it is currently running on. That is, you can only generate a .deb file on a Debian-based system. To alleviate this caveat, the generated project includes a Test Kitchen setup suitable for generating a series of Omnibus projects.

More documentation

Configuration DSL

Though the template project will build, it will not do anything exciting. For that, you need to use the Omnibus DSL to define the specifics of your application.

Config

If present, Omnibus will use a top-level configuration file named omnibus.rb at the root of your repository. This file is loaded at runtime and includes a number of configuration tunables. Here is an example:

# Build locally (instead of /var)
# -------------------------------
base_dir './local'

# Disable git caching
# ------------------------------
use_git_caching false

# Enable S3 asset caching
# ------------------------------
use_s3_caching true
s3_bucket      ENV['S3_BUCKET']

# There are three ways to authenticate to the S3 bucket

# 1. set `s3_access_key` and `s3_secret_key`
s3_access_key  ENV['S3_ACCESS_KEY']
s3_secret_key  ENV['S3_SECRET_KEY']

# 2. set `s3_profile` to use an AWS profile in the Shared Credentials files
#s3_profile    ENV['S3_PROFILE']

# 3. set `s3_iam_role_arn` to use an AWS IAM role
#s3_iam_role_arn    ENV['S3_IAM_ROLE_ARN']

For more information, please see the Config documentation.

You can tell Omnibus to load a different configuration file by passing the --config option to any command:

$ bin/omnibus --config /path/to/config.rb

Finally, you can override a specific configuration option at the command line using the --override flag. This takes ultimate precedence over any configuration file values:

$ bin/omnibus --override use_git_caching:false

Projects

A Project DSL file defines your actual application; this is the thing you are creating a full-stack installer for in the first place. It provides a means to define the dependencies of the project (again, as specified in Software DSL definition files), as well as ways to set installer package metadata.

All project definitions must be in the config/projects directory of your Omnibus repository.

name            "chef-full"
maintainer      "YOUR NAME"
homepage        "http://yoursite.com"

install_dir     "/opt/chef"
build_version   "0.10.8"
build_iteration 4

dependency "chef"

Some DSL methods available include:

DSL Method Description
name The name of the project
install_dir The desired install location of the package
build_version The package version
build_iteration The package iteration number
dependency An Omnibus software-defined component to include in this package
package Invoke a packager-specific DSL
compress Invoke a compressor-specific DSL

By default a timestamp is appended to the build_version. You can turn this behavior off by setting append_timestamp to false in your omnibus.rb or using --override append_timestamp:false at the command line.

For more information, please see the Project documentation.

Software

Omnibus "software" files define individual software components that go into making your overall package. They are the building blocks of your application. The Software DSL provides a way to define where to retrieve the software sources, how to build them, and what dependencies they have. These dependencies are also defined in their own Software DSL files, thus forming the basis for a dependency-aware build ordering.

All Software definitions should go in the config/software directory of your Omnibus project repository.

Here is an example:

name "ruby"
default_version "1.9.2-p290"
source url: "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-#{version}.tar.gz",
       md5: "604da71839a6ae02b5b5b5e1b792d5eb"

dependency "zlib"
dependency "ncurses"
dependency "openssl"

relative_path "ruby-#{version}"

build do
  command "./configure"
  command "make"
  command "make install"
end

Some of the DSL methods available include:

DSL Method Description
name The name of the software component (this should come first)
default_version The version of the software component
source Directions to the location of the source
dependency An Omnibus software-defined component that this software depends on
relative_path The relative path of the extracted tarball
build The build instructions

For more DSL methods, please consult the Software documentation.

Additionally, there are a number of DSL methods available inside the build block:

DSL Method Description
command Execute a single shell command
make Run make (with or without args), using gmake when appropriate
patch Apply a patch from disk
workers The maximum number of builders
windows_safe_path Format the path to be safe for shelling out on Windows
go Execute the code as the embedded Go
ruby Execute the code as the embedded Ruby
gem Execute the code as the embedded Rubygems
bundle Execute the code as the embedded Bundler
rake Execute the code as the embedded Rake gem
block Execute Ruby block at build time
erb Render the given ERB template
mkdir Create the given directory
touch Create the given empty file
delete Remove the given file or directory
strip Strip symbols from binaries on a given file or directory
copy Copy a to b
move Move a to b
link Link a to b
sync Copy all files from a to b, removing any union files

For more DSL methods, please consult the Builder documentation.

You can support building multiple versions of the same software in the same software definition file using the version method and giving a block:

name "ruby"
default_version "1.9.2-p290"

version "1.9.2-p290" do
  source url: "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-#{version}.tar.gz",
         md5: "604da71839a6ae02b5b5b5e1b792d5eb"
end

version "2.1.1" do
  source url: "http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-#{version}.tar.gz",
         md5: "e57fdbb8ed56e70c43f39c79da1654b2"
end

Since the software definitions are simply ruby code, you can conditionally execute anything by wrapping it with pure Ruby that tests for the version number.

Sharing software definitions

The easiest way to share organization-wide software is via bundler and Rubygems. For an example software repository, look at Chef's omnibus-software. For more information, please see the Rubygems documentation.

It is recommended you use bundler to pull down these gems (as bundler also permits pulling software directly from GitHub):

gem 'my-company-omnibus-software'
gem 'omnibus-software', github: 'my-company/omnibus-software'

Then add the name of the software to the list of software_gems in your Omnibus config:

software_gems %w(my-company-omnibus-software omnibus-software)

You may also specify local paths on disk (but be warned this may make sharing the project among teams difficult):

local_software_dirs %w(/path/to/software /other/path/to/software)

For all of these paths, order matters, so it is possible to depend on local software version while still retaining a remote software repo. Given the above example, Omnibus will search for a software definition named foo in this order:

$PWD/config/software/foo.rb
/path/to/software/config/software/foo.rb
/other/path/to/software/config/software/foo.rb
/Users/sethvargo/.gems/.../my-company-omnibus-software/config/software/foo.rb
/Users/sethvargo/.gems/.../omnibus-software/config/software/foo.rb

The first instance of foo.rb that is encountered will be used. Please note that local (vendored) softare definitions take precedence!

Building

Once you've created your package and software definitions you can build with:

./bin/omnibus build $MY_PACKAGE_NAME

However there are several caveats to be aware of:

  1. You will almost certainly want to uncomment the base_dir in omnibus.rb, or at the very least change cache_dir and build_dir as otherwise it'll try to use /var/cache/omnibus and /opt/$MY_PROJECT_NAME, requiring root.
  2. Update software dependencies listed in the project configuration in config/projects/$MY_PROJECT_NAME.rb. You can refer the software .rb files present in the config/software folder.
  3. The install_dir specified in the project file typically requires root privilege at build time. Change it another location such as "/tmp/#{name}" to avoid running as root.
  4. The default configuration created for you references a lot of things that are in the default config that come from the omnibus-software gem. So you want to use those you'll need to either uncomment it in the Gemfile, or fork it, and then reference your own
  5. If this is a ruby project and you want binstubs in /opt/$project/bin, you will either need to use appbundler, or you will need to have a post install step to create those binstubs.
    • Side note, appbundler requires that you include your Gemfile and gemspec in your gem.
    • Also, needs to be in your Gemfile for you to use it, as it also must be in the resulting gem.
  6. If you specify an override of the version of the ruby, you will also need to override rubygems and bundler to match the versions in that version of ruby or you'll get failures around bundler version mismatches.

The build command above will of course build on your local host thus being specific to the OS and base system you are on. But the skeleten setup by omnibus new already setup kitchen for you so that it's easy to build for a variety of OSes, See the README.md in your generated omnibus directory for details.

Version Manifest

Git-based software definitions may specify branches as their default_version. In this case, the exact git revision to use will be determined at build-time unless a project override (see below) or external version manifest is used. To generate a version manifest use the omnibus manifest command:

omnibus manifest PROJECT -l warn

This will output a JSON-formatted manifest containing the resolved version of every software definition.

Whitelisting Libraries

Sometimes a platform has libraries that need to be whitelisted so the healthcheck can pass. The whitelist found in the healthcheck code comprises the minimal required for successful builds on supported platforms.

To add your own whitelisted library, simply add a regex to your software definition in your omnibus project as follows:

whitelist_file /libpcrecpp\.so\..+/

It is typically a good idea to add a conditional to whitelist based on the specific platform that requires it.

Warning: You should only add libraries to the whitelist that are guaranteed to be on the system you install to; if a library comes from a non-default package you should instead build it into the package.

Changelog

STATUS: EXPERIMENTAL

omnibus changelog generate will generate a changelog for an omnibus project. This command currently assumes:

  • A version-manifest.json file is checked into the project root
  • The project is a git repository
  • Each version is tagged with a SemVer compliant annotated tag
  • Any git-based sources are checked out at ../COMPONENT_NAME
  • Any commit message line prepended with ChangeLog-Entry: should be added to the changelog

These assumptions will change as we determine what works best for a number of our projects.

Caveats

Overrides

The project definitions can override specific software dependencies by passing in override to use the correct version:

name "chef-full"
# <snip>

# This will override the default version of "chef"
override :chef, version: "2.1.1"

dependency "chef"

The overridden version must be defined in the associated software!

Debugging

By default, Omnibus will log at the warn level. You can override this by passing the --log-level flag to your Omnibus call:

$ bin/omnibus build <project> --log-level info # or "debug"

Git caching

by default, Omnibus caches compiled software definitions, so n+1 Omnibus project builds are much faster. This functionality can be disabled by adding the following to your omnibus.rb:

use_git_caching false

Contributing

For information on contributing to this project see https://github.com/chef/chef/blob/master/CONTRIBUTING.md

License

Copyright 2012-2016 Chef Software, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

omnibus's People

Contributors

adamhjk avatar btm avatar chef-ci avatar chefsalim avatar coderanger avatar danielsdeleo avatar dependabot-preview[bot] avatar jaym avatar jaymalasinha avatar jeremiahsnapp avatar jkeiser avatar lamont-granquist avatar legal90 avatar marcparadise avatar mwrock avatar poorndm avatar prajaktapurohit avatar rhass avatar schisamo avatar scotthain avatar sersut avatar sethvargo avatar srenatus avatar stevendanna avatar szechyjs avatar tas50 avatar tduffield avatar thommay avatar tyler-ball avatar yzl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

omnibus's Issues

undefined method `with_embedded_path' for #<Omnibus::Software>

Hi,

I pulled the 'ruby.rb' from omnibus-software into my local 'config/software' project directory (want to build a newer version of ruby, 1.9.3-p547). However, I got the following error when running 'omnibus build test_project':

undefined method `with_embedded_path' for #<Omnibus::Software:0x000000026ab8d0>

/root/test_project/config/software/ruby.rb:47:in `initialize'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus/software.rb:89:in `instance_eval'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus/software.rb:89:in `initialize'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus/software.rb:55:in `new'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus/software.rb:55:in `load'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus.rb:373:in `recursively_load_dependency'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus.rb:377:in `block in recursively_load_dependency'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus.rb:376:in `each'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus.rb:376:in `recursively_load_dependency'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus.rb:301:in `block (2 levels) in expand_software'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus.rb:300:in `each'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus.rb:300:in `block in expand_software'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus.rb:299:in `each'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus.rb:299:in `expand_software'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus.rb:268:in `process_dsl_files'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus.rb:164:in `process_configuration'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus/cli/base.rb:83:in `initialize'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/thor-0.19.1/lib/thor.rb:355:in `new'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/thor-0.19.1/lib/thor.rb:355:in `dispatch'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus/cli/base.rb:32:in `dispatch'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus/cli/deprecated.rb:92:in `dispatch'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/lib/omnibus/cli.rb:41:in `execute!'
  /usr/local/rvm/gems/ruby-1.9.3-p484/gems/omnibus-3.1.1/bin/omnibus:11:in `<top (required)>'
  /usr/local/rvm/gems/ruby-1.9.3-p484/bin/omnibus:23:in `load'
  /usr/local/rvm/gems/ruby-1.9.3-p484/bin/omnibus:23:in `<main>'
  /usr/local/rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `eval'
  /usr/local/rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `<main>'

Anyone know what's happening here?

Thanks!

Default errors kinda suck

$ bin/omnibus build chef
undefined method `with_embedded_path' for #<Omnibus::Software:0x007fc0ffde3c90>
$

that's almost fully useless.

$ bin/omnibus build chef -l info
                          I | Using config from 'omnibus.rb'
undefined local variable or method `path_with_embedded' for #<Omnibus::Builder::DSLProxy:0x007f6d8d1df0b8>

that is also useless ('omnibus.rb' has nothing to do with the problem).

$ bin/omnibus build chef -l debug
                          I | Using config from 'omnibus.rb'
                          D | Processing Omnibus configuration...
undefined local variable or method `path_with_embedded' for #<Omnibus::Builder::DSLProxy:0x007fa646df56a8>

/home/vagrant/.gem/ruby/2.1.1/bundler/gems/omnibus-ruby-caf7f14f79ab/lib/omnibus/builder.rb:62:in `method_missing'
  /home/vagrant/.gem/ruby/2.1.1/bundler/gems/omnibus-software-2e15cd293fcd/config/software/ohai.rb:57:in `block in initialize'
 [...]

this gives me the info on the file and the line # with the problem, so that -l debug is the only really useful log level to bother using if you'd like to debug anything like this.

either we should not be suppressing stack dumps, or we need to do the work to implement something like chef's error inspector to dump out the right line numbers and/or we need to eliminate method_missing.

imo, the latter two are a bunch of work, and users of omnibus should be able to read and not be terrified of stack dumps, so we should simply not suppress stack dumping at any log levels.

Which artifacts need copied?

Right now, Omnibus does some weird platform-switching to copy packages from package_dir to pkg, which is ultra confusing. Why is this happening? Shouldn't things just lve at package_dir?

Bug in Git-Caching Build-Path Digest

Today I've discovered a bug in the git-caching build-path digest that is intended to ensure that when the versions or order of the components and dependencies leading up to the build of a specific piece of software have changed, that we will rebuild the software because it's dependencies are now altered.

Here's the scenario that we began to see today in the private-chef (Enterprise Chef) pipeline:

  1. Enterprise Chef builds, fetching cached software dependencies from the git cache until it reaches the components that have changed.
  2. Upon reaching components that have changed, the build continues with a dirty cache, rebuilding each component until the build is complete.
  3. At each stage of the build, the git cache is updated for future builds.

Once the build is complete, the artifact is sent off to the testing stage of the pipeline where we run private-chef-ctl test --all to ensure that all integration tests pass on the build. The tests fail with errors about tests that are pending as part of the migration work are passing, causing us to investigate the build failure. Upon investigation, we discover that the configuration cookbooks that are shipped with this build of Enterprise Chef are not the same ones that are checked into the source tree. For reference, Enterprise Chef uses embedded cookbooks in the same fashion as the Open Source Chef Server (https://github.com/opscode/omnibus-chef-server/blob/master/config/software/chef-server-cookbooks.rb). These cookbooks are checked into the omnibus repository and versioned with the rest of the omnibus project.

Here's an excerpt of the logs from the build:

                          I | $ rsync --delete -a /home/jenkins/workspace/private-chef-build/architecture/x86_64/platform/ubuntu-10.04/project/private-chef/role/builder/files/private-chef-cookbooks/private-chef/ /var/cache/omnibus/src/private-chef-cookbooks/
                          I | $ git --git-dir=/var/cache/omnibus/cache/install_path/opt/opscode --work-tree=/opt/opscode tag -l "private-chef-cookbooks-ece1a1545c074287621d45d20550c593661b018dee53548119ebbe507de60e8f-65a7ce4779caa80aa3424acdfc34256445969c7cdfaa6451a2c4dd85f4338a2d"
                          D | private-chef-cookbooks-ece1a1545c074287621d45d20550c593661b018dee53548119ebbe507de60e8f-65a7ce4779caa80aa3424acdfc34256445969c7cdfaa6451a2c4dd85f4338a2d
                          I | $ git --git-dir=/var/cache/omnibus/cache/install_path/opt/opscode --work-tree=/opt/opscode checkout -f "private-chef-cookbooks-ece1a1545c074287621d45d20550c593661b018dee53548119ebbe507de60e8f-65a7ce4779caa80aa3424acdfc34256445969c7cdfaa6451a2c4dd85f4338a2d"

...
... # the rest of the project builds, and finally
...

[Builder: version-manifest] I | Build succeeded! (0.520247665s)
[Software: version-manifest] I | Caching build
                          I | $ git --git-dir=/var/cache/omnibus/cache/install_path/opt/opscode --work-tree=/opt/opscode add -A -f
                          I | $ git --git-dir=/var/cache/omnibus/cache/install_path/opt/opscode --work-tree=/opt/opscode commit -q -m "Backup of version-manifest--152a886de540667a05e4c3e18e33e2f90abdeae9a90e42b1a80e880cd99c4b8d"
                          I | $ git --git-dir=/var/cache/omnibus/cache/install_path/opt/opscode --work-tree=/opt/opscode tag -f "version-manifest--152a886de540667a05e4c3e18e33e2f90abdeae9a90e42b1a80e880cd99c4b8d"

Going onto the build node, I did a bit of investigation and checked out the git cache into a local directory:

> git clone /var/cache/omnibus/cache/install_path/opt/opscode/ ./git-caching-test
> cd git-caching-test

I decided to start checking out the relevant tags and look for the configuration that was incorrectly cached:

> git checkout private-chef-cookbooks-ece1a1545c074287621d45d20550c593661b018dee53548119ebbe507de60e8f-65a7ce4779caa80aa3424acdfc34256445969c7cdfaa6451a2c4dd85f4338a2d

> grep ruby_users embedded/cookbooks/private-chef/templates/default/pedant_config.rb.erb 
ruby_users_endpoint?       true

The above output was what I expected. That means that somewhere along the line during the rest of the build, the contents of this file were changed. I decided to check out the final cached stage of the build:

> git checkout version-manifest--152a886de540667a05e4c3e18e33e2f90abdeae9a90e42b1a80e880cd99c4b8d
> grep ruby_users embedded/cookbooks/private-chef/templates/default/pedant_config.rb.erb 
ruby_users_endpoint?       false

Okay, great. This is what we saw in the final output from the build, but where did it change?

> git log -- embedded/cookbooks/private-chef/templates/default/pedant_config.rb.erb
commit 14a4755b847795c47b10c192e12c64c3a1de2170
Author: Omnibus <[email protected]>
Date:   Mon Jul 7 16:25:48 2014 +0000

    Backup of private-chef-cookbooks-c82789b6ef3be7d2f8576b748ef56c35ff0847ea576eb99e81b86a7db795757d-65a7ce4779caa80aa3424acdfc34256445969c7cdfaa6451a2c4dd85f4338a2d

Like we'd expect, the files in private-chef-cookbooks changed in the private-chef-cookbooks step of the build, but wait! The log message here is different from the previous private-chef-cookbook cache entry that we checked out. Something has gone and checked out a different version of the private-chef-cookbooks software further down in the build.

Here's the part of the code that I believe this to be happening. (The following links are linked to a specific SHA tree - master right now - so that when and if line numbers change in the future then they will still be relevant). This is the code that generates tags for the omnibus cache: Omnibus::InstallCachePath#tag

A tag is broken down into three components, a name, a version, and a digest.

The name is obvious, and is the name of the software component, in this case private-chef-cookbooks.

The version is mostly straightforward, but is implemented differently depending on how the software is fetched. If the software is fetched via git, then the version is the git SHA of the tree that is being built. If it's downloaded from the Internet (via tarball or some other source), the version is embedded in each of the software build definitions (e.g. 1.2.3). If, however, the software is fetched via a path on the local filesystem like we do with the cookbooks for Enterprise Chef and the Chef Server, then the version is computed as the SHA256 digest of the contents of the directory - link and link.

The digest portion of the tag is used to uniquely represent the order in which the build has taken to get to the current build step. It's computed by taking the SHA256 digest of the build order string, which looks like:

"dep1-dep1version-dep2-dep2version-dep3-dep3version...depN-depNversion"

The problem here is that the version field that we use in this case is not the same as the version we're using for the version portion of the tag. Instead of deriving the version specifically from the individual fetchers, we're using the omnibus software DSL to derive the version, and if we haven't specified one (like in the case of these cookbooks), then the version will appear as nil here.

Here's a hypothetical case that needs to be proven and tested further to verify these claims:

Omnibus Project - Branch A Dependencies
ruby - 2.1.1
bundler - 1.0.0
cookbooks - :path => '/local/cookbook/path1'
chef - 12.0.0
Omnibus Project - Branch B Dependencies
ruby - 2.1.1
bundler - 1.0.0
cookbooks - :path => '/different/local/cookbook/path2'
chef - 12.0.0

For both of these different branches of the project, the tag of the last element will be:

name: chef
version: 12.0.0
digest: SHA("ruby-2.1.1-bundler-1.0.0-cookbooks--chef-12.0.0")

If building branch A then branch B, the git tree will look something like the following (tags shown):

+   chef-12.0.0-hexhexhex
|
+   cookbooks-DIGESTBRANCHB-hexhexhex
|
| x chef-12.0.0-hexhexhex (tag overwritten by branch b)
| |
| + cookbooks-DIGESTBRANCHA-hexehexhex
|/
|
+   bundler-1.0.0-hexhexhex
|
+   ruby-2.1.1-hexhexhex

When rebuilding branch A for a second time, the final step of the build will checkout a tree that contains the cookbook data and history from the build of branch B.

I hope fixing this issue is as simple as changing the build digest to use the #version_for_cache method, but I believe that we will need to add a lot of tests to this to make sure we get it correct.

Implement git caching for health checks

When using local vms to build, the healthcheck step takes enough time to be worth improving. And just in general it seems reasonable to find ways to do a computation once rather than many times.

The proposal, to be clear, is not to optionally disable the healthcheck.

The proposal is to perform a health check after each build. At that point, we know all of the files that the build touched. We health check them. If we use the cache for a build, we can skip the health check. Might also have the advantage of failing builds for bad health early.

Generated Berksfile results in Berkshelf::NoSolutionError

the Berksfile has cookbook 'apt', '~> 2.0' while the omnibus cookbook on the community site has depends 'apt', '~> 1.9'. If I use the omnibus cookbook from GitHub (as the comment suggests) then it works. However, its broken out of the box.

Gems not installed to embedded directory with Ruby 2.1

Steps to reproduce:

Create an omnibus project to install a gem, and override Ruby:

name 'aws-sdk-core'
maintainer 'SNS'
homepage 'http://agilesysadmin.net'

replaces        'aws-sdk-core'
install_path    '/opt/aws-sdk-core'
build_version   Omnibus::BuildVersion.new.semver
build_iteration 1

# creates required build directories
dependency 'preparation'

# magi dependencies/components

dependency 'aws-sdk-core'

override :ruby,      version: "2.1.1"


# version manifest file
dependency 'version-manifest'

exclude '\.git*'
exclude 'bundler\/git'

With this software definition:

name 'aws-sdk-core'
default_version '2.0.0.rc6'
always_build true

dependency 'ruby'

def path_with_embedded
  prepend_path("#{install_dir}/embedded/bin")
end

def prepend_path(path)
  separator = File::PATH_SEPARATOR || ':'
  "#{path}#{separator}#{ENV['PATH']}"
end

build do
  gem ['install', 
       'aws-sdk-core', 
       "--version #{version}", 
       "-N"].join(" "), :env => {'PATH' => path_with_embedded}
end

And build the project. The result is that the aws-sdk-core gem is installed in the embedded library, but not its dependencies.

Now, set a bogus GEM_PATH in the environment:

build do
  gem ['install', 
       'aws-sdk-core', 
       "--version #{version}", 
       "-N"].join(" "), :env => {'PATH' => path_with_embedded', 'GEM_PATH' => '/totally/bogus'}
end

And run the build again. Magically the dependencies appear.

Only load required software definitions

We often have features in software dependencies that cause builds to fail, but those softwares aren't actually part of the build. For example, if you create a software definition like:

raise Exception

and commit to omnibus-software on master, all builds will fail. Omnibus should only load the required software definitions and leave the other ones alone. This will reduce the number of deprecation warnings and errors like #202.

bff_version issue

ran a build to test the bff fixes and now getting this error:

/home/lamont/.bundler/ruby/1.9.1/omnibus-ruby-d3e8691af3c6/lib/omnibus/project.rb:1222:in `bff_version': undefined method `split' for nil:NilClass (NoMethodError)
        from /home/lamont/.bundler/ruby/1.9.1/omnibus-ruby-d3e8691af3c6/lib/omnibus/project.rb:1232:in `run_bff'
        from /home/lamont/.bundler/ruby/1.9.1/omnibus-ruby-d3e8691af3c6/lib/omnibus/project.rb:931:in `block in package_me'
        from /home/lamont/.bundler/ruby/1.9.1/omnibus-ruby-d3e8691af3c6/lib/omnibus/project.rb:925:in `each'
        from /home/lamont/.bundler/ruby/1.9.1/omnibus-ruby-d3e8691af3c6/lib/omnibus/project.rb:925:in `package_me'
        from /home/lamont/.bundler/ruby/1.9.1/omnibus-ruby-d3e8691af3c6/lib/omnibus/project.rb:914:in `build_me'
        from /home/lamont/.bundler/ruby/1.9.1/omnibus-ruby-d3e8691af3c6/lib/omnibus/cli.rb:72:in `build'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
        from /home/lamont/.bundler/ruby/1.9.1/omnibus-ruby-d3e8691af3c6/lib/omnibus/cli/base.rb:33:in `dispatch'
        from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
        from /home/lamont/.bundler/ruby/1.9.1/omnibus-ruby-d3e8691af3c6/lib/omnibus/cli.rb:41:in `execute!'
        from /home/lamont/.bundler/ruby/1.9.1/omnibus-ruby-d3e8691af3c6/bin/omnibus:11:in `<top (required)>'
        from bin/omnibus:16:in `load'
        from bin/omnibus:16:in `<main>'

the method looks right, but build_version looks undefined, which doesn't immediately make any sense to me...

~ in version string breaks git caching

If you have a tilde character (~) in the package version string, the package builds fine but omnibus blows up when trying to cache the build in git, because ~ is not allowed in a git tag.

We are wanting to use tilde specifically in release candidate versions so that they sort earlier than the final release. Eg in Debian packages '1.0.0~rc3' sorts earlier than '1.0.0', whereas '1.0.0rc3' sorts later than '1.0.0'. If you have a release candidate version of 1.0.0 installed, you want to be able to install the 1.0.0 final when it's available. See the debian policy manual.

Would a PR be accepted that removes any ~ chars from candidate tag names before creating and using in git? (Or that replaces them with some other character?)

git --git-dir=/var/cache/omnibus/cache/install_path/opt/flapjack \
  --work-tree=/opt/flapjack tag -f \
  "flapjack-1.0.0~rc3~20140727T125000-9b1e831-1-d21c5f83ca481acd784f15b0429044339e88d6b59918af056029f825766e8ee1"

fatal: 'flapjack-1.0.0~rc3~20140727T125000-9b1e831-1-d21c5f83ca481acd784f15b0429044339e88d6b59918af056029f825766e8ee1' 
  is not a valid tag name.

more output:

      [Builder: flapjack] I | Build succeeded! (215.66244961s)
     [Software: flapjack] I | Caching build
                          I | $ git --git-dir=/var/cache/omnibus/cache/install_path/opt/flapjack --work-tree=/opt/flapjack add -A -f
                          I | $ git --git-dir=/var/cache/omnibus/cache/install_path/opt/flapjack --work-tree=/opt/flapjack commit -q -m "Backup of flapjack-1.0.0~rc3~20140727T125000-9b1e831-1-d21c5f83ca481acd784f15b0429044339e88d6b59918af056029f825766e8ee1"
                          I | $ git --git-dir=/var/cache/omnibus/cache/install_path/opt/flapjack --work-tree=/opt/flapjack tag -f "flapjack-1.0.0~rc3~20140727T125000-9b1e831-1-d21c5f83ca481acd784f15b0429044339e88d6b59918af056029f825766e8ee1"
/var/lib/gems/1.9.1/gems/mixlib-shellout-1.4.0/lib/mixlib/shellout.rb:257:in `invalid!': Expected process to exit with [0], but received '128' (Mixlib::ShellOut::ShellCommandFailed)
---- Begin output of git --git-dir=/var/cache/omnibus/cache/install_path/opt/flapjack --work-tree=/opt/flapjack tag -f "flapjack-1.0.0~rc3~20140727T125000-9b1e831-1-d21c5f83ca481acd784f15b0429044339e88d6b59918af056029f825766e8ee1" ----
STDOUT:
STDERR: fatal: 'flapjack-1.0.0~rc3~20140727T125000-9b1e831-1-d21c5f83ca481acd784f15b0429044339e88d6b59918af056029f825766e8ee1' is not a valid tag name.
---- End output of git --git-dir=/var/cache/omnibus/cache/install_path/opt/flapjack --work-tree=/opt/flapjack tag -f "flapjack-1.0.0~rc3~20140727T125000-9b1e831-1-d21c5f83ca481acd784f15b0429044339e88d6b59918af056029f825766e8ee1" ----
Ran git --git-dir=/var/cache/omnibus/cache/install_path/opt/flapjack --work-tree=/opt/flapjack tag -f "flapjack-1.0.0~rc3~20140727T125000-9b1e831-1-d21c5f83ca481acd784f15b0429044339e88d6b59918af056029f825766e8ee1" returned 128
    from /var/lib/gems/1.9.1/gems/mixlib-shellout-1.4.0/lib/mixlib/shellout.rb:244:in `error!'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/lib/omnibus/util.rb:77:in `shellout!'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/lib/omnibus/install_path_cache.rb:85:in `incremental'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/lib/omnibus/software.rb:623:in `execute_build'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/lib/omnibus/software.rb:451:in `build_me'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/lib/omnibus/project.rb:95:in `block in build_me'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/lib/omnibus/project.rb:94:in `each'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/lib/omnibus/project.rb:94:in `build_me'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/lib/omnibus/cli.rb:72:in `build'
    from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/lib/omnibus/cli/base.rb:33:in `dispatch'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/lib/omnibus/cli/deprecated.rb:128:in `dispatch'
    from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/lib/omnibus/cli.rb:41:in `execute!'
    from /var/lib/gems/1.9.1/bundler/gems/omnibus-ruby-5ad405c915e4/bin/omnibus:11:in `<top (required)>'
    from bin/omnibus:16:in `load'
    from bin/omnibus:16:in `<main>'

Re-add optional Vagrantfile template

So I love that we can now use test-kitchen for the builds, but it has another problem. If I'm working on a new project (particularly in Virtualbox), I can't simply suspend/shutdown the VM to work on it later with test-kitchen. So either I'd like to see the Vagrantfile template to be re-added as an option during project creation (just during development), or we need to see if test-kitchen can add support for suspend/shutdown (which doesn't seem to fit well with its project goal).

Thoughts?

Create a helper for system_root

Right now, to create a cross-platform project that supports Windows, you must do something like:

name "hamlet"

if windows?
  install_dir "C:/hamlet"
else
  install_dir "/opt/hamlet"
end

We should create a helper like system_root which defaults to C:\ on Windows and /opt on other OSes:

name "hamlet"
install_dir "#{system_root}/hamlet"

The method name is still up for debate.

/cc @opscode/release-engineers @opscode/client-engineers

--without-healthcheck option

Hi,
We are using omnibus in ci project and healthcheck step takes a lot of time when omnibus project has many dependencies. Could you add option '--without-healthcheck' to skip this step. It will reduce rebuild time.

git caching fails if .git directory exists in working directory

I ran into this upgrading to 3.0, so maybe others will hit it as well. One of my software definitions was failing on the "caching build" step:

---- Begin output of git --git-dir=/var/cache/omnibus/cache/install_path/opt/st --work-tree=/opt/st add -A -f ----
STDOUT:
STDERR: fatal: Not a git repository: embedded/lib/python2.7/site-packages/sentry/static/sentry/bootstrap/../../../../../.git/modules/src/sentry/static/sentry/bootstrap
---- End output of git --git-dir=/var/cache/omnibus/cache/install_path/opt/st --work-tree=/opt/st add -A -f ----
Ran git --git-dir=/var/cache/omnibus/cache/install_path/opt/st --work-tree=/opt/st add -A -f returned 128

Gist: https://gist.github.com/mikeclarke/9844487

The sledgehammer solution is to rm -rf the .git directory, but it might be better to throw a warning or something to make it obvious. The relative path stuff in particular might be confusing to users who hit this. There might be another argument to force adding the paths anyways, which would also solve this, but I'm not sure if something like that exists.

git version is 1.8.2.1

cannot find .configure

I am trying to compile ruby on my os x machine and I continue to see this issue.

.rvm/gems/ruby-2.0.0-p353/gems/mixlib-shellout-1.4.0/lib/mixlib/shellout/unix.rb:320:in `exec': No such file or directory - ./configure (Errno::ENOENT)

Project code below:

name 'devops_core'
maintainer 'CHANGE ME'
homepage 'https://CHANGE-ME.com'

install_dir     '/tmp/devops_core'
build_version   build_version   '0.0.1'
build_iteration 1

# creates required build directories
dependency 'preparation'

# devops_core dependencies/components
dependency 'ruby'
dependency 'rubygems'
override :ruby, version: '2.1.2'
# version manifest file
dependency 'version-manifest'

exclude '\.git*'
exclude 'bundler\/git'

omnibus project $PROJECT drops a Gemfile that specifies 1.3.0

Change omnibus version to 2.0.0 in lib/omnibus/templates/Gemfile.erb

When I create a new project and run bundle install --binstubs the omnibus bin in ./bin/ reports 1.3.0.

So, if you follow the workflow in the README.md, you are still using 1.3.0 :P

Then maybe cut a 2.0.1 gem?

Add python build helper

Right now, to execute python scripts, you have something like:

command "#{install_dir}/embedded/bin/python setup.py install --prefix=#{install_dir}/embedded"

We already have helpers for rake and bundle, so would it make sense to add a python one:

python "setup.py install --prefix=#{install_path}/embedded"

This would also include pip too. Just like the ruby and gem helpers, it would assume the build dependency on Python (and indicate so in the documentation).

Mac OS X building empty pkg?

The example below merely attempts to build 'rsync' into a pkg installer. I've only done this as I attempt to work my way backwards in order to troubleshoot why this just isn't working for me. I figured perhaps I missed a step, or left something out, etc.

However, following the documentation and simply attempting to create a pkg that only installs 'rsync' is yielding an empty pkg file in pkg/ upon inspection.

ยป ruby -v
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-darwin13.1.0]
ยป which ruby
/Users/seanosh/.rbenv/shims/ruby

ยป omnibus project tester
No configuration file `omnibus.rb', using defaults
      create  omnibus-tester/Gemfile
      create  omnibus-tester/.gitignore
      create  omnibus-tester/README.md
      create  omnibus-tester/omnibus.rb.example
      create  omnibus-tester/config/projects/tester.rb
      create  omnibus-tester/config/software/c-example.rb
      create  omnibus-tester/config/software/erlang-example.rb
      create  omnibus-tester/config/software/ruby-example.rb
      create  omnibus-tester/.kitchen.local.yml
      create  omnibus-tester/.kitchen.yml
      create  omnibus-tester/Berksfile
      create  omnibus-tester/package-scripts/tester/makeselfinst
       chmod  omnibus-tester/package-scripts/tester/makeselfinst
      create  omnibus-tester/package-scripts/tester/preinst
       chmod  omnibus-tester/package-scripts/tester/preinst
      create  omnibus-tester/package-scripts/tester/prerm
       chmod  omnibus-tester/package-scripts/tester/prerm
      create  omnibus-tester/package-scripts/tester/postinst
       chmod  omnibus-tester/package-scripts/tester/postinst
      create  omnibus-tester/package-scripts/tester/postrm
       chmod  omnibus-tester/package-scripts/tester/postrm
      create  omnibus-tester/files/mac_pkg/Resources
      create  omnibus-tester/files/mac_pkg/Resources/license.html
      create  omnibus-tester/files/mac_pkg/Resources/welcome.html
      create  omnibus-tester/files/mac_pkg/Resources/background.png
      create  omnibus-tester/files/mac_dmg/Resources
      create  omnibus-tester/files/mac_dmg/Resources/background.png
      create  omnibus-tester/files/mac_dmg/Resources/icon.png

ยป cd omnibus-tester
ยป bundle install --binstubs
Updating git://github.com/opscode/omnibus-software.git
Fetching gem metadata from https://rubygems.org/.......
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using addressable 2.3.6
Using cabin 0.6.1
Using arr-pm 0.0.9
Using backports 3.6.0
Using multipart-post 2.0.0
Using faraday 0.9.0
Using berkshelf-api-client 1.2.0
Using buff-extensions 0.5.0
Using hashie 2.1.1
Using varia_model 0.3.2
Using buff-config 0.4.0
Using buff-ruby_engine 0.1.0
Using buff-shell_out 0.1.1
Using hitimes 1.2.1
Using timers 2.0.0
Using celluloid 0.16.0.pre
Using nio4r 1.0.0
Using celluloid-io 0.16.0.pre
Using minitar 0.5.4
Using sawyer 0.5.4
Using octokit 2.7.2
Using retryable 1.3.5
Using buff-ignore 1.1.1
Using erubis 2.7.0
Using json 1.8.1
Using mixlib-log 1.6.0
Using mixlib-authentication 1.3.0
Using net-http-persistent 2.9.4
Using semverse 1.1.0
Using ridley 3.1.0
Using dep-selector-libgecode 1.0.0
Using ffi 1.9.3
Using dep_selector 1.0.3
Using solve 1.2.0
Using thor 0.19.1
Using berkshelf 3.0.1
Using chef-sugar 1.3.0
Using childprocess 0.5.3
Using clamp 0.6.3
Using http_parser.rb 0.5.3
Using ftw 0.0.39
Using fpm 1.0.2
Using ipaddress 0.8.0
Using mixlib-shellout 1.4.0
Using net-ssh 2.9.0
Using net-scp 1.2.1
Using safe_yaml 1.0.3
Using test-kitchen 1.2.1
Using kitchen-vagrant 0.15.0
Using mime-types 1.25.1
Using mixlib-cli 1.5.0
Using mixlib-config 2.1.0
Using systemu 2.5.2
Using yajl-ruby 1.2.0
Using ohai 6.22.0
Using uber-s3 0.2.4
Using omnibus 3.0.0
Using omnibus-software 0.0.1 from git://github.com/opscode/omnibus-software.git (at master)
Using bundler 1.6.2
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

Create config/software/tester.rb definition with contents:

name "tester"
default_version "1.0.0"

dependency "rsync"

Create config/projects/tester.rb with contents:

name 'tester'
maintainer 'seanosh'
homepage 'CHANGEME.com'

replaces        'tester'
install_path    '/opt/tester'
build_version   Omnibus::BuildVersion.new.semver
build_iteration 1

# creates required build directories
dependency 'preparation'

# tester dependencies/components
dependency 'tester'

# version manifest file
dependency 'version-manifest'

exclude '\.git*'
exclude 'bundler\/git'

Add build_dmg false to omnibus.rb and build the project:

ยป echo 'build_dmg false' > omnibus.rb

ยป bin/omnibus build project tester
Using Omnibus configuration file omnibus-tester/omnibus.rb
Using Omnibus configuration file omnibus-tester/omnibus.rb
Could not extract version information from `git describe`. Setting version to 0.0.0
Building tester 0.0.0+20140509024842
[fetcher:net::popt] cleaning existing build from /var/cache/omnibus/src/popt-1.16
[fetcher:net::popt] extracting the source in /var/cache/omnibus/cache/popt-1.16.tar.gz to /var/cache/omnibus/src
[builder:popt] building popt
[builder:popt] Executing: `./configure --prefix=/opt/tester/embedded --disable-nls` with cwd=/var/cache/omnibus/src/popt-1.16,timeout=5400,env="LDFLAGS=-L/opt/tester/embedded/lib -I/opt/tester/embedded/include CFLAGS=-L/opt/tester/embedded/lib -I/opt/tester/embedded/include LD_RUN_PATH=/opt/tester/embedded/lib"
[builder:popt] ./configure command succeeded, 7.208055s
[builder:popt] Executing: `make -j 3` with cwd=/var/cache/omnibus/src/popt-1.16,timeout=5400,env="LDFLAGS=-L/opt/tester/embedded/lib -I/opt/tester/embedded/include CFLAGS=-L/opt/tester/embedded/lib -I/opt/tester/embedded/include LD_RUN_PATH=/opt/tester/embedded/lib"
[builder:popt] make command succeeded, 0.865678s
[builder:popt] Executing: `make install` with cwd=/var/cache/omnibus/src/popt-1.16,timeout=5400
[builder:popt] make command succeeded, 0.318581s
[builder:popt] popt build succeeded, 8.393433s
[software:popt] caching build
[software:popt] has dirtied the cache
[fetcher:net::rsync] cleaning existing build from /var/cache/omnibus/src/rsync-3.0.9
[fetcher:net::rsync] extracting the source in /var/cache/omnibus/cache/rsync-3.0.9.tar.gz to /var/cache/omnibus/src
[builder:rsync] building rsync
[builder:rsync] Executing: `./configure --prefix=/opt/tester/embedded --disable-iconv` with cwd=/var/cache/omnibus/src/rsync-3.0.9,timeout=5400,env="LDFLAGS=-L/opt/tester/embedded/lib -I/opt/tester/embedded/include CFLAGS=-L/opt/tester/embedded/lib -I/opt/tester/embedded/include LD_RUN_PATH=/opt/tester/embedded/lib"
[builder:rsync] ./configure command succeeded, 12.713566s
[builder:rsync] Executing: `make -j 3` with cwd=/var/cache/omnibus/src/rsync-3.0.9,timeout=5400,env="LDFLAGS=-L/opt/tester/embedded/lib -I/opt/tester/embedded/include CFLAGS=-L/opt/tester/embedded/lib -I/opt/tester/embedded/include LD_RUN_PATH=/opt/tester/embedded/lib"
[builder:rsync] make command succeeded, 1.871379s
[builder:rsync] Executing: `make install` with cwd=/var/cache/omnibus/src/rsync-3.0.9,timeout=5400
[builder:rsync] make command succeeded, 0.05549s
[builder:rsync] rsync build succeeded, 14.641707s
[software:rsync] caching build
[software:rsync] has dirtied the cache
[builder:tester] Nothing to build for tester
[software:tester] caching build
On branch master
nothing to commit, working directory clean
[software:tester] has dirtied the cache
[health_check] Executing `find /opt/tester/ -type f | egrep '.(dylib|bundle)$' | xargs otool -L > otool.out 2>/dev/null`
pkgbuild: Inferring bundle components from contents of /opt/tester
pkgbuild: Wrote package to tester-core.pkg
productbuild: Wrote product to /var/cache/omnibus/pkg/tester-0.0.0+20140509024842-1.mac_os_x.10.9.2.pkg

I've attempted specifying the dependency on 'rsync' in both the config/software/tester.rb and config/projects/tester.rb file - no difference.

What I need/want to do here is more complex than installing 'rsync' of course, but regardless of what steps I take, the end result is a pkg file that doesn't install anything!

What am I missing?

"DMG coming soon"

I'd like fpm to provide this support.

What did you have in mind for this? :)

Non target packages are getting copied

After a build completes, all previously completed builds are getting copied into the target directory. This results in some pretty significant disk utilization as there are now two copies of every built package.

The packages are being cached in /var/cache/omnibus/pkg and then all of them are copied at the end of a build. Normally, I'd think only the package I built should be copied. Additionally, I'm not sure what the enduring value is of keeping a separate copy of all built packages (vs keeping only the last package built) in /var/cache/omnibus/pkg.

Git caching loses track of files in git repos in the install dir

When there is a git repo inside the install_dir, a build step that restores files from the cache will have an empty directory where the git repo is supposed to be. This happens because git by default assumes a nested git repo is a submodule. If you ask git to add the root of the nested git repo specifically, you can get git to add the files within the git repo, but AFAICT there isn't a way to make git actually add the nested git repo's git directory to the top-level git repo.

I've created a script that will demonstrate the git behavior here: https://gist.github.com/danielsdeleo/65b4fc4fe86ce7e9a1d9

I have tried to change git's behavior by setting GIT_DIR and passing the --git-dir=A_PATH flag, but git still detects the nested .git directories and treats the nested repos as submodules. For ChefDK, we've decided to just nuke the .git directories from our embedded applications (chef/omnibus-software#216).

The failure mode is really frustrating and non-obvious. At minimum, we should add a health check step to look for nested .git dirs and fail if we find any, but note that this solution is kind of a PITA when using git gems with bundler, since bundler doesn't nuke the .git dir when it clones. For example, in my local copy of omnibus-chef:

ls -la $(bundle show omnibus) |grep git
drwxr-xr-x  14 ddeleo  staff    476 May 30 14:24 .git
-rw-r--r--   1 ddeleo  staff    138 May 30 13:28 .gitignore

If we don't care to preserve .git dirs, then we could find all of the nested git repos and explicitly add them to git (e.g., git add /path/to/nested/repo/) before committing, which would at least preserve the files in the repos.

The only other option that would preserve the .git dirs is to find and rename nested .git directories before caching, and then find and restore them when using a cached build (e.g., mv .git .git-hidden-for-git-caching before storing in the cache and mv .git-hidden-for-git-caching .git after loading from the cache).

Related: #121

Shared object path for embedded gems' extensions

When embedding a gem with extension (puma here), built objects are installed in a weird location, repeating the project path under the gem directory.

Here is my software recipe:

name "puma"
version "2.8.0"

dependency "ruby"
dependency "rubygems"

build do
  gem "install puma --no-rdoc --no-ri -v #{version}"
end

Puma contains a native extensions which, when built through omnibus, end up here:

/opt/lita/embedded/lib/ruby/gems/2.0.0/gems/puma-2.8.0/lib/opt/lita/embedded/lib/ruby/site_ruby/2.0.0/x86_64-linux/puma/puma_http11.so

I tried resetting GEM_HOME and GEM_PATH in the above recipe (as in unicorn's), with no effect.
When installed as a dependency of Lita (purpose of my omnibus package) the result is the same.

How can I work around this ?
Thanks.

Issues getting the template/skeleton build working

Hi,

I'm facing a few issues getting the template/skeleton build up and running and wondered if you could offer any insight?

Firstly:

$ omnibus -v
Omnibus v3.2.1

Which I used to generate my project skeleton:

$ omnibus new test
      create  omnibus-test/Gemfile
      create  omnibus-test/.gitignore
      create  omnibus-test/README.md
      create  omnibus-test/omnibus.rb
      create  omnibus-test/config/projects/test.rb
      create  omnibus-test/config/software/c-example.rb
      create  omnibus-test/config/software/erlang-example.rb
      create  omnibus-test/config/software/ruby-example.rb
      create  omnibus-test/.kitchen.local.yml
      create  omnibus-test/.kitchen.yml
      create  omnibus-test/Berksfile
      create  omnibus-test/package-scripts/test/makeselfinst
       chmod  omnibus-test/package-scripts/test/makeselfinst
      create  omnibus-test/package-scripts/test/preinst
       chmod  omnibus-test/package-scripts/test/preinst
      create  omnibus-test/package-scripts/test/prerm
       chmod  omnibus-test/package-scripts/test/prerm
      create  omnibus-test/package-scripts/test/postinst
       chmod  omnibus-test/package-scripts/test/postinst
      create  omnibus-test/package-scripts/test/postrm
       chmod  omnibus-test/package-scripts/test/postrm
      create  omnibus-test/files/mac_pkg/Resources/license.html
      create  omnibus-test/files/mac_pkg/Resources/welcome.html
      create  omnibus-test/files/mac_pkg/Resources/background.png
      create  omnibus-test/files/mac_dmg/Resources/background.png
      create  omnibus-test/files/mac_dmg/Resources/icon.png
      create  omnibus-test/files/windows_msi/Resources/localization-en-us.wxl.erb
      create  omnibus-test/files/windows_msi/Resources/parameters.wxi.erb
      create  omnibus-test/files/windows_msi/Resources/source.wxs
      create  omnibus-test/files/windows_msi/Resources/assets/LICENSE.rtf
      create  omnibus-test/files/windows_msi/Resources/assets/banner_background.bmp
      create  omnibus-test/files/windows_msi/Resources/assets/dialog_background.bmp
      create  omnibus-test/files/windows_msi/Resources/assets/project.ico
      create  omnibus-test/files/windows_msi/Resources/assets/project_16x16.ico
      create  omnibus-test/files/windows_msi/Resources/assets/project_32x32.ico

Followed by a local bundle install:

$ bundle install --binstubs
Fetching gem metadata from https://rubygems.org/.......
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using addressable (2.3.6)
Using cabin (0.6.1)
Using arr-pm (0.0.9)
Using backports (3.6.0)
Using multipart-post (2.0.0)
Using faraday (0.9.0)
Using berkshelf-api-client (1.2.0)
Using buff-extensions (1.0.0)
Using hashie (2.1.2)
Using varia_model (0.4.0)
Using buff-config (1.0.1)
Using buff-ruby_engine (0.1.0)
Using buff-shell_out (0.1.1)
Using hitimes (1.2.2)
Using timers (4.0.0)
Using celluloid (0.16.0.pre3)
Using nio4r (1.0.0)
Using celluloid-io (0.16.0.pre2)
Using minitar (0.5.4)
Using sawyer (0.5.4)
Using octokit (3.2.0)
Using retryable (1.3.5)
Using buff-ignore (1.1.1)
Using erubis (2.7.0)
Using json (1.8.1)
Using mixlib-log (1.6.0)
Using mixlib-authentication (1.3.0)
Using net-http-persistent (2.9.4)
Using semverse (1.1.0)
Using ridley (4.0.0)
Using dep-selector-libgecode (1.0.2)
Using ffi (1.9.3)
Using dep_selector (1.0.3)
Using solve (1.2.1)
Using thor (0.19.1)
Using berkshelf (3.1.4)
Using chef-sugar (1.3.0)
Using childprocess (0.5.3)
Using clamp (0.6.3)
Using libyajl2 (1.0.1)
Using ffi-yajl (1.0.1)
Using http_parser.rb (0.5.3)
Using ftw (0.0.39)
Using fpm (0.4.42)
Using ipaddress (0.8.0)
Using mixlib-shellout (1.4.0)
Using net-ssh (2.9.1)
Using net-scp (1.2.1)
Using safe_yaml (1.0.3)
Using test-kitchen (1.2.1)
Using kitchen-vagrant (0.15.0)
Using mime-types (1.25.1)
Using mixlib-cli (1.5.0)
Using mixlib-config (2.1.0)
Using systemu (2.6.4)
Using wmi-lite (1.0.0)
Using ohai (7.2.0)
Using uber-s3 (0.2.4)
Using omnibus (3.2.1)
Using bundler (1.5.2)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

So far so good. However, when I try to build the project:

$ bin/omnibus build test
                     [BuildVersion] W | Could not extract version information from 'git describe'! Setting version to 0.0.0.
                          [Omnibus] W | Could not load softwares from gem `omnibus-software'. Is it installed?
I could not find a software named `preparation' in any of the sources:

    /Users/bensnape/git/omnibus-test/config/software


/Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus.rb:443:in `recursively_load_dependency'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus.rb:423:in `block (2 levels) in expand_software'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus.rb:422:in `each'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus.rb:422:in `block in expand_software'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus.rb:421:in `each'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus.rb:421:in `expand_software'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus.rb:238:in `process_dsl_files'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus.rb:170:in `process_configuration'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus/cli/base.rb:84:in `initialize'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/thor-0.19.1/lib/thor.rb:355:in `new'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/thor-0.19.1/lib/thor.rb:355:in `dispatch'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus/cli/base.rb:33:in `dispatch'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus/cli/deprecated.rb:128:in `dispatch'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus/cli.rb:41:in `execute!'
  /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/bin/omnibus:11:in `<top (required)>'
  bin/omnibus:16:in `load'
  bin/omnibus:16:in `<main>'

The error references the omnibus-software gem the source of which can be found here but no gem exists in RubyGems.

It is possible to manually place preparation.rb to make the error go away but surely this defeats the purpose of the skeleton/template project?

Furthermore, that error is followed by the missing version-manifest.rb file. Again, I can manually add it from here.

I realise that this is because of explicit dependencies in <project root>/config/projects/<project name>.rb e.g. in my case omnibus-test/config/projects/test.rb:

name 'test'
maintainer 'CHANGE ME'
homepage 'https://CHANGE-ME.com'

install_dir     '/opt/test'
build_version   Omnibus::BuildVersion.semver
build_iteration 1

# creates required build directories
dependency 'preparation'

# test dependencies/components
# dependency 'somedep'

# version manifest file
dependency 'version-manifest'

exclude '\.git*'
exclude 'bundler\/git'

Anyway, once I manually added both preparation.rb and version-manifest.rb I saw the following exception:

$ bin/omnibus build ot
                     [BuildVersion] W | Could not extract version information from 'git describe'! Setting version to 0.0.0.
                          [Omnibus] W | Could not load softwares from gem `omnibus-software'. Is it installed?
Building ot 0.0.0+20140731151735...
/Users/bensnape/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/fileutils.rb:250:in `mkdir': Permission denied @ dir_s_mkdir - /var/cache (Errno::EACCES)
    from /Users/bensnape/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/fileutils.rb:250:in `fu_mkdir'
    from /Users/bensnape/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/fileutils.rb:224:in `block (2 levels) in mkdir_p'
    from /Users/bensnape/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/fileutils.rb:222:in `reverse_each'
    from /Users/bensnape/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/fileutils.rb:222:in `block in mkdir_p'
    from /Users/bensnape/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/fileutils.rb:208:in `each'
    from /Users/bensnape/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/fileutils.rb:208:in `mkdir_p'
    from /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus/project.rb:957:in `build_me'
    from /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus/cli.rb:72:in `build'
    from /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus/cli/base.rb:33:in `dispatch'
    from /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus/cli/deprecated.rb:128:in `dispatch'
    from /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/lib/omnibus/cli.rb:41:in `execute!'
    from /Users/bensnape/.rvm/gems/ruby-2.1.0/gems/omnibus-3.2.1/bin/omnibus:11:in `<top (required)>'
    from bin/omnibus:16:in `load'
    from bin/omnibus:16:in `<main>'

And I'm not sure where to go from here!

If it helps, I'm using RVM Ruby 2.1.0 on OSX 10.9.4:

$ rvm use
Using /Users/bensnape/.rvm/gems/ruby-2.1.0

I'm familiar with Ruby so I'm happy to help with PR's if we can diagnose the problem.

Thanks,
Ben

whitelist_file fails for libMagick++-6.Q16.so.5.0.0

Hi,

So I'm trying to get ImageMagick as part of my omnibus package, where one of it's dependencies is libgomp.

Compiling libgomp would be much of a hassle so I settled for adding it as a runtime_dependency, and just add the files that breaks the healthcheck to the whitelist, which currently fails.

I went with the following:
whitelist_file "#{install_dir}/embedded/lib/libMagick++-6.Q16.so.5.0.0"
and also
whitelist_file '/opt/app/embedded/lib/libMagick++-6.Q16.so.5.0.0'

This always fails with the error:

HealthCheck] W | The precise failures were:
    --> /opt/app/lib/libMagickCore-6.Q16.so.2.0.0
    DEPENDS ON: libgomp.so.1
      COUNT: 1
      PROVIDED BY: /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007fbb8c45b000)
      FAILED BECAUSE: Unsafe dependency

My current workaround for this is to just add /libgomp\.so\.1/ to health_check.rb but this is an ugly hack of course ..

Any hints what could be going wrong here ?

Thanks in advance.

Windows builds produce a metadata.json file with null platform_version and arch

Here is an example:

{
  "basename": "chefdk-windows-0.1.1+20140701164704.git.65.3c03746-1.windows.msi",
  "md5": "98a70a86ff7380059aebc63cda605872",
  "sha1": "0a7034bb476147d1887890e82e7d633a8417dfe2",
  "sha256": "3bef18762072f3d35c140b381da1659bbe990ef31f7e4668a42bdbe16e85a2cb",
  "sha512": "53a745eb7c55179312500a1bb91a849945601bcdb2e9c1fad96cdfe82a1222ce146f61dfbd110bbe213397308e3265af56d0915b8676501cfbdc047b8ad2e4d0",
  "name": "chefdk-windows",
  "friendly_name": "Chef Development Kit",
  "homepage": "http://www.getchef.com",
  "platform": "windows",
  "platform_version": null,
  "arch": null,
  "version": "0.1.1+20140701164704.git.65.3c03746"
}

3.1 broken on bundle install

e.g. omnibus-analytics. Upgrading from 3.0 -> 3.1 :

       ---- Begin output of /opt/opscode-analytics/embedded/bin/bundle install --without guard ----
       STDOUT: /opt/opscode-analytics/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rubygems/format (LoadError)
       /opt/opscode-analytics/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/lib/bundler/source.rb:5:in `<top (required)>'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/lib/bundler/dsl.rb:19:in `initialize'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/lib/bundler/dsl.rb:6:in `new'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/lib/bundler/dsl.rb:6:in `evaluate'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/lib/bundler/definition.rb:18:in `build'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/lib/bundler.rb:135:in `definition'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/lib/bundler/cli.rb:220:in `install'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/lib/bundler/vendor/thor/task.rb:22:in `run'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/lib/bundler/vendor/thor.rb:263:in `dispatch'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/lib/bundler/vendor/thor/base.rb:386:in `start'
       /opt/opscode-analytics/embedded/lib/ruby/gems/2.1.0/gems/bundler-1.1.5/bin/bundle:13:in `<top (required)>'
       /opt/opscode-analytics/embedded/bin/bundle:23:in `load'
       /opt/opscode-analytics/embedded/bin/bundle:23:in `<main>'
       There was an error in your Gemfile, and Bundler cannot continue.

Kitchen instructions and default synced folders

The generated kitchen build instructions don't seem like they'll work until the next version of kitchen-vagrant comes out. The issue is that the generated .kitchen.yml uses a relative path for the synced_folders setup:

  synced_folders:
    - ['.', '/home/vagrant/PROJECT_NAME']

However, relative paths appear somewhat broken in the currently released version of kitchen-vagrant: test-kitchen/kitchen-vagrant#72

The generated omnibus README instructions tell you to login and run the bundle and build commands from /home/vagrant/PROJECT_NAME, however with this relative path bug, the only contents inside /home/vagrant/PROJECT_NAME is the kitchen's internal Vagrantfile, and no actual project contents are present (so there's nothing to bundle or build).

If I update my Gemfile to use the latest version of kitchen-vagrant directly from git, then all is well. So once a new kitchen-vagrant gem gets released, then I think this issue will go away, but I thought it might be worth noting in case other people are running into this same issue with the new kitchen instructions.

Generated projects are unusable

Steps to reproduce:

gem install omnibus (it pulls in version 3)
omnibus project test-project (generates a new skeleton project)

Now we realize that omnibus isn't generating a Vagrantfile anymore. Okay so go learn a little bit about test-kitchen. Cool.

kitchen test default-ubuntu-1204

This is where everything falls apart.

The generated Berksfile evidently doesn't work with any released version of Berkshelf? It fails with:

Kitchen: Message: Failed to complete #converge action: [Berkshelf::BerksfileReadError] and the logs show that line 1 is to blame which is not supported by Berkshelf 2.0 which is what is trying to run inside the launched vm.

runtime_dependency gets ignored with 3.2RC1

So I am currently experimenting with 3.2RC1, So far .. so good.

One thing I noticed is that runtime_depedency statement in the project definitions doesn't seem to be picked up by the build ? I basically see no --depends option for the fpm command in the end ..

I fixed all of the deprecations notices in the project definitions but still the same issue exists ..

undefined method `with_standard_compiler_flags'

OS X 10.9.3 ruby 2.1.2 (via rbenv)

omnibus new foo
cd omnibus-foo
# edit config/projects/foo.rb to include dependency 'c-example'
bundle install --binstubs
bin/omnibus build foo
undefined method `with_standard_compiler_flags' for #<Omnibus::Software:0x007fafe28812d0>

I had this issue on a "real" project but found I could reproduce with a default generate one.

Erroneous build delay

I think I've found a small bug that's causing dependencies to fail. I need to map out a proper test case but here's what I think is happening:

  • The docs state that deps explicitly named in a project file are built last
  • I'm sort of okay with this but previously I was explicitly ordering my builds in the project so small cognitive shift

So let's say I erroneously put openssl in my project file (let's says the first item). And I also have openssl as a dep in something else.

I think what's happening is that the dedupe is shifting explicit deps in a project to the end regardless of a software definition's deps.

So take a software def called nginx that says:

name "nginx"
default_version "1.4.3.6"

dependency "geoip"
dependency "zlib"
dependency "openssl"
dependency "libxml2"
dependency "libxslt"
dependency "pcre"
dependency "gd"
dependency "ngx_http_gunzip_filter_module"
dependency "ngx_http_filter_cache"
dependency "nginx_upstream_check_module"
dependency "nginx_http_jsonp_module"
dependency "ngx_cache_purge"
dependency "nginx-statsd"
dependency "nginx_requestid"
dependency "nginx_upstream_fair_module"
dependency "nginx-sticky-module"
dependency "nginx_tcp_proxy_module"

with a project like so:

dependency "preparation"
dependency "openssl"
dependency "mything" # mything has a dep on openssl and the above software def.

So I think the dedupe happens first (again I haven't validated) and THEN the explicit deps are shifted to the end. So that means openssl gets shifted to then end.

I'll try and validate this but I wanted to get this out there.

README mentions 'the documentation' - where is that?

The README says "please see the documentation" but there is no link. Could this please be a link to complete documentation on the DSL?

If complete documentation doesn't exist, then perhaps change the text to "see the source code" with a link to where to start looking.

Ta!

Some DSL methods available include:

DSL Method Description
name The name of the project
install_path The desired install location of the package
build_version The package version
build_iteration The package iteration number
dependency An Omnibus software-defined component to include in this package

For more information, please see the documentation.

Omnibus cache problem

Every S3 cached file gets uploaded as zlib-$checksum

omnibus cache populate -l debug output:

Digest::Digest is deprecated; use Digest
  2                 [S3Cache] I | Fetching libyaml
  3                 [S3Cache] D | Cached copy up to date, skipping.
  4                 [S3Cache] I | Uploading /var/cache/omnibus/cache/yaml-0.1.6.tar.gz as atomic-penguin.bucket/zlib-1.2.6-618e944d7c7cd6521551e30b32322f4a
  5 Digest::Digest is deprecated; use Digest
  6                 [S3Cache] I | Fetching gdbm
  7                 [S3Cache] D | Cached copy up to date, skipping.
  8                 [S3Cache] I | Uploading /var/cache/omnibus/cache/gdbm-1.9.1.tar.gz as atomic-penguin.bucket/zlib-1.2.6-618e944d7c7cd6521551e30b32322f4a
  9 Digest::Digest is deprecated; use Digest
 10                 [S3Cache] I | Fetching ruby
 11                 [S3Cache] D | Cached copy up to date, skipping.
 12                 [S3Cache] I | Uploading /var/cache/omnibus/cache/ruby-1.9.3-p484.tar.gz as atomic-penguin.bucket/zlib-1.2.6-618e944d7c7cd6521551e30b32322f4a
 13 Digest::Digest is deprecated; use Digest
 14                 [S3Cache] I | Fetching rubygems
 15                 [S3Cache] D | Cached copy up to date, skipping.
 16                 [S3Cache] I | Uploading /var/cache/omnibus/cache/rubygems-1.8.24.tgz as atomic-penguin.bucket/zlib-1.2.6-618e944d7c7cd6521551e30b32322f4a
 17 Digest::Digest is deprecated; use Digest
 18                 [S3Cache] I | Fetching bzip2
 19                 [S3Cache] D | Cached copy up to date, skipping.
 20                 [S3Cache] I | Uploading /var/cache/omnibus/cache/bzip2-1.0.6.tar.gz as atomic-penguin.bucket/zlib-1.2.6-618e944d7c7cd6521551e30b32322f4a
 21 Digest::Digest is deprecated; use Digest
 22                 [S3Cache] I | Fetching python
 23                 [S3Cache] D | Cached copy up to date, skipping.
 24                 [S3Cache] I | Uploading /var/cache/omnibus/cache/Python-2.7.5.tgz as atomic-penguin.bucket/zlib-1.2.6-618e944d7c7cd6521551e30b32322f4a

#windows_safe_path unintentionally modifies command arguments

Since 24ae7fe this command line now has its slashes converted to backslashes, including changing /MIR to \MIR which causes a failure.

config/software/ruby-windows.rb:  command "robocopy . #{install_dir}\\embedded\\ /MIR", :returns => [0, 1]

Omnibus::Builder#_shellout! calls windows_safe_path(command_string), but we are handing it a command string with arguments, not just a path. Somewhere we have to differentiate between the two. Last time I looked at this it was Complicated and I walked away from the problem, but I think we could make a decent go at it by taking the first space that 1) isn't escaped and 2) isn't inside a quote string and considering that the delimiter between the path + command, and the arguments. I talked to @smurawski about this and we feel like it'd be okay. ish.

Full error follows:

C:/Ruby193/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.4.0-x86-mingw32/lib/mixlib/shellout.rb:257:in `invalid!': Expected process to exit with [0, 1], but received '16' (Mixlib::ShellOut::ShellCommandFailed)
---- Begin output of robocopy . c:\opscode\chefdk\embedded\ \MIR ----
STDOUT: -------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

  Started : Thursday, July 17, 2014 5:03:35 PM
   Source - C:\omnibus-ruby\src\ruby-2.0.0-p451-i386-mingw32\
     Dest - c:\opscode\chefdk\embedded\

    Files :
  Options : /DCOPY:DA /COPY:DAT /R:1000000 /W:30

------------------------------------------------------------------------------

ERROR : Invalid Parameter #3 : "\MIR"

       Simple Usage :: ROBOCOPY source destination /MIR

             source :: Source Directory (drive:\path or \\server\share\path).
        destination :: Destination Dir  (drive:\path or \\server\share\path).
               /MIR :: Mirror a complete directory tree.

    For more usage information run ROBOCOPY /?


****  /MIR can DELETE files as well as copy them !
STDERR:
---- End output of robocopy . c:\opscode\chefdk\embedded\ \MIR ----
Ran robocopy . c:\opscode\chefdk\embedded\ \MIR returned 16
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mixlib-shellout-1.4.0-x86-mingw32/lib/mixlib/shellout.rb:244:in `error!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/util.rb:84:in `shellout!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:584:in `_shellout!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:81:in `block in command'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:713:in `instance_eval'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:713:in `run'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:602:in `block (3 levels) in execute'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:627:in `call'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:627:in `with_retries'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:601:in `block (2 levels) in execute'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/instrumentation.rb:23:in `call'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/instrumentation.rb:23:in `measure'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:600:in `block in execute'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:229:in `block in with_clean_env'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:216:in `with_original_env'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.5.3/lib/bundler.rb:222:in `with_clean_env'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:599:in `execute'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:498:in `block (2 levels) in build'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:497:in `each'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:497:in `block in build'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/instrumentation.rb:23:in `call'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/instrumentation.rb:23:in `measure'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/builder.rb:496:in `build'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/software.rb:981:in `execute_build'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/software.rb:844:in `build_me'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/project.rb:971:in `block in build_me'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/project.rb:970:in `each'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/project.rb:970:in `build_me'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/cli.rb:72:in `build'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/cli/base.rb:33:in `dispatch'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/cli/deprecated.rb:128:in `dispatch'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/lib/omnibus/cli.rb:41:in `execute!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/bundler/gems/omnibus-ruby-ed60550b9122/bin/omnibus:11:in `<top (required)>'
        from bin/omnibus:16:in `load'
        from bin/omnibus:16:in `<main>'

/cc @adamedx @sethvargo

[windows] net_fetcher uses decompress programs which are unavailable after omnibus cookbook prep on windows

On a host set up with omnibus cookbook, when net_fetcher is called gzip is used even though gzip is not installed, or available as a software config in omnibus-software.

This would most likely happen in these scenarios:

  • gzip - has no definition, most software definitions use this archive format. Could alternatively use tar zx, instead of explicit gzip on a bootstrapped omnibus system.
  • bzip2 - has a software definition, one software definition appears to use it. Could alternatively use tar jx, instead of explicit bzip on a bootstrapped omnibus system.

Ensure installed packages are owned by root:root

From chef/chef#1750:

Install on ubuntu 12.04 using the 11.14.2-1 omnibus installer using the following command

curl -L https://www.opscode.com/chef/install.sh | sudo bash

The files installed under /opt/chef are owned by UID/GID 999

The files should be owned by UID/GID root.

Assumptions on rsync

Right now, there are a number of places where we "assume" rsync will be present on the system, especially in software definitions. So, this is a two-part discussion:

  1. If we want to keep rsync, should we expose an sync build step:

    sync "#{a} #{b}"
  2. Should we discourage the use of rsync (for cross-platform reasons) and just use FileUtils natively?

Add ppc64 support to architecture

I'm working on getting chef built on ppc64 but ran into an issue with building openssl. I discovered that ppc64 is not an architecture that omnibus knows about looking at libs/omnibus/software.rb:426. I would like to have it added so that it can be used in omnibus-software. I'll try submitting a PR soon.

Currently it only supports sparc and defaults to intel otherwise.

FPM and extra_package_files options

Hi
I need to add changelog file to deb package. FPM has --deb-changelog option for this.
In my project.rb file i add line:

extra_package_files(["--deb-changelog /tmp/changelog"])

and get FPM error:

All flags should be before the first argument (stray flags found: ["--deb-changelog"] {:level=>:warn}
Invalid package configuration: Cannot package the path '--deb-changelog', does it exist? {:level=>:error}

This occurs because extra_package_files are appended after install_path in command_and_opts variable.

Thanks

DMG build fails with a leftover mounted disk

When a dmg build fails, the ones after that build will fail as well with the below error:

ERROR: Write Permissions Error. (-61)  on file: /Volumes/chefdk
Something went wrong...the Omnibus just ran off the road!

Error raised was:

    Expected process to exit with [0], but received '2'
---- Begin output of # Generate the icns
mkdir tmp.iconset
sips -z 16 16     /Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png --out tmp.iconset/icon_16x16.png
sips -z 32 32     /Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png --out tmp.iconset/[email protected]
sips -z 32 32     /Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png --out tmp.iconset/icon_32x32.png
sips -z 64 64     /Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png --out tmp.iconset/[email protected]
sips -z 128 128   /Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png --out tmp.iconset/icon_128x128.png
sips -z 256 256   /Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png --out tmp.iconset/[email protected]
sips -z 256 256   /Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png --out tmp.iconset/icon_256x256.png
sips -z 512 512   /Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png --out tmp.iconset/[email protected]
sips -z 512 512   /Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png --out tmp.iconset/icon_512x512.png
sips -z 1024 1024 /Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png --out tmp.iconset/[email protected]
iconutil -c icns tmp.iconset

# Copy it over
cp tmp.icns "/Volumes/chefdk/.VolumeIcon.icns"

# Source the icon
SetFile -a C "/Volumes/chefdk"
 ----
STDOUT: /Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png
  /private/var/cache/omnibus/pkg-tmp/mac_dmg/tmp.iconset/icon_16x16.png
/Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png
  /private/var/cache/omnibus/pkg-tmp/mac_dmg/tmp.iconset/[email protected]
/Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png
  /private/var/cache/omnibus/pkg-tmp/mac_dmg/tmp.iconset/icon_32x32.png
/Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png
  /private/var/cache/omnibus/pkg-tmp/mac_dmg/tmp.iconset/[email protected]
/Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png
  /private/var/cache/omnibus/pkg-tmp/mac_dmg/tmp.iconset/icon_128x128.png
/Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png
  /private/var/cache/omnibus/pkg-tmp/mac_dmg/tmp.iconset/[email protected]
/Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png
  /private/var/cache/omnibus/pkg-tmp/mac_dmg/tmp.iconset/icon_256x256.png
/Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png
  /private/var/cache/omnibus/pkg-tmp/mac_dmg/tmp.iconset/[email protected]
/Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png
  /private/var/cache/omnibus/pkg-tmp/mac_dmg/tmp.iconset/icon_512x512.png
/Users/serdar/oc/packaging/omnibus-chef/files/mac_dmg/Resources/icon.png
  /private/var/cache/omnibus/pkg-tmp/mac_dmg/tmp.iconset/[email protected]
ERROR: Write Permissions Error. (-61)  on file: /Volumes/chefdk
STDERR: cp: /Volumes/chefdk/.VolumeIcon.icns: Read-only file system

Talking to @sethvargo we think we have two options:

  1. Figure out how to name the mounted volume something different
  2. Eject any mounted disks as the first step of dmg build

Extend from a common error class

Right now, it's difficult to rescue an "omnibus error", since they all inherit from RuntimeError. We should create a simple subclass of RuntimeError and have all errors extend from that.

This will permit us to rescue Omnibus-specific errors:

begin
  Omnibus.something!
rescue Omnibus::Error => e
  # ...
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.