clc-promote 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +107 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bb2e8ce77e8107d62b221d47dcd485a1b8cfd78
|
4
|
+
data.tar.gz: 484229a859e81b88a960bafc7c5ef690a75c7faf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6efb5d1e4c07b4bf5279729caf7415fa1007809f66a683632658d79127785e9f25b5442f2e3d6bedefbe4dadbfa6980798c83453848ae2a170885b88a2f56e4f
|
7
|
+
data.tar.gz: 14fc885442580739a00e46ab152d27baf4ef7adfa33d5d7d6451c3036f504dab57d2039fbdfe524673a246bf85fadb57b303e364fe0481df3751c6e537673efc
|
data/README.md
CHANGED
@@ -1,2 +1,107 @@
|
|
1
|
-
# CLC-Promote
|
2
|
-
|
1
|
+
# CLC-Promote Gem
|
2
|
+
Drives our CI/CD pipeline and provides functionality for:
|
3
|
+
* Versioning cookbooks, data bags and environments
|
4
|
+
* Manages Cookbook version constraints within environments
|
5
|
+
* Manages the uploading of chef artifacts from CI to the QA chef Server and eventually to the production chef server
|
6
|
+
* Promotes one environment's cookbooks to another
|
7
|
+
|
8
|
+
This functionality is exposed via a collectin of rake tasks used on the CI server and a knife plugin used to perform deployments.
|
9
|
+
|
10
|
+
## Configuration
|
11
|
+
CLC-Promote uses configuration settings to determine the values of:
|
12
|
+
* Chef Server to contact
|
13
|
+
* User and `.pem` file to use for authentication
|
14
|
+
* Location of the chef repo
|
15
|
+
|
16
|
+
### Knife Configuration
|
17
|
+
When using the `knife promote` commands, these are pulled from your `knife.rb` file as long as you are inside of the chef-repo.You can also set these using the usual knife parameters.
|
18
|
+
|
19
|
+
Additional knife config settings are used when interacting with a production chef server. The typical chef server config settings in a `knife.rb` are used for talking to a QA server. Production server settings are stored in the following settings:
|
20
|
+
```ruby
|
21
|
+
knife[:promote_prod_url] = "https://chef.t3n.dom/organizations/clc_prod"
|
22
|
+
knife[:promote_prod_user] = user
|
23
|
+
knife[:promote_prod_client_key] = "#{current_dir}/#{node_name}_VA1.pem"
|
24
|
+
```
|
25
|
+
|
26
|
+
### Rake Configuration
|
27
|
+
The Rake Tasks receive these values by passing a config object to the `RakeTasks` class.
|
28
|
+
```ruby
|
29
|
+
config = Promote::Config.new({
|
30
|
+
:repo_root => REPO_TOPDIR,
|
31
|
+
:node_name => 'provisioner',
|
32
|
+
:client_key => ENV['client_key'] || File.join(REPO_TOPDIR, 'cookbooks/provisioner/files/provisioner.pem'),
|
33
|
+
:chef_server_url => ENV['chef_server_url'] || "https://172.22.10.121/organizations/clc_qa"
|
34
|
+
})
|
35
|
+
Promote::RakeTasks.new(config)
|
36
|
+
```
|
37
|
+
|
38
|
+
The `Config` class can receive the following settings:
|
39
|
+
Setting |
|
40
|
+
:repo_root | **mandatory**
|
41
|
+
:cookbook_directory | Defaults to `#{root}/cookbooks`
|
42
|
+
:environment_directory | Defaults to `#{root}/environments`
|
43
|
+
:data_bag_directory | Defaults to `#{root}/data_bags`
|
44
|
+
:temp_directory | Defaults to `/tmp/promote`
|
45
|
+
:node_name | **mandatory**
|
46
|
+
:client_key | **mandatory**
|
47
|
+
:chef_server_url | **mandatody**
|
48
|
+
|
49
|
+
|
50
|
+
## CLC-Promote Rake Tasks
|
51
|
+
**Note:** See the [below section on versioning](/gems/clc-promote#How are version numbers generated) for details on how versin numbers are generated.
|
52
|
+
|
53
|
+
### Promote:version_cookbook
|
54
|
+
Bumps the version of an individual cookbook.
|
55
|
+
|
56
|
+
### Promote:version_cookbooks
|
57
|
+
Same as `Promote:version_cookbook` but iterates all cookbooks.
|
58
|
+
|
59
|
+
### Promote:version_environment
|
60
|
+
Bumps the version of an individual environment file.
|
61
|
+
|
62
|
+
### Promote:version_environments
|
63
|
+
Same as `Promote:version_environment` but iterates all environment files.
|
64
|
+
|
65
|
+
### Promote:version_data_bag
|
66
|
+
Bumps the version of an individual databag entry.
|
67
|
+
|
68
|
+
### Promote:version_data_bags
|
69
|
+
Bumps the versions of all databag entries.
|
70
|
+
|
71
|
+
### Promote:sync_berksfiles
|
72
|
+
Performs a berks install on all cookbooks in the chef repo.
|
73
|
+
|
74
|
+
### Promote:upload_cookbooks
|
75
|
+
Uploads all cookbooks to the chef server. **Note**: only cookbooks that have been bumped will be uploaded. Uploaded cookbooks are frozen.
|
76
|
+
|
77
|
+
### Promote:upload_environment
|
78
|
+
Uploads an environment file to the chef server
|
79
|
+
|
80
|
+
### Promote:upload_data_bags
|
81
|
+
Uploads all data bage to the chef server
|
82
|
+
|
83
|
+
### Promote: constrain_environment
|
84
|
+
Given an environment and its environment cookbook, this task edits the environment file and creates cookbook constraints based on the `Berksfile.lock` of the environment cookbook.
|
85
|
+
|
86
|
+
### Promote:promote_environment
|
87
|
+
Promotes one environment from another environment by copying the cookbook constraints of the source environment to the target (promoted) environment.
|
88
|
+
|
89
|
+
## How are version numbers generated?
|
90
|
+
Version numbers are based on the last version tag which forms the major and minor version numbers and the number of commits in that tag which forms the build number. The number of commits are calculated from the root of the artifact being versioned. For instance, a cookbook's version would be based on the number of commits performed on all files within the top level directory of the cookbook being versioned.
|
91
|
+
|
92
|
+
## Knife Promote
|
93
|
+
The knife promote command deploys an environment to production.
|
94
|
+
|
95
|
+
```
|
96
|
+
knife promote environment [source environment] [target environment]
|
97
|
+
```
|
98
|
+
|
99
|
+
This command performs the following:
|
100
|
+
|
101
|
+
1. Copies the cookbook version constraints from source to target
|
102
|
+
2. Commits the constraints to version control
|
103
|
+
3. Uploads the target environment to the QA chef server
|
104
|
+
4. Downloads all data bags from QA
|
105
|
+
5. Performs a version diff on all cookbooks between the target environment and production chef server
|
106
|
+
6. Downloads all cookbooks from qa that are not on the prod server
|
107
|
+
7. uploads all new cookbooks, the target environment and databags to the production chef server.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clc-promote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CenturyLink Cloud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: git
|
28
|
+
name: clc-git
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|