knife-spork 0.1.11 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .project
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@knife-spork --create
data/CHANGELOG.md CHANGED
@@ -1,23 +1,37 @@
1
+ ## 1.0.0 (27th August, 2012)
2
+ Features:
3
+
4
+ - Major refactor (initial refactor: Seth Vargo)
5
+ - Plugin API (Seth Vargo)
6
+ - Added "spork info" command to show config hash and plugins status
7
+ - Missing local / remote cookbook now handled nicely in spork check
8
+ - Add "--fail" option to spork check to "exit 1" if check fails
9
+ - Git plugin now uses git gem instead of shelling out
10
+ - Confirmation check on promote if version jumps more than version_change_threshold
11
+ - Thanks also to jperry, bethanybenzur and nickmarden for contributions submitted pre-refactor which have been included in one form or another.
12
+
13
+
14
+
1
15
  ## 0.1.11 (5th June, 2012)
2
16
  Features:
3
17
 
4
18
  - Hipchat Support (courtesy of Chris Ferry: @cdferry)
5
-
19
+
6
20
  Bugfixes:
7
-
21
+
8
22
  - Tweaks to spork bump to play nicely with x.x versions as well as x.x.x (courtesy of Russ Garrett: @russss)
9
-
23
+
10
24
  ## 0.1.10 (12th April, 2012)
11
25
  Features:
12
26
 
13
27
  - All spork plugins now support multiple cookbook paths
14
-
28
+
15
29
  Bugfixes:
16
-
30
+
17
31
  - Fixes to work with app_conf 0.4.0
18
-
32
+
19
33
  ## 0.1.9 (3rd April, 2012)
20
-
34
+
21
35
  Features:
22
36
 
23
37
  - Spork Promote will now git add updated environment files if git is enabled
@@ -25,24 +39,24 @@ Features:
25
39
  - Spork Bump will now perform a git pull and pull from submodules if git is enabled
26
40
  - Optional Foodcritic integration added for Spork Upload
27
41
  - ickymettle's Eventinator service now optionally supported
28
-
42
+
29
43
  Bugfixes:
30
44
 
31
45
  - Correct irccat alerts to not fire if cookbook upload fails
32
46
  - Code cleanup to remove unused Opscode code from Spork Upload
33
47
 
34
48
  ## 0.1.8 (21st February, 2012)
35
-
49
+
36
50
  Features:
37
51
 
38
52
  - Make promote --remote check if the correct version of the cookbook has been uploaded before updating the remote environment
39
-
53
+
40
54
  ## 0.1.7 (21st February, 2012)
41
-
55
+
42
56
  Bugfixes:
43
57
 
44
58
  - Make promote --remote work nicely when not run from chef repo root
45
-
59
+
46
60
  ## 0.1.6 (21st February, 2012)
47
61
  Features:
48
62
 
@@ -53,17 +67,17 @@ Features:
53
67
  - Spork Promote will now also update git submodules before promoting. Specifically, it will run "git submodule foreach git pull"
54
68
  - Failures during "git add" on spork bumps have a more helpful error message
55
69
  - Irccat messages are now more nicely formatted and have pretty colours.
56
-
70
+
57
71
  Bugfixes:
58
-
72
+
59
73
  - Spork Promote will now work from anywhere in your chef repo, not just the repo root
60
-
74
+
61
75
  ## 0.1.5 (21st February, 2012)
62
-
76
+
63
77
  Yanked
64
78
 
65
79
  ## 0.1.4 (3rd February, 2012)
66
-
80
+
67
81
  Features:
68
82
 
69
83
  - Spork Check only show the last 5 remote versions, include the --all option if you want to see them all
@@ -73,21 +87,21 @@ Features:
73
87
  - It will also optionally post a gist of version constraint changes in the above message when a promote --remote happens
74
88
  - Added support for default environments to promote to
75
89
  - knife-spork gemification thanks to Daniel Schauenberg
76
-
90
+
77
91
  Bugfixes:
78
92
 
79
93
  - Various bugfixes and tweaks to formatting and log messages
80
-
94
+
81
95
  ## 0.1.4 (3rd February, 2012)
82
-
96
+
83
97
  Yanked
84
98
 
85
99
  ## 0.1.3 (3rd February, 2012)
86
-
100
+
87
101
  Yanked
88
102
 
89
103
  ## 0.1.2 (3rd February, 2012)
90
-
104
+
91
105
  Yanked
92
106
 
93
107
  ## 0.1.1 (3rd February, 2012)
@@ -96,4 +110,4 @@ Yanked
96
110
 
97
111
  ## 0.1.0 (January 28, 2012)
98
112
 
99
- Initial version.
113
+ Initial version.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,35 @@
1
+ KnifeSpork
2
+ ----------
3
+ Author:: Jon Cowie (<jonlives@gmail.com>)
4
+ Copyright:: Copyright (c) 2011 Jon Cowie
5
+ License:: GPL
6
+
7
+ Plugin API
8
+ ----------
9
+ Author:: Seth Vargo (<svargo@customink.com>)
10
+ Copyright:: Copyright (c) 2012 Seth Vargo
11
+ License:: GPL
12
+
13
+ Other
14
+ -----
15
+ Based on the knife-cookbook-bump plugin by:
16
+ Alalanta (no license specified)
17
+
18
+ With snippets from:
19
+ Author:: Adam Jacob (<adam@opscode.com>)
20
+ Author:: Christopher Walters (<cw@opscode.com>)
21
+ Author:: Nuo Yan (<yan.nuo@gmail.com>)
22
+ Copyright:: Copyright (c) 2009, 2010 Opscode, Inc.
23
+ License:: Apache License, Version 2.0
24
+
25
+ Licensed under the Apache License, Version 2.0 (the "License");
26
+ you may not use this file except in compliance with the License.
27
+ You may obtain a copy of the License at
28
+
29
+ http://www.apache.org/licenses/LICENSE-2.0
30
+
31
+ Unless required by applicable law or agreed to in writing, software
32
+ distributed under the License is distributed on an "AS IS" BASIS,
33
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
+ See the License for the specific language governing permissions and
35
+ limitations under the License.
data/README.md CHANGED
@@ -1,258 +1,241 @@
1
- # knife-spork
1
+ KnifeSpork
2
+ ===========
3
+ KnifeSpork is a workflow plugin for `Chef::Knife` which helps multiple developers work on the same Chef Server and repository without treading on eachother's toes. This plugin was designed around the workflow we have here at Etsy, where several people are working on the Chef repository and Chef Server simultaneously. It contains several functions, documented below:
2
4
 
3
- A workflow plugin for Chef::Knife which helps multiple devs work on the same chef server and repo without treading on eachothers toes. This plugin was designed around the workflow we have here at Etsy, where several people are working on the chef repo and chef server at the same time. It contains several functions, documented below:
5
+ Installation
6
+ ------------
7
+ ### Gem Install (recommended)
8
+ `knife-spork` is available on rubygems. Add the following to your `Gemfile`:
4
9
 
5
- # Installation
10
+ ```ruby
11
+ gem 'knife-spork'
12
+ ```
6
13
 
7
- ## SCRIPT INSTALL
14
+ or install the gem manually:
8
15
 
9
- Copy spork-* script from lib/chef/knife/spork-*.rb to your ~/.chef/plugins/knife directory.
10
-
11
- ## GEM INSTALL
12
- knife-spork is available on rubygems.org - if you have that source in your gemrc, you can simply use:
13
-
14
- ````
16
+ ```bash
15
17
  gem install knife-spork
16
- ````
17
-
18
- # Spork Configuration
19
-
20
- Out of the box, knife spork will work with no configuration. However, you can optionally enable several features to enhance it's functionality.
21
-
22
- Knife Spork will look for it's config file in the following locations, in ascending order of precedence.
23
-
24
- * <chef-repo>/config/spork-config.yml
25
- * /etc/spork-config.yml
26
- * ~/.chef/spork-config.yml
27
-
28
- Anything set in the config file in your home directory for example, will override options set in your chef repo or /etc.
29
-
30
- Below is a sample config file with all supported options enabled below, followed by an explanation of each section.
31
-
32
- ````
33
- git:
34
- enabled: true
35
- hipchat:
36
- enabled: true
37
- apikey: MYAPIKEYHERE
38
- nickname: "Knife-Spork"
39
- room: "Chef"
40
- notify: true
41
- color: "red"
42
- irccat:
43
- enabled: true
44
- server: irccat.mycompany.com
45
- port: 12345
46
- channel: "#chef"
47
- graphite:
48
- enabled: true
49
- server: graphite.mycompany.com
50
- port: 2003
51
- gist:
52
- enabled: true
53
- in_chef: true
54
- chef_path: cookbooks/gist/files/default/gist
55
- path: /usr/bin/gist
56
- foodcritic:
57
- enabled: true
58
- fail_tags: [any]
59
- tags: [foo]
60
- include_rules: [/home/me/myrules]
61
- default_environments: [ production, development ]
62
- ````
63
- ## Git
64
-
65
- This section enables a couple of git commands which will run as part of your spork workflow, namely:
66
-
67
- * When you bump a cookbook's version, the relevant metadata.rb file will be git added
68
- * When you promote an environment, git pull will be run before your changes are made.
69
-
70
- ## HipChat
71
-
72
- Notifications will be sent to the HipChat room of your choice. Currently notifies on
73
-
74
- * When a cookbook is uploaded using spork upload
75
- * When an environment is promoted to the server using promote --remote
18
+ ```
76
19
 
77
- color: "yellow", "red", "green", "purple", or "random"
78
-
79
- ## Irccat
80
-
81
- If you're using the irccat (https://github.com/RJ/irccat) irc bot, this lets you post notifications to the channel of your choice. It currently notifies on
82
-
83
- * When a cookbook is uploaded using spork upload
84
- * When an environment is promoted to the server using promote --remote
85
-
86
- ## Graphite
87
-
88
- This lets you send to a graphite metric when promote --remote is performed. It send to the metric deploys.chef.<environment>
89
-
90
- ## Gist
91
-
92
- This allows you to generate an optional gist of environment changes which will be added to irccat notifications on promote --remote. It supports the https://rubygems.org/gems/gist, and contains two parameters to use a version in your chef repo, or a version installed somewhere else locally.
93
-
94
- ## Foodcritic
95
-
96
- This allows you to run a foodcritic lint check against your cookbook before spork uploading. The check only runs against the cookbook you've passed to spork-upload on the command line.
97
-
98
- PLEASE NOTE: Due to it's many dependancies (gem dependancy Nokogiri requires libxml-devel, libxslt-devel), foodcritic is not specified as a dependency of the knife-spork gem as it won't install without other manual package installs, so if you want to use it you'll need to make sure it's installed yourself for now. This may change in a future version.
20
+ ### Plugin Install
21
+ Copy spork-* script from lib/chef/knife/spork-*.rb to your ~/.chef/plugins/knife directory.
99
22
 
100
- The optional attributes for this section work as follows:
23
+ Spork Configuration
24
+ -------------------
25
+ Out of the box, knife spork will work with no configuration. However, you can optionally enable several features to enhance its functionality.
26
+
27
+ KnifeSpork will look for a configuration file in the following locations, in ascending order of precedence:
28
+
29
+ - `config/spork-config.yml`
30
+ - `/etc/spork-config.yml`
31
+ - `~/.chef/spork-config.yml`
32
+
33
+ Anything set in the configuration file in your home directory for example, will override options set in your Chef repository or `/etc`.
34
+
35
+ Below is a sample config file with all supported options and all shipped plugins enabled below, followed by an explanation of each section.
36
+
37
+ ```yaml
38
+ default_environments:
39
+ - development
40
+ - production
41
+ version_change_threshold:
42
+ plugins:
43
+ campfire:
44
+ account: myaccount
45
+ token: a1b2c3d4...
46
+ hipchat:
47
+ api_token: ABC123
48
+ rooms:
49
+ - General
50
+ - Web Operations
51
+ notify: true
52
+ color: yellow
53
+ git:
54
+ enabled: true
55
+ irccat:
56
+ server: irccat.mydomain.com
57
+ port: 12345
58
+ gist: "/usr/bin/gist"
59
+ channel: ["chef-annoucements"]
60
+ graphite:
61
+ server: graphite.mydomain.com
62
+ port: 2003
63
+ eventinator:
64
+ url: http://eventinator.mydomain.com/events/oneshot
65
+ ```
66
+
67
+ #### Default Environments
68
+ The `default_environments` directive allows you to specify a default list of environments you want to promote changes to. If this option is configured and you *ommit* the environment parameter when promoting KnifeSpork will promote to all environments in this list.
69
+
70
+ #### Version Change Threshold
71
+ The `version_change_threshold` directive allows you to customise the threshold used by a safety check in spork promote which will prompt for confirmation if you're promoting a cookbook by more than version_change_threshold versions. This defaults to 2 if not set, ie promoting a cookbook from v1.0.1 to v 1.0.2 will not trip this check, wheras promoting from v1.0.1 to v1.0.3 will.
72
+
73
+ #### Plugins
74
+ Knife spork supports plugins to allow users to hook it into existing systems such as source control, monitoring and chat systems. Plugins are enabled / disabled by adding / removing their config block from the plugin section of the config file. Any of the default plugins shown above can be disabled by removing their section.
75
+
76
+ For more information on how to develop plugins for spork, please read the plugins/README.md file.
77
+
78
+ Spork Info
79
+ -----------
80
+ This function is designed to help you see which plugins you currently have loaded, and the current config Hash which knife spork is using.
81
+
82
+ #### Usage
83
+ ```bash
84
+ knife spork info
85
+ ```
86
+
87
+ #### Example
88
+
89
+ ```text
90
+ $ knife spork info
91
+ Config Hash:
92
+ {"plugins"=>{"git"=>{"enabled"=>true}, "irccat"=>{"server"=>"irccat.mydomain.com", "port"=>12345, "gist"=>"usr/bin/gist", "channel"=>["#chef-announce"]}, "graphite"=>{"server"=>"graphite.mydomain.com", "port"=>2003}, "eventinator"=>{"url"=>"http://eventinator.mydomain.com/events/oneshot"}}, "default_environments"=>["development", "production"], "version_change_threshold"=>2, "pplugins"=>{"foodcritic"=>{"fail_tags"=>["style,correctness,test"], "tags"=>["~portability"], "include_rules"=>["config/rules.rb"]}}}
93
+
94
+ Plugins:
95
+ KnifeSpork::Plugins::Campfire: disabled
96
+ KnifeSpork::Plugins::Eventinator: enabled
97
+ KnifeSpork::Plugins::Foodcritic: disabled
98
+ KnifeSpork::Plugins::Git: enabled
99
+ KnifeSpork::Plugins::Graphite: enabled
100
+ KnifeSpork::Plugins::HipChat: disabled
101
+ KnifeSpork::Plugins::Irccat: enabled
102
+ ```
103
+
104
+ Spork Check
105
+ -----------
106
+ This function is designed to help you avoid trampling on other people's cookbook versions, and to make sure that when you come to version your own work it's easy to see what version numbers have already been used and if the one you're using will overwrite anything.
101
107
 
102
- fail_tags: Fail the build if any of the specified tags are matched.
103
- tags: Only check against rules with the specified tags.
104
- include_rules: Additional rule file path(s) to load.
108
+ #### Usage
109
+ ```bash
110
+ knife spork check COOKBOOK [--all]
111
+ ```
105
112
 
106
- ## Default Environments
113
+ By default, spork check only shows the 5 most recent remote cookbook versions. Add the --all option if you want to see everything.
107
114
 
108
- This allows you to specify a default list of environments you want to promote changes to. If this option is configured and you *ommit* the environment parameter when promoting, ie knife spork promote <cookbook>, then it will promote to all environments in this list.
115
+ #### Example (Checking an Unfrozen Cookbook with version clash)
109
116
 
110
- # Spork Check
117
+ ```text
118
+ $ knife spork check apache2
119
+ Checking versions for cookbook apache2...
111
120
 
112
- This function is designed to help you avoid trampling on other people's cookbook versions, and to make sure that when you come to version your own work it's easy to see what version numbers have already been used and if the one you're using will overwrite anything.
121
+ Local Version:
122
+ 1.1.49
113
123
 
114
- ## Usage
124
+ Remote Versions: (* indicates frozen)
125
+ *2.0.2
126
+ *2.0.1
127
+ 1.1.49
128
+ *1.1.14
129
+ *1.1.13
115
130
 
116
- ````
117
- knife spork check COOKBOOK ( --all)
118
- ````
131
+ ERROR: The version 1.1.49 exists on the server and is not frozen. Uploading will overwrite!
132
+ ```
119
133
 
120
- By default, spork check only shows the 5 most recent remote cookbook versions. Add the --all option if you want to see everything.
134
+ #### Example (Checking a Frozen Cookbook with version clash)
121
135
 
122
- ## Example (Checking an Unfrozen Cookbook with version clash)
136
+ ```text
137
+ $ knife spork check apache2
138
+ Checking versions for cookbook apache2...
123
139
 
124
- ````
125
- $ knife spork check apache
126
- Checking versions for cookbook apache...
127
-
128
- Current local version: 0.1.0
129
-
130
- Remote versions (Max. 5 most recent only):
131
- *0.1.0, unfrozen
132
- 0.0.0, unfrozen
133
-
134
- DANGER: Your local cookbook version number clashes with an unfrozen remote version.
135
-
136
- If you upload now, you'll overwrite it.
137
- ````
140
+ Local Version:
141
+ 2.0.2
138
142
 
139
- ## Example (Checking a Frozen Cookbook with version clash)
143
+ Remote Versions: (* indicates frozen)
144
+ *2.0.2
145
+ *2.0.1
146
+ 1.1.49
147
+ *1.1.14
148
+ *1.1.13
140
149
 
141
- ````
142
- $ knife spork check apache2
143
- Checking versions for cookbook apache2...
144
-
145
- Current local version: 1.0.6
146
-
147
- Remote versions (Max. 5 most recent only):
148
- *1.0.6, frozen
149
- 1.0.5, frozen
150
- 1.0.4, frozen
151
- 1.0.3, frozen
152
- 1.0.2, frozen
153
- 1.0.1, frozen
154
- 1.0.0, frozen
155
-
156
- DANGER: Your local cookbook has same version number as the starred version above!
157
-
158
- Please bump your local version or you won't be able to upload.
150
+ WARNING: Your local version (2.0.2) is frozen on the remote server. You'll need to bump before you can upload.
159
151
  ````
160
152
 
161
- ## Example (No version clashes)
153
+ #### Example (No version clashes)
162
154
 
163
- ````
155
+ ```text
164
156
  $ knife spork check apache2
165
157
  Checking versions for cookbook apache2...
166
-
167
- Current local version: 1.0.7
168
-
169
- Remote versions (Max. 5 most recent only):
170
- 1.0.6, frozen
171
- 1.0.5, frozen
172
- 1.0.4, frozen
173
- 1.0.3, frozen
174
- 1.0.2, frozen
175
- 1.0.1, frozen
176
- 1.0.0, frozen
177
-
178
- Everything looks fine, no version clashes. You can upload!
179
- ````
180
158
 
181
- # Spork Bump
159
+ Local Version:
160
+ 2.0.3
182
161
 
183
- This function lets you easily version your cookbooks without having to manually edit the cookbook's metadata.rb file. You can either specify the version level you'd like to bump (major, minor or patch), or you can manually specify a version number. This might be used if, for example, you want to jump several version numbers in one go and don't want to have to run knife bump once for each number.
162
+ Remote Versions: (* indicates frozen)
163
+ *2.0.2
164
+ *2.0.1
165
+ 1.1.49
166
+ *1.1.14
167
+ *1.1.13
184
168
 
185
- ## Usage
169
+ Everything looks good!
170
+ ```
186
171
 
187
- ````
188
- knife bump COOKBOOK <MAJOR | MINOR | PATCH | MANUAL x.x.x>
172
+ Spork Bump
173
+ ----------
174
+ This function lets you easily version your cookbooks without having to manually edit the cookbook's `metadata.rb` file. You can either specify the version level you'd like to bump (`major`, `minor`, or `patch`), or you can manually specify a version number. This might be used if, for example, you want to jump several version numbers in one go and don't want to have to run knife bump once for each number. If no bump level is specified, a patch level bump will be performed.
189
175
 
176
+ #### Usage
177
+ ```bash
178
+ knife spork bump COOKBOOK [MAJOR | MINOR | PATCH | MANUAL x.x.x]
190
179
  ````
191
180
 
192
- ## Example (Bumping patch level)
181
+ #### Example (No patch level specified - defaulting to patch)
182
+ ```text
183
+ $ knife spork bump apache2
184
+ Successfully bumped apache2 to v2.0.4!
193
185
 
194
- ````
186
+ #### Example (Bumping patch level)
187
+ ```text
195
188
  $ knife spork bump apache2 patch
196
- Bumping patch level of the apache2 cookbook from 1.0.6 to 1.0.7
189
+ Successfully bumped apache2 to v2.0.4!
197
190
  ````
198
191
 
199
- ## Example (Manually setting version)
200
-
201
- ````
192
+ #### Example (Manually setting version)
193
+ ```text
202
194
  $ knife spork bump apache2 manual 1.0.13
203
- Manually bumped version of the apache2 cookbook from 1.0.7 to 1.0.13
204
- ````
195
+ Successfully bumped apache2 to v1.0.13!
196
+ ```
205
197
 
206
- #Spork Upload
198
+ Spork Upload
199
+ ------------
200
+ This function works mostly the same as normal `knife cookbook upload COOKBOOK` except that this automatically freezes cookbooks when you upload them.
207
201
 
208
- This function works mostly the same as normal "knife cookbook upload" except that this version automatically freezes cookbooks when you upload them. If you don't want to have to remember to add "--freeze" to your "knife cookbook upload" commands, then use this version.
209
-
210
- ## Usage
211
-
212
- ````
202
+ #### Usage
203
+ ```bash
213
204
  knife spork upload COOKBOOK
214
- ````
215
-
216
- ## Example
217
-
218
- ````
219
- $ knife spork upload apache
220
-
221
- Uploading and freezing apache [1.0.6]
222
- upload complete
223
- ````
224
-
225
- # Spork Promote
226
-
227
- This function lets you easily set a version constraint in an environment for a particular cookbook. By default it will set the version constraint to whatever the local version of the specified cookbook is. Optionally, you can include a --version option which will set the version constraint for the specified cookbook to whatever version number you provide. You might want to use this if, for example, you pushed a version constraint for a cookbook version you don't want your nodes to use anymore, so you want to "roll back" the environment to a previous version. You can also specify the --remote option if you'd like to automatically upload your changed local environment file to the server.
228
-
229
- ## Usage
230
-
231
- ````
232
- knife spork promote ENVIRONMENT COOKBOOK (OPTIONS: --version, --remote)
233
- ````
234
-
235
- ## Example (Using local Cookbook version number, into environment "foo", uploading to chef server)
236
-
237
- ````
238
- $ knife spork promote foo php --remote
239
- Adding version constraint php = 0.1.0
240
-
241
- Saving changes into foo.json
242
-
243
- Uploading foo to server
244
-
245
- Promotion complete! Please remember to upload your changed Environment file to the Chef Server.
246
- ````
247
-
248
- ## Example (Using manual version, into environment "foo", saving to local environment file only)
249
-
250
- ````
251
- $ knife spork promote foo php -v 1.0.6
252
- Adding version constraint php = 1.0.6
253
-
254
- Saving changes into foo.json
255
-
256
- Promotion complete! Please remember to upload your changed Environment file to the Chef Server.
257
- ````
258
-
205
+ ```
206
+ #### Example
207
+ ```text
208
+ $ knife spork upload apache2
209
+ Freezing apache2 at 1.0.13...
210
+ Successfully uploaded apache2@1.0.13!
211
+ ```
212
+
213
+ Spork Promote
214
+ -------------
215
+ This function lets you easily set a version constraint in an environment for a particular cookbook. By default it will set the version constraint to whatever the local version of the specified cookbook is. Optionally, you can include a `--version` option which will set the version constraint for the specified cookbook to whatever version number you provide. You might want to use this if, for example, you pushed a version constraint for a cookbook version you don't want your nodes to use anymore, so you want to "roll back" the environment to a previous version. You can also specify the `--remote` option if you'd like to automatically upload your changed local environment file to the server.
216
+
217
+ If you don't specify an environment, the default_environments config directive will be used if set.
218
+
219
+ #### Usage
220
+
221
+ ```bash
222
+ knife spork promote [ENVIRONMENT] COOKBOOK [--version, --remote]
223
+ ```
224
+
225
+ #### Example (Using local cookbook version number)
226
+
227
+ ```text
228
+ $ knife spork promote my_environment apache2 --remote
229
+ Adding version constraint apache2 = 1.0.13
230
+ Saving changes to my_environment.json
231
+ Uploading my_environment to Chef Server
232
+ Promotion complete!
233
+ ```
234
+
235
+ #### Example (Using manual version)
236
+ ```text
237
+ $ knife spork promote my_environment apache2 -v 2.0.2
238
+ Adding version constraint apache2 = 2.0.2
239
+ Saving changes to my_environment.json
240
+ Promotion complete. Don't forget to upload your changed my_environment to Chef Server
241
+ ```