appbundler 0.12.3 → 0.13.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +25 -1
- data/{LICENSE.txt → LICENSE} +0 -0
- data/Rakefile +40 -0
- data/appbundler.gemspec +2 -6
- data/lib/appbundler/app.rb +59 -48
- data/lib/appbundler/cli.rb +30 -36
- data/lib/appbundler/version.rb +1 -1
- data/spec/appbundler/app_spec.rb +171 -146
- data/spec/fixtures/appbundler-example-app/lib/example_app.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +5 -66
- data/.expeditor/config.yml +0 -44
- data/.expeditor/update_version.sh +0 -12
- data/.github/CODEOWNERS +0 -7
- data/.github/ISSUE_TEMPLATE/BUG_TEMPLATE.md +0 -29
- data/.github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md +0 -40
- data/.github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md +0 -17
- data/.github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md +0 -12
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -15
- data/.github/lock.yml +0 -1
- data/.gitignore +0 -19
- data/.rspec +0 -2
- data/.travis.yml +0 -23
- data/CHANGELOG.md +0 -36
- data/CODE_OF_CONDUCT.md +0 -1
- data/CONTRIBUTING.md +0 -1
- data/README.md +0 -204
- data/VERSION +0 -1
- data/spec/fixtures/appbundler-example-app/.bundle/config +0 -2
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appbundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '3.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '3.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: pry
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
13
|
- !ruby/object:Gem::Dependency
|
56
14
|
name: mixlib-shellout
|
57
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,26 +59,9 @@ executables:
|
|
101
59
|
extensions: []
|
102
60
|
extra_rdoc_files: []
|
103
61
|
files:
|
104
|
-
- ".expeditor/config.yml"
|
105
|
-
- ".expeditor/update_version.sh"
|
106
|
-
- ".github/CODEOWNERS"
|
107
|
-
- ".github/ISSUE_TEMPLATE/BUG_TEMPLATE.md"
|
108
|
-
- ".github/ISSUE_TEMPLATE/DESIGN_PROPOSAL.md"
|
109
|
-
- ".github/ISSUE_TEMPLATE/ENHANCEMENT_REQUEST_TEMPLATE.md"
|
110
|
-
- ".github/ISSUE_TEMPLATE/SUPPORT_QUESTION.md"
|
111
|
-
- ".github/PULL_REQUEST_TEMPLATE.md"
|
112
|
-
- ".github/lock.yml"
|
113
|
-
- ".gitignore"
|
114
|
-
- ".rspec"
|
115
|
-
- ".travis.yml"
|
116
|
-
- CHANGELOG.md
|
117
|
-
- CODE_OF_CONDUCT.md
|
118
|
-
- CONTRIBUTING.md
|
119
62
|
- Gemfile
|
120
|
-
- LICENSE
|
121
|
-
- README.md
|
63
|
+
- LICENSE
|
122
64
|
- Rakefile
|
123
|
-
- VERSION
|
124
65
|
- appbundler.gemspec
|
125
66
|
- bin/appbundler
|
126
67
|
- lib/appbundler.rb
|
@@ -128,7 +69,6 @@ files:
|
|
128
69
|
- lib/appbundler/cli.rb
|
129
70
|
- lib/appbundler/version.rb
|
130
71
|
- spec/appbundler/app_spec.rb
|
131
|
-
- spec/fixtures/appbundler-example-app/.bundle/config
|
132
72
|
- spec/fixtures/appbundler-example-app/Gemfile
|
133
73
|
- spec/fixtures/appbundler-example-app/Gemfile.lock.unix
|
134
74
|
- spec/fixtures/appbundler-example-app/Gemfile.lock.windows
|
@@ -150,20 +90,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
90
|
requirements:
|
151
91
|
- - ">="
|
152
92
|
- !ruby/object:Gem::Version
|
153
|
-
version: '2.
|
93
|
+
version: '2.4'
|
154
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
95
|
requirements:
|
156
96
|
- - ">="
|
157
97
|
- !ruby/object:Gem::Version
|
158
98
|
version: '0'
|
159
99
|
requirements: []
|
160
|
-
rubygems_version: 3.
|
100
|
+
rubygems_version: 3.1.4
|
161
101
|
signing_key:
|
162
102
|
specification_version: 4
|
163
103
|
summary: Extracts a dependency solution from bundler's Gemfile.lock to speed gem activation
|
164
104
|
test_files:
|
165
105
|
- spec/appbundler/app_spec.rb
|
166
|
-
- spec/fixtures/appbundler-example-app/.bundle/config
|
167
106
|
- spec/fixtures/appbundler-example-app/Gemfile
|
168
107
|
- spec/fixtures/appbundler-example-app/Gemfile.lock.unix
|
169
108
|
- spec/fixtures/appbundler-example-app/Gemfile.lock.windows
|
data/.expeditor/config.yml
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# Documentation available at https://expeditor.chef.io/docs/getting-started/
|
2
|
-
---
|
3
|
-
# Slack channel in Chef Software slack to send notifications about build failures, etc
|
4
|
-
slack:
|
5
|
-
notify_channel: chef-notify
|
6
|
-
|
7
|
-
# This publish is triggered by the `built_in:publish_rubygems` artifact_action.
|
8
|
-
rubygems:
|
9
|
-
- appbundler
|
10
|
-
|
11
|
-
github:
|
12
|
-
# This deletes the GitHub PR branch after successfully merged into the release branch
|
13
|
-
delete_branch_on_merge: true
|
14
|
-
# The tag format to use (e.g. v1.0.0)
|
15
|
-
version_tag_format: "v{{version}}"
|
16
|
-
# allow bumping the minor release via label
|
17
|
-
minor_bump_labels:
|
18
|
-
- "Expeditor: Bump Version Minor"
|
19
|
-
# allow bumping the major release via label
|
20
|
-
major_bump_labels:
|
21
|
-
- "Expeditor: Bump Version Major"
|
22
|
-
|
23
|
-
changelog:
|
24
|
-
rollup_header: Changes not yet released to rubygems.org
|
25
|
-
|
26
|
-
# These actions are taken, in order they are specified, anytime a Pull Request is merged.
|
27
|
-
merge_actions:
|
28
|
-
- built_in:bump_version:
|
29
|
-
ignore_labels:
|
30
|
-
- "Expeditor: Skip Version Bump"
|
31
|
-
- "Expeditor: Skip All"
|
32
|
-
- bash:.expeditor/update_version.sh:
|
33
|
-
only_if: built_in:bump_version
|
34
|
-
- built_in:update_changelog:
|
35
|
-
ignore_labels:
|
36
|
-
- "Expeditor: Skip Changelog"
|
37
|
-
- "Expeditor: Skip All"
|
38
|
-
- built_in:build_gem:
|
39
|
-
only_if: built_in:bump_version
|
40
|
-
|
41
|
-
promote:
|
42
|
-
actions:
|
43
|
-
- built_in:rollover_changelog
|
44
|
-
- built_in:publish_rubygems
|
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
#
|
3
|
-
# After a PR merge, Chef Expeditor will bump the PATCH version in the VERSION file.
|
4
|
-
# It then executes this file to update any other files/components with that new version.
|
5
|
-
#
|
6
|
-
|
7
|
-
set -evx
|
8
|
-
|
9
|
-
sed -i -r "s/^(\s*)VERSION = \".+\"/\1VERSION = \"$(cat VERSION)\"/" lib/appbundler/version.rb
|
10
|
-
|
11
|
-
# Once Expeditor finshes executing this script, it will commit the changes and push
|
12
|
-
# the commit as a new tag corresponding to the value in the VERSION file.
|
data/.github/CODEOWNERS
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: � Bug Report
|
3
|
-
about: If something isn't working as expected �.
|
4
|
-
labels: "Status: Untriaged"
|
5
|
-
---
|
6
|
-
|
7
|
-
# Version:
|
8
|
-
|
9
|
-
[Version of the project installed]
|
10
|
-
|
11
|
-
# Environment:
|
12
|
-
|
13
|
-
[Details about the environment such as the Operating System, cookbook details, etc...]
|
14
|
-
|
15
|
-
# Scenario:
|
16
|
-
|
17
|
-
[What you are trying to achieve and you can't?]
|
18
|
-
|
19
|
-
# Steps to Reproduce:
|
20
|
-
|
21
|
-
[If you are filing an issue what are the things we need to do in order to repro your problem?]
|
22
|
-
|
23
|
-
# Expected Result:
|
24
|
-
|
25
|
-
[What are you expecting to happen as the consequence of above reproduction steps?]
|
26
|
-
|
27
|
-
# Actual Result:
|
28
|
-
|
29
|
-
[What actually happens after the reproduction steps?]
|
@@ -1,40 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Design Proposal
|
3
|
-
about: I have a significant change I would like to propose and discuss before starting
|
4
|
-
labels: "Status: Untriaged"
|
5
|
-
---
|
6
|
-
|
7
|
-
### When a Change Needs a Design Proposal
|
8
|
-
|
9
|
-
A design proposal should be opened any time a change meets one of the following qualifications:
|
10
|
-
|
11
|
-
- Significantly changes the user experience of a project in a way that impacts users.
|
12
|
-
- Significantly changes the underlying architecture of the project in a way that impacts other developers.
|
13
|
-
- Changes the development or testing process of the project such as a change of CI systems or test frameworks.
|
14
|
-
|
15
|
-
### Why We Use This Process
|
16
|
-
|
17
|
-
- Allows all interested parties (including any community member) to discuss large impact changes to a project.
|
18
|
-
- Serves as a durable paper trail for discussions regarding project architecture.
|
19
|
-
- Forces design discussions to occur before PRs are created.
|
20
|
-
- Reduces PR refactoring and rejected PRs.
|
21
|
-
|
22
|
-
---
|
23
|
-
|
24
|
-
<!--- Proposal description and rationale. -->
|
25
|
-
|
26
|
-
## Motivation
|
27
|
-
|
28
|
-
<!---
|
29
|
-
As a <<user_profile>>,
|
30
|
-
I want to <<functionality>>,
|
31
|
-
so that <<benefit>>.
|
32
|
-
-->
|
33
|
-
|
34
|
-
## Specification
|
35
|
-
|
36
|
-
<!--- A detailed description of the planned implementation. -->
|
37
|
-
|
38
|
-
## Downstream Impact
|
39
|
-
|
40
|
-
<!--- Which other tools will be impacted by this work? -->
|
@@ -1,17 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: 🚀 Enhancement Request
|
3
|
-
about: I have a suggestion (and may want to implement it 🙂)!
|
4
|
-
labels: "Status: Untriaged"
|
5
|
-
---
|
6
|
-
|
7
|
-
### Describe the Enhancement:
|
8
|
-
<!--- What you are trying to achieve that you can't? -->
|
9
|
-
|
10
|
-
### Describe the Need:
|
11
|
-
<!--- What kind of user do you believe would utilize this enhancement, and how many users might want this functionality -->
|
12
|
-
|
13
|
-
### Current Alternative
|
14
|
-
<!--- Is there a current alternative that you can utilize to workaround the lack of this enhancement -->
|
15
|
-
|
16
|
-
### Can We Help You Implement This?:
|
17
|
-
<!--- The best way to ensure your enhancement is built is to help implement the enhancement yourself. If you're interested in helping out we'd love to give you a hand to make this possible. Let us know if there's something you need. -->
|
@@ -1,12 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: 🤗 Support Question
|
3
|
-
about: If you have a question 💬, please check out our Slack!
|
4
|
-
---
|
5
|
-
|
6
|
-
We use GitHub issues to track bugs and feature requests. If you need help please post to our Mailing List or join the Chef Community Slack.
|
7
|
-
|
8
|
-
* Chef Community Slack at http://community-slack.chef.io/.
|
9
|
-
* Chef Mailing List https://discourse.chef.io/
|
10
|
-
|
11
|
-
|
12
|
-
Support issues opened here will be closed and redirected to Slack or Discourse.
|
@@ -1,15 +0,0 @@
|
|
1
|
-
### Description
|
2
|
-
|
3
|
-
[Please describe what this change achieves]
|
4
|
-
|
5
|
-
### Issues Resolved
|
6
|
-
|
7
|
-
[List any existing issues this PR resolves, or any Discourse or
|
8
|
-
StackOverflow discussions that are relevant]
|
9
|
-
|
10
|
-
### Check List
|
11
|
-
|
12
|
-
- [ ] New functionality includes tests
|
13
|
-
- [ ] All tests pass
|
14
|
-
- [ ] All commits have been signed-off for the Developer Certificate of Origin. See <https://github.com/chef/chef/blob/master/CONTRIBUTING.md#developer-certification-of-origin-dco>
|
15
|
-
- [ ] PR title is a worthy inclusion in the CHANGELOG
|
data/.github/lock.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
daysUntilLock: 60
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
dist: xenial
|
4
|
-
|
5
|
-
before_install:
|
6
|
-
- gem update --system
|
7
|
-
- gem install bundler || true
|
8
|
-
|
9
|
-
rvm:
|
10
|
-
- 2.3.8
|
11
|
-
- 2.4.5
|
12
|
-
- 2.5.5
|
13
|
-
- 2.6.2
|
14
|
-
|
15
|
-
branches:
|
16
|
-
only:
|
17
|
-
- master
|
18
|
-
|
19
|
-
install:
|
20
|
-
- bundle install --jobs 3 --retry 3
|
21
|
-
|
22
|
-
# The integration tests need to see installed gems.
|
23
|
-
script: rspec --color --format progress
|
data/CHANGELOG.md
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# Appbundler CHANGELOG
|
2
|
-
|
3
|
-
This file is used to document the changes between releases of Appbundler
|
4
|
-
|
5
|
-
<!-- latest_release 0.12.3 -->
|
6
|
-
## [v0.12.3](https://github.com/chef/appbundler/tree/v0.12.3) (2019-04-17)
|
7
|
-
|
8
|
-
#### Merged Pull Requests
|
9
|
-
- syntax fix [#52](https://github.com/chef/appbundler/pull/52) ([lamont-granquist](https://github.com/lamont-granquist))
|
10
|
-
<!-- latest_release -->
|
11
|
-
|
12
|
-
<!-- release_rollup since=0.12.2 -->
|
13
|
-
### Changes not yet released to rubygems.org
|
14
|
-
|
15
|
-
#### Merged Pull Requests
|
16
|
-
- syntax fix [#52](https://github.com/chef/appbundler/pull/52) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 0.12.3 -->
|
17
|
-
<!-- release_rollup -->
|
18
|
-
|
19
|
-
<!-- latest_stable_release -->
|
20
|
-
## [v0.12.2](https://github.com/chef/appbundler/tree/v0.12.2) (2019-04-16)
|
21
|
-
|
22
|
-
#### Merged Pull Requests
|
23
|
-
- fix syntax for cli options [#51](https://github.com/chef/appbundler/pull/51) ([lamont-granquist](https://github.com/lamont-granquist))
|
24
|
-
<!-- latest_stable_release -->
|
25
|
-
|
26
|
-
## [v0.12.1](https://github.com/chef/appbundler/tree/v0.12.1) (2019-04-16)
|
27
|
-
|
28
|
-
#### Merged Pull Requests
|
29
|
-
- add support for extra bin files not in the binstubs [#50](https://github.com/chef/appbundler/pull/50) ([lamont-granquist](https://github.com/lamont-granquist))
|
30
|
-
|
31
|
-
## [v0.12.0](https://github.com/chef/appbundler/tree/v0.12.0) (2019-03-18)
|
32
|
-
|
33
|
-
#### Merged Pull Requests
|
34
|
-
- Update README.md [#47](https://github.com/chef/appbundler/pull/47) ([markan](https://github.com/markan))
|
35
|
-
- Require ruby 2.3+ and loosen gem deps [#48](https://github.com/chef/appbundler/pull/48) ([tas50](https://github.com/tas50))
|
36
|
-
- Fix the labels to properly bump the gem [#49](https://github.com/chef/appbundler/pull/49) ([tas50](https://github.com/tas50))
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Please refer to the Chef Community Code of Conduct at https://www.chef.io/code-of-conduct/
|
data/CONTRIBUTING.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Please refer to https://github.com/chef/chef/blob/master/CONTRIBUTING.md
|
data/README.md
DELETED
@@ -1,204 +0,0 @@
|
|
1
|
-
# Appbundler
|
2
|
-
|
3
|
-
[![Build Status Master](https://travis-ci.org/chef/appbundler.svg?branch=master)](https://travis-ci.org/chef/appbundler) [![Gem Version](https://badge.fury.io/rb/appbundler.svg)](https://badge.fury.io/rb/appbundler)
|
4
|
-
|
5
|
-
Appbundler reads a Gemfile.lock and generates code with `gem "some-dep", "= VERSION"` statements to lock the app's dependencies to the versions selected by bundler. This code is used in binstubs for the application so that running (e.g.) `chef-client` on the command line activates the locked dependencies for `chef` before running the command.
|
6
|
-
|
7
|
-
This provides the following benefits:
|
8
|
-
|
9
|
-
- The application loads faster because rubygems is not resolving dependency constraints at runtime.
|
10
|
-
- The application runs with the same dependencies that it would if bundler was used, so we can test applications (that will be installed in an omnibus package) using the default bundler workflow.
|
11
|
-
- There's no need to `bundle exec` or patch the bundler runtime into the app.
|
12
|
-
- The app can load gems not included in the Gemfile/gemspec. Our use case for this is to load plugins (e.g., for knife and test kitchen).
|
13
|
-
- A user can use rvm and still use the application (see below).
|
14
|
-
- The application is protected from installation of incompatible dependencies.
|
15
|
-
|
16
|
-
## ChefDK Usage
|
17
|
-
|
18
|
-
### Primary Design
|
19
|
-
|
20
|
-
The 3-argument form of appbundler is used in ChefDK (and should be used elsewhere) to pin multiple apps in the same omnibus install against one master Gemfile.lock.
|
21
|
-
|
22
|
-
When used this way appbundler takes three arguments: the lockdir containing the main Gemfile.lock of the omnibus package, the bindir to install the binstubs to, and
|
23
|
-
the gem to appbundle. In this way all the gems in the omnibus app should be appbundled against the same Gemfile.lock. The omnibus software definition should bundle install
|
24
|
-
this Gemfile.lock prior to appbundling.
|
25
|
-
|
26
|
-
This will pin all of the bunstubs against every gem in the referenced Gemfile.lock. This is equivalent and identical behavior to copying the Gemfile.lock to a
|
27
|
-
directory, running `bundle install` and then using `bundle exec` to launch any of the applications. The only major difference is that the appbundle pins apply only to the
|
28
|
-
gems in the gemfile, while `bundle exec` will prevent any other external gems from being able to be loaded into the gemset.
|
29
|
-
|
30
|
-
The design goals are brutally simple -- replicating the effects of `bundle exec` against the master Gemfile.lock while allowing the gemset to be open.
|
31
|
-
|
32
|
-
### Preventing duplicate gems
|
33
|
-
|
34
|
-
One of the features of this approach are that it becomes guaranteed that there will be no duplicate gems. In order for this to be true, however, all gems must be installed
|
35
|
-
only from the master Gemfile.lock (and only one version of a gem may appear in any valid Gemfile.lock). If the omnibus projects does anything other than a single
|
36
|
-
`bundle install` against the master Gemfile.lock to install gems then there likely will be multiple gems installed. IF the apps are appbundled correctly, however, this
|
37
|
-
will still not have any negative effects since all runtime gems are pinned.
|
38
|
-
|
39
|
-
Historically this issue has caused problems due to transitive dep issues causing different version of gems to be loaded based on which application was launched which would
|
40
|
-
later cause gem conflicts. It also simply caused user confusion.
|
41
|
-
|
42
|
-
### Preventing transitive gem issues
|
43
|
-
|
44
|
-
Given that ChefDK and most chef applications are open pluggable architectures any arbitrary gems may be loaded lazily at runtime long after the initial application has
|
45
|
-
launched. The classic example of the kind of bug which occurs is external third-party knife-plugins which require gems that are not part of the chef-client/knife
|
46
|
-
gemset but which collide with the explict pins on berkshelf. Since the command line invocation is `knife` the berkshelf gem pins were not applied up front, a lazy
|
47
|
-
load of the transitive gem was then executed which activated the latest version which was installed with the knife plugin, then berkshelf was activated which would
|
48
|
-
conflict due to a pessimistic pin in the berksehlf gemspec itself.
|
49
|
-
|
50
|
-
While this is a complicated set of events it was actually fairly commonly reported:
|
51
|
-
|
52
|
-
* https://github.com/chef/chef-dk/issues/1187
|
53
|
-
* https://github.com/chef/chef-dk/issues/281
|
54
|
-
* https://github.com/berkshelf/berkshelf/issues/1357
|
55
|
-
* https://stackoverflow.com/questions/31906153/chef-gemconflicterror-when-running-knife-bootstrap-windows
|
56
|
-
* https://github.com/chef/chef-dk/issues/603
|
57
|
-
|
58
|
-
The aggressive pinning of all gems in the Gemfile.lock against all apps in the Gemfile.lock have eliminated this complaint entirely.
|
59
|
-
|
60
|
-
### Appbundler and bundler coexistance
|
61
|
-
|
62
|
-
Since this approach is deliberately inflexible against updating the appbundle pins in order to prevent transitive gem issues, it is instead possible and encouraged to
|
63
|
-
use Gemfile and bundler as usual. If the binstubs detect that they are running from within bundler against an external Gemfile.lock they do not apply any pins
|
64
|
-
at all.
|
65
|
-
|
66
|
-
* https://github.com/chef/chef-dk/issues/1547
|
67
|
-
* https://github.com/chef/appbundler/pull/43
|
68
|
-
|
69
|
-
### Encouraged use of bundler by end users
|
70
|
-
|
71
|
-
The ability to patch an existing omnibus built package is not well supported. What it would result in would be the user taking the application Gemfile and
|
72
|
-
patching it manually and producing a Gemfile.lock which was solved correctly and then running appubndler against that Gemfile.lock for all the applications in
|
73
|
-
the bundle. The difficult part is obviously the user updating the Gemfile.lock which cannot be automated and ultimately boils down to the process that we
|
74
|
-
use internally to solve gem conflict problems and produce the Gemfile.lock as an acutal product by experts.
|
75
|
-
|
76
|
-
What is vastly simpler is to create Gemfiles and use bundler to solve specific issues. In particular the problem of new ChefDK (e.g. ChefDK 3.x) managing
|
77
|
-
old chef-client (e.g. 12.x) can be solved via bundler in one specific case. For knife and test-kitchen the bootstrapped version of chef-client on the target
|
78
|
-
host is entirely configurable in those tools. The only major conflict is in the use of chefspec. For that use case, users are encouraged to create a much
|
79
|
-
more simplified Gemfile with a pinned chef version, berkshelf and chefspec and to `bundle install` and `bundle exec rspec` against the Gemfile.lock. This
|
80
|
-
targeted use of bundler is vastly simpler than attempting to create a Chef-12 "version" of ChefDK 3.x.
|
81
|
-
|
82
|
-
The alternative of trying to rebuild appbundled binstubs against an already built Chef-DK is documented here and is terrible idea:
|
83
|
-
|
84
|
-
https://github.com/chef/chef-dk/issues/1559#issuecomment-468103827
|
85
|
-
|
86
|
-
### BUG: you cannot install git gems using this method
|
87
|
-
|
88
|
-
This is simply a bug, although in practice it has turned into a feature. You should never ship git checked out non production released gems to customers, so should
|
89
|
-
always be doing downstream gem releases in order to consume them in omnibus builds. If this becomes a blocker this bug should just be fixed, but in practice this
|
90
|
-
has been a feature that has pushed development down the correct path.
|
91
|
-
|
92
|
-
### ChefDK transitive development gem Gemfile.locking madness
|
93
|
-
|
94
|
-
A sub-concern and design goal of the three-argument mega-Gemfile.lock appbundling feature is decoupling the purely development gem dependencies of sub-applications
|
95
|
-
from each other. This feature should perhaps have been designed to be decoupled, but since the whole feature was written somewhat "tactically" (aka "code rage")
|
96
|
-
to deal with the complexity of the ChefDK builds and this feature is necessary there and came along for the ride.
|
97
|
-
|
98
|
-
The ChefDK Gemfile.lock is already hard enough to build as it is, and it does not include any of the development gems for its sub-applications (berkshelf, test-kitchen,
|
99
|
-
foodcritic, chefspec, etc, etc, etc). It is already difficult enough to generate a sane single runtime closure across all the runtime gems. The development gems used
|
100
|
-
to test berkshelf, etc should not be shipped in the omnibus build. It is also an enormous amount of developer pain to keep the development gems consistent across all
|
101
|
-
of those projects, particularly when several of them are or historically were external to the company.
|
102
|
-
|
103
|
-
The result of that was a feature of the three argument version of appbundler where it takes the pins from the master ChefDK Gemfile.lock and merges those with the
|
104
|
-
gem statements in the Gemfile of the application (e.g. berkshelf) and then creates a combined Gemfile.lock which is written out in the gem directory. So for ChefDK
|
105
|
-
3.8.14 the combined Gemfile.lock which is created for berkshelf is:
|
106
|
-
|
107
|
-
```
|
108
|
-
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/berkshelf-7.0.7/.appbundler-gemfile20190227-93370-84j06u.lock
|
109
|
-
```
|
110
|
-
|
111
|
-
That Gemfile.lock is only solved, but not installed at build time when appbundler runs (`bundle lock` not `bundle update/install`) so that the development gems are not
|
112
|
-
shipped. In the testing phase of CI a `bundle install` is run against that so that all the development gems are installed on the testing box, all the pins in the
|
113
|
-
master Gemfile.lock will be applied (and those gems are already installed) and all the development gems of the app are installed with the constraints specified in
|
114
|
-
the Gemfile of the application. The testing suite is then run via `bundle exec` against this Gemfile.lock via the `chef test` command.
|
115
|
-
|
116
|
-
This ensures that we test the app against every gem pin that we ship, while we allow dev pins between different apps to potentially conflict since those have meaning
|
117
|
-
only to the app in question.
|
118
|
-
|
119
|
-
Yes, this is complicated, but the alternative(s) would be to either bake every dev gem into the master Gemfile.lock and take the pain of reconciling otherwise meaningless
|
120
|
-
gem conficts, or to allow gems to float outside of the Gemfile.lock pins and to be guaranteed of shipping defects sooner or later due to not testing against exactly
|
121
|
-
what we ship.
|
122
|
-
|
123
|
-
For any consumers outside of ChefDK this Gemfile.lock being created can happily be entirely ignored and it won't hurt you at all.
|
124
|
-
|
125
|
-
### The meaning of the --without arg is not what you think
|
126
|
-
|
127
|
-
The --without argument to appbundler in the three argument version does not apply to the installed gemset (that is handled entirely by the one `bundle install` which
|
128
|
-
should be run against the master Gemfile.lock before appbundler runs) and it does not apply to the appbundled binstubs.
|
129
|
-
|
130
|
-
What the --without argument does is affect the rendered transitive gemfile.lock and is used to filter out unnecessary dependencies which conflict with the master
|
131
|
-
Gemfile.lock in the omnibus project. A notable example of this was the github-changelog-generator gem which would pin gems (like `addressable`) to restrictive pins
|
132
|
-
and would not solve against the ChefDK master Gemfile.lock. If github-changelog-generator was in a `:changelog` group it could then be excluded here, and it would not
|
133
|
-
conflict during generation of the transitive per-app gemfile.lock.
|
134
|
-
|
135
|
-
This argument does not affect the shipping apps in the omnibus build (that should be handled by `--without` arguments to the `bundle install`) or affect the generated
|
136
|
-
binstubs. It is only in the codepath of the transitive lock generation and only affects the groups defined in the sub-application's Gemfile.
|
137
|
-
|
138
|
-
The `--without` argument was also added to the 3-argument version of appbundler specifically to handle this issue. It is silently ignored on the 2-argument version.
|
139
|
-
|
140
|
-
## Usage
|
141
|
-
|
142
|
-
Install via rubygems: `gem install appbundler` or clone this project and bundle install:
|
143
|
-
|
144
|
-
```shell
|
145
|
-
git clone https://github.com/chef/appbundler.git
|
146
|
-
cd appbundler
|
147
|
-
bundle install
|
148
|
-
```
|
149
|
-
|
150
|
-
Clone whatever project you want to appbundle somewhere else, and bundle install it:
|
151
|
-
|
152
|
-
```shell
|
153
|
-
mkdir ~/oc
|
154
|
-
cd ~/oc
|
155
|
-
git clone https://github.com/chef/chef.git
|
156
|
-
cd chef
|
157
|
-
bundle install
|
158
|
-
```
|
159
|
-
|
160
|
-
Create a bin directory where your bundled binstubs will live:
|
161
|
-
|
162
|
-
```shell
|
163
|
-
mkdir ~/appbundle-bin
|
164
|
-
# Add to your PATH if you like
|
165
|
-
```
|
166
|
-
|
167
|
-
Now you can app bundle your project (chef in our example):
|
168
|
-
|
169
|
-
```shell
|
170
|
-
bin/appbundler ~/oc/chef ~/appbundler-bin
|
171
|
-
```
|
172
|
-
|
173
|
-
Now you can run all of the app's executables with locked down deps:
|
174
|
-
|
175
|
-
```shell
|
176
|
-
~/appbundler-bin/chef-client -v
|
177
|
-
```
|
178
|
-
|
179
|
-
## RVM
|
180
|
-
|
181
|
-
The generated binstubs explicitly disable rvm, so the above won't work if you're using rvm. This is intentional, because our use case is for omnibus applications where rvm's environment variables can break the embedded application by making ruby look for gems in rvm's gem repo.
|
182
|
-
|
183
|
-
## Contributing
|
184
|
-
|
185
|
-
For information on contributing to this project see <https://github.com/chef/chef/blob/master/CONTRIBUTING.md>
|
186
|
-
|
187
|
-
## License
|
188
|
-
|
189
|
-
- Copyright:: Copyright (c) 2014-2016 Chef Software, Inc.
|
190
|
-
- License:: Apache License, Version 2.0
|
191
|
-
|
192
|
-
```text
|
193
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
194
|
-
you may not use this file except in compliance with the License.
|
195
|
-
You may obtain a copy of the License at
|
196
|
-
|
197
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
198
|
-
|
199
|
-
Unless required by applicable law or agreed to in writing, software
|
200
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
201
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
202
|
-
See the License for the specific language governing permissions and
|
203
|
-
limitations under the License.
|
204
|
-
```
|