appbundler 0.11.6 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.expeditor/config.yml +43 -0
- data/.expeditor/update_version.sh +12 -0
- data/.github/CODEOWNERS +5 -0
- data/.github/ISSUE_TEMPLATE.md +21 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +14 -0
- data/.github/lock.yml +1 -0
- data/.travis.yml +6 -4
- data/CHANGELOG.md +22 -0
- data/CODE_OF_CONDUCT.md +1 -0
- data/README.md +125 -1
- data/VERSION +1 -0
- data/appbundler.gemspec +5 -5
- data/lib/appbundler/app.rb +73 -0
- data/lib/appbundler/version.rb +1 -1
- metadata +31 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b90fc1cd44078573f169f8eb73c35176a6ed31197017d2674e26fb210de64e7c
|
4
|
+
data.tar.gz: 4bb6f4bdb731359d70371424e5d9c46d4204162a5acd7c7563b712318c246591
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43c039d754b3f17c3475068125fa8bb79d45860370c31cfa614a3e778c5c90c0ebae16d3b0d63f14399b8260e9a223814207e649677956d838fb6c85dec7bd2a
|
7
|
+
data.tar.gz: b24147d402b51d1db6e82ad768012c0bfd7f30aa13470252e69ea7d9e404cb651718bccdb3faae371285f720b31e21fd1410727778413a7c16f08faa8558e54e
|
@@ -0,0 +1,43 @@
|
|
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
|
+
major_bump_labels:
|
20
|
+
- "Expeditor: Bump Version Major"
|
21
|
+
|
22
|
+
changelog:
|
23
|
+
rollup_header: Changes not yet released to rubygems.org
|
24
|
+
|
25
|
+
# These actions are taken, in order they are specified, anytime a Pull Request is merged.
|
26
|
+
merge_actions:
|
27
|
+
- built_in:bump_version:
|
28
|
+
ignore_labels:
|
29
|
+
- "Expeditor: Skip Version Bump"
|
30
|
+
- "Expeditor: Skip All"
|
31
|
+
- bash:.expeditor/update_version.sh:
|
32
|
+
only_if: built_in:bump_version
|
33
|
+
- built_in:update_changelog:
|
34
|
+
ignore_labels:
|
35
|
+
- "Expeditor: Exclude From Changelog"
|
36
|
+
- "Expeditor: Skip All"
|
37
|
+
- built_in:build_gem:
|
38
|
+
only_if: built_in:bump_version
|
39
|
+
|
40
|
+
promote:
|
41
|
+
actions:
|
42
|
+
- built_in:rollover_changelog
|
43
|
+
- built_in:publish_rubygems
|
@@ -0,0 +1,12 @@
|
|
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
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Version:
|
2
|
+
|
3
|
+
[Version of the project installed]
|
4
|
+
|
5
|
+
# Environment: [Details about the environment such as the Operating System, cookbook details, etc...]
|
6
|
+
|
7
|
+
# Scenario:
|
8
|
+
|
9
|
+
[What you are trying to achieve and you can't?]
|
10
|
+
|
11
|
+
# Steps to Reproduce:
|
12
|
+
|
13
|
+
[If you are filing an issue what are the things we need to do in order to repro your problem?]
|
14
|
+
|
15
|
+
# Expected Result:
|
16
|
+
|
17
|
+
[What are you expecting to happen as the consequence of above reproduction steps?]
|
18
|
+
|
19
|
+
# Actual Result:
|
20
|
+
|
21
|
+
[What actually happens after the reproduction steps?]
|
@@ -0,0 +1,14 @@
|
|
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>
|
data/.github/lock.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
daysUntilLock: 60
|
data/.travis.yml
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
language: ruby
|
2
2
|
cache: bundler
|
3
|
-
dist:
|
3
|
+
dist: xenial
|
4
4
|
|
5
5
|
before_install:
|
6
6
|
- gem update --system
|
7
|
-
- gem install bundler
|
7
|
+
- gem install bundler || true
|
8
8
|
|
9
9
|
rvm:
|
10
|
-
- 2.
|
11
|
-
- 2.5
|
10
|
+
- 2.3.8
|
11
|
+
- 2.4.5
|
12
|
+
- 2.5.5
|
13
|
+
- 2.6.2
|
12
14
|
|
13
15
|
branches:
|
14
16
|
only:
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Appbundler CHANGELOG
|
2
|
+
|
3
|
+
This file is used to document the changes between releases of Appbundler
|
4
|
+
|
5
|
+
<!-- latest_release 0.12.0 -->
|
6
|
+
## [v0.12.0](https://github.com/chef/appbundler/tree/v0.12.0) (2019-03-18)
|
7
|
+
|
8
|
+
#### Merged Pull Requests
|
9
|
+
- Fix the labels to properly bump the gem [#49](https://github.com/chef/appbundler/pull/49) ([tas50](https://github.com/tas50))
|
10
|
+
<!-- latest_release -->
|
11
|
+
|
12
|
+
<!-- release_rollup since=0.11.6 -->
|
13
|
+
### Changes not yet released to rubygems.org
|
14
|
+
|
15
|
+
#### Merged Pull Requests
|
16
|
+
- Fix the labels to properly bump the gem [#49](https://github.com/chef/appbundler/pull/49) ([tas50](https://github.com/tas50)) <!-- 0.12.0 -->
|
17
|
+
- Require ruby 2.3+ and loosen gem deps [#48](https://github.com/chef/appbundler/pull/48) ([tas50](https://github.com/tas50)) <!-- 0.11.9 -->
|
18
|
+
- Update README.md [#47](https://github.com/chef/appbundler/pull/47) ([markan](https://github.com/markan)) <!-- 0.11.8 -->
|
19
|
+
<!-- release_rollup -->
|
20
|
+
|
21
|
+
<!-- latest_stable_release -->
|
22
|
+
<!-- latest_stable_release -->
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Please refer to the Chef Community Code of Conduct at https://www.chef.io/code-of-conduct/
|
data/README.md
CHANGED
@@ -13,6 +13,130 @@ This provides the following benefits:
|
|
13
13
|
- A user can use rvm and still use the application (see below).
|
14
14
|
- The application is protected from installation of incompatible dependencies.
|
15
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
|
+
|
16
140
|
## Usage
|
17
141
|
|
18
142
|
Install via rubygems: `gem install appbundler` or clone this project and bundle install:
|
@@ -49,7 +173,7 @@ bin/appbundler ~/oc/chef ~/appbundler-bin
|
|
49
173
|
Now you can run all of the app's executables with locked down deps:
|
50
174
|
|
51
175
|
```shell
|
52
|
-
~/
|
176
|
+
~/appbundler-bin/chef-client -v
|
53
177
|
```
|
54
178
|
|
55
179
|
## RVM
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.12.0
|
data/appbundler.gemspec
CHANGED
@@ -6,8 +6,8 @@ require "appbundler/version"
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "appbundler"
|
8
8
|
spec.version = Appbundler::VERSION
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["
|
9
|
+
spec.authors = ["Chef Software, Inc."]
|
10
|
+
spec.email = ["info@chef.io"]
|
11
11
|
spec.description = %q{Extracts a dependency solution from bundler's Gemfile.lock to speed gem activation}
|
12
12
|
spec.summary = spec.description
|
13
13
|
spec.homepage = "https://github.com/chef/appbundler"
|
@@ -18,12 +18,12 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.required_ruby_version = ">= 2.
|
21
|
+
spec.required_ruby_version = ">= 2.3"
|
22
22
|
|
23
23
|
spec.add_development_dependency "rake"
|
24
24
|
spec.add_development_dependency "rspec", "~> 3.0"
|
25
25
|
spec.add_development_dependency "pry"
|
26
26
|
|
27
|
-
spec.add_dependency "mixlib-shellout", "
|
28
|
-
spec.add_dependency "mixlib-cli", "
|
27
|
+
spec.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
|
28
|
+
spec.add_dependency "mixlib-cli", ">= 1.4", "< 3.0"
|
29
29
|
end
|
data/lib/appbundler/app.rb
CHANGED
@@ -18,12 +18,30 @@ module Appbundler
|
|
18
18
|
attr_reader :target_bin_dir
|
19
19
|
attr_reader :name
|
20
20
|
|
21
|
+
# The bundle_path is always the path to the Gemfile.lock being used, e.g.
|
22
|
+
# /var/cache/omnibus/src/chef/chef-14.10.9/Gemfile.lock or whatever. If
|
23
|
+
# the name if the gem is not set then we behave like old style 2-arg appbundling
|
24
|
+
# where the gem we are appbundling is in the gemspec in that directory.
|
25
|
+
#
|
26
|
+
# If the name is not nil, then we are doing a multiple-app appbundle where
|
27
|
+
# the Gemfile.lock is the omnibus Gemfile.lock and multiple app gems may be
|
28
|
+
# appbundled against the same Gemfile.lock.
|
29
|
+
#
|
30
|
+
# @param bundle_path [String] the directory path of the Gemfile.lock
|
31
|
+
# @param target_bin_dir [String] the binstub dir, e.g. /opt/chefdk/bin
|
32
|
+
# @param name [String] name of the gem
|
21
33
|
def initialize(bundle_path, target_bin_dir, name)
|
22
34
|
@bundle_path = bundle_path
|
23
35
|
@target_bin_dir = target_bin_dir
|
24
36
|
@name = name
|
25
37
|
end
|
26
38
|
|
39
|
+
# For the 2-arg version this is the gemfile in the omnibus build directory:
|
40
|
+
# /var/cache/omnibus/src/chef/chef-14.10.9/Gemfile
|
41
|
+
#
|
42
|
+
# For the 3-arg version this is the gemfile in the gems installed directory:
|
43
|
+
# /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/berkshelf-7.0.7/Gemfile
|
44
|
+
#
|
27
45
|
def gemfile_path
|
28
46
|
"#{app_dir}/Gemfile"
|
29
47
|
end
|
@@ -38,6 +56,22 @@ module Appbundler
|
|
38
56
|
req.as_list.map { |r| "\"#{r}\"" }.join(", ")
|
39
57
|
end
|
40
58
|
|
59
|
+
# This is only used in the 3-arg version. The gemfile_path is the path into the actual
|
60
|
+
# installed gem, e.g.: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/berkshelf-7.0.7/Gemfile
|
61
|
+
#
|
62
|
+
# The gemfile_lock is the omnibus gemfile.lock which is in this case:
|
63
|
+
# /var/cache/omnibus/src/chef-dk/chef-dk-3.8.14/Gemfile.lock
|
64
|
+
#
|
65
|
+
# This solves the app gems dependencies against the Gemfile.locks pins so that they do not
|
66
|
+
# conflict (assuming such a solution can be found).
|
67
|
+
#
|
68
|
+
# The "without" argument here applies to the app's Gemfile. There is no information in
|
69
|
+
# a rendered Gemfile.lock about gem groupings (literally none of that information is ever
|
70
|
+
# rendered by bundler into a Gemfile.lock -- open one up and look for yourself). So this
|
71
|
+
# without argument then applies only to the transitive gemfile locking creation. This
|
72
|
+
# codepath does not affect what gems we ship, and does not affect the generation of the
|
73
|
+
# binstubs.
|
74
|
+
#
|
41
75
|
def requested_dependencies(without)
|
42
76
|
Bundler.settings.temporary(without: without) do
|
43
77
|
definition = Bundler::Definition.build(gemfile_path, gemfile_lock, nil)
|
@@ -52,10 +86,27 @@ module Appbundler
|
|
52
86
|
"github_changelog_generator",
|
53
87
|
]
|
54
88
|
|
89
|
+
# This is a check which is equivalent to asking if we are running 2-arg or 3-arg. If
|
90
|
+
# we have an "external_lockfile" that means the chef-dk omnibus Gemfile.lock, e.g.:
|
91
|
+
# /var/cache/omnibus/src/chef-dk/chef-dk-3.8.14/Gemfile.lock is being merged with the
|
92
|
+
# Gemfile in e.g. /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/berkshelf-7.0.7/Gemfile.
|
93
|
+
# Hence the lockfile is "external" to the gem (it made sense to me at the time).
|
94
|
+
#
|
95
|
+
# If it is not then we're dealing with a single gem install from a single project and not
|
96
|
+
# doing any of the transitive locking and we generate a single set of binstubs from a single
|
97
|
+
# app in a single Gemfile.lock
|
98
|
+
#
|
55
99
|
def external_lockfile?
|
56
100
|
app_dir != bundle_path
|
57
101
|
end
|
58
102
|
|
103
|
+
# This loads the specs from the Gemfile.lock which is called on the command line and is in
|
104
|
+
# the omnibus build space.
|
105
|
+
#
|
106
|
+
# Somewhat confusingly this is also the same as the "external" gemfile.lock, which was originally
|
107
|
+
# called the "local" gemfile.lock here. In either case it is something like:
|
108
|
+
# /var/cache/omnibus/src/chef-dk/chef-dk-3.8.14/Gemfile.lock
|
109
|
+
#
|
59
110
|
def local_gemfile_lock_specs
|
60
111
|
gemfile_lock_specs.map do |s|
|
61
112
|
#if SHITLIST.include?(s.name)
|
@@ -68,6 +119,10 @@ module Appbundler
|
|
68
119
|
|
69
120
|
# Copy over any .bundler and Gemfile.lock files to the target gem
|
70
121
|
# directory. This will let us run tests from under that directory.
|
122
|
+
#
|
123
|
+
# This is only on the 2-arg implementations pathway. This is not used
|
124
|
+
# for the 3-arg version.
|
125
|
+
#
|
71
126
|
def copy_bundler_env
|
72
127
|
gem_path = installed_spec.gem_dir
|
73
128
|
# If we're already using that directory, don't copy (it won't work anyway)
|
@@ -79,6 +134,12 @@ module Appbundler
|
|
79
134
|
end
|
80
135
|
end
|
81
136
|
|
137
|
+
# This is the implementation of the 3-arg version of writing the merged lockfiles,
|
138
|
+
# when called with the 2-arg version it short-circuits, however, to the copy_bundler_env
|
139
|
+
# version above.
|
140
|
+
#
|
141
|
+
# This code does not affect the generated binstubs at all.
|
142
|
+
#
|
82
143
|
def write_merged_lockfiles(without: [])
|
83
144
|
unless external_lockfile?
|
84
145
|
copy_bundler_env
|
@@ -296,6 +357,12 @@ E
|
|
296
357
|
Gem::Specification.find_by_name(app_spec.name, app_spec.version)
|
297
358
|
end
|
298
359
|
|
360
|
+
# In the 2-arg version of appbundler this loads the gemspec from the omnibus source
|
361
|
+
# build directory (e.g. /var/cache/omnibus/src/chef/chef-14.10.9/chef.gemspec)
|
362
|
+
#
|
363
|
+
# For the 3-arg version of appbundler this loads the gemspec from the installed path
|
364
|
+
# of the gem (e.g. /opt/chefdk/embedded/lib/ruby/gems/2.5.0/specifications/berkshelf-7.0.7.gemspec)
|
365
|
+
#
|
299
366
|
def app_spec
|
300
367
|
if name.nil?
|
301
368
|
Gem::Specification.load("#{bundle_path}/#{File.basename(@bundle_path)}.gemspec")
|
@@ -304,6 +371,12 @@ E
|
|
304
371
|
end
|
305
372
|
end
|
306
373
|
|
374
|
+
# In the 2-arg version of appbundler this will be the the appdir of the gemspec in the
|
375
|
+
# omnibus build directory (e.g. /var/cache/omnibus/src/chef/chef-14.10.9)
|
376
|
+
#
|
377
|
+
# In the 3-arg version of appbundler this will be the installed gems path
|
378
|
+
# (e.g. /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/berkshelf-7.0.7/)
|
379
|
+
#
|
307
380
|
def app_dir
|
308
381
|
if name.nil?
|
309
382
|
File.dirname(app_spec.loaded_from)
|
data/lib/appbundler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appbundler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
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: 2019-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -56,46 +56,67 @@ dependencies:
|
|
56
56
|
name: mixlib-shellout
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.0'
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '4.0'
|
62
65
|
type: :runtime
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
|
-
- - "
|
69
|
+
- - ">="
|
67
70
|
- !ruby/object:Gem::Version
|
68
71
|
version: '2.0'
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '4.0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: mixlib-cli
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
|
-
- - "
|
79
|
+
- - ">="
|
74
80
|
- !ruby/object:Gem::Version
|
75
81
|
version: '1.4'
|
82
|
+
- - "<"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '3.0'
|
76
85
|
type: :runtime
|
77
86
|
prerelease: false
|
78
87
|
version_requirements: !ruby/object:Gem::Requirement
|
79
88
|
requirements:
|
80
|
-
- - "
|
89
|
+
- - ">="
|
81
90
|
- !ruby/object:Gem::Version
|
82
91
|
version: '1.4'
|
92
|
+
- - "<"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '3.0'
|
83
95
|
description: Extracts a dependency solution from bundler's Gemfile.lock to speed gem
|
84
96
|
activation
|
85
97
|
email:
|
86
|
-
-
|
98
|
+
- info@chef.io
|
87
99
|
executables:
|
88
100
|
- appbundler
|
89
101
|
extensions: []
|
90
102
|
extra_rdoc_files: []
|
91
103
|
files:
|
104
|
+
- ".expeditor/config.yml"
|
105
|
+
- ".expeditor/update_version.sh"
|
106
|
+
- ".github/CODEOWNERS"
|
107
|
+
- ".github/ISSUE_TEMPLATE.md"
|
108
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
109
|
+
- ".github/lock.yml"
|
92
110
|
- ".gitignore"
|
93
111
|
- ".rspec"
|
94
112
|
- ".travis.yml"
|
113
|
+
- CHANGELOG.md
|
114
|
+
- CODE_OF_CONDUCT.md
|
95
115
|
- Gemfile
|
96
116
|
- LICENSE.txt
|
97
117
|
- README.md
|
98
118
|
- Rakefile
|
119
|
+
- VERSION
|
99
120
|
- appbundler.gemspec
|
100
121
|
- bin/appbundler
|
101
122
|
- lib/appbundler.rb
|
@@ -125,15 +146,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
146
|
requirements:
|
126
147
|
- - ">="
|
127
148
|
- !ruby/object:Gem::Version
|
128
|
-
version: 2.
|
149
|
+
version: '2.3'
|
129
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
151
|
requirements:
|
131
152
|
- - ">="
|
132
153
|
- !ruby/object:Gem::Version
|
133
154
|
version: '0'
|
134
155
|
requirements: []
|
135
|
-
|
136
|
-
rubygems_version: 2.7.6
|
156
|
+
rubygems_version: 3.0.1
|
137
157
|
signing_key:
|
138
158
|
specification_version: 4
|
139
159
|
summary: Extracts a dependency solution from bundler's Gemfile.lock to speed gem activation
|