release_manager 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b5f2fca5358264908a1a51ed4cb1af63cc69104
4
- data.tar.gz: 409fdbe6392f38daf968ca3379524d70b379ae2b
3
+ metadata.gz: 364942ebd85562ce0608b558d9b670bc298a9b4a
4
+ data.tar.gz: f2e2e0cefae600b7c16d7518c65ea4f5f4159f3b
5
5
  SHA512:
6
- metadata.gz: b0b5862f7aceb14806d670ab9cc6a743533ec9ae17a25eb8b1f7ee5f803bc4ee7f68252e8c0af246d29a9da8aafe9db779baf377ee2494ceb10728359357dfe2
7
- data.tar.gz: e61f58c5af387848e48903a7df2998f28b6474f0b465d529fb42958f632e56ba4713c9147d28ebf868c4a564fd2b7577b974a30fb4f9da38eb596b03ed9d504c
6
+ metadata.gz: cd0dd4f644d138ab707498fe7d689ff2c950d5b742023ff5ad9f5f9398d409c0b52ee86c5fea7c933a9610bac9f263fae1ebc0605b5a0cc7659dc3cc6aa7fd45
7
+ data.tar.gz: 515d6a43667012fd475baeea10989d3f83c6a15563eb9641b053b02550ed8b4ada0a8f4ea3234e22e1903a4d5e572f289e4b0c329d9af61d08e47ca9c659636d
data/.env CHANGED
@@ -1,3 +1,3 @@
1
1
  export GITLAB_API_ENDPOINT='http://web/api/v3'
2
2
  export GITLAB_API_PRIVATE_TOKEN='A_zJJfgE8P-8mFGK2_r9'
3
- export R10K_REPO_URL="git@web:devops/control-repo.git"
3
+ export R10K_REPO_URL="git@web:devops/control-repo.git"
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /.bundle/
2
+ .env
2
3
  /.yardoc
3
4
  .idea
4
5
  /_yardoc/
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Release Manager
2
2
  ## Unreleased
3
-
3
+ ## 0.5.2
4
+ * Adds proper error handling when missing git author name and email with r10k-deploy
5
+ ## 0.5.1
6
+ * Fixes missing error object when credentials are not present
7
+ * Fixes error when deploy-r10k is used and remote setting was not set
4
8
  ## 0.5.0
5
9
  * Adds more error handling instead of stack dumps
6
10
  * Updates gitlab gem to 4.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- release_manager (0.5.0)
4
+ release_manager (0.5.2)
5
5
  gitlab (~> 4.2.0)
6
6
  highline (~> 1.7)
7
7
  rugged (~> 0.26)
@@ -56,6 +56,7 @@ Summary: Deploys the source ref into the dest branch by diffing the two and appl
56
56
  options[:puppetfile] = options[:puppetfile] || puppetfile_path
57
57
  options[:src_ref] ||= ARGV[0]
58
58
  options[:dest_ref] ||= ARGV[1]
59
+ options[:remote] = true
59
60
  validate(options)
60
61
  path = File.dirname(options[:puppetfile])
61
62
  R10kDeployer.run(path, options)
@@ -199,12 +199,12 @@ module ReleaseManager
199
199
 
200
200
  # @return [String] - the author name found in the config
201
201
  def author_name
202
- repo.config.get('user.name') || Rugged::Config.global.get('user.name')
202
+ repo.config.get('user.name') || Rugged::Config.global.get('user.name') || ENV['GIT_USER_NAME']
203
203
  end
204
204
 
205
205
  # @return [String] - the author email found in the config
206
206
  def author_email
207
- repo.config.get('user.email') || Rugged::Config.global.get('user.email')
207
+ repo.config.get('user.email') || Rugged::Config.global.get('user.email') || ENV['GIT_USER_EMAIL']
208
208
  end
209
209
 
210
210
  # @return [Hash] the author information used in a commit message
@@ -281,6 +281,9 @@ module ReleaseManager
281
281
 
282
282
  # @param [String] message - the message you want in the commit
283
283
  def create_commit(message)
284
+ unless author_name and author_email
285
+ raise GitError.new("Git username and email must be set, current: #{author.inspect}")
286
+ end
284
287
  # get the index for this repository
285
288
  repo.status { |file, status_data| logger.debug "#{file} has status: #{status_data.inspect}" }
286
289
  index = repo.index
@@ -39,6 +39,9 @@ class R10kDeployer
39
39
  deploy.check_requirements
40
40
  deploy.logger.info "Deploying R10k-Control #{options[:dest_ref]} with version: #{options[:src_ref]}"
41
41
  deploy.run
42
+ rescue GitError => e
43
+ deploy.logger.fatal(e.message)
44
+ code = 1
42
45
  rescue Gitlab::Error::Forbidden => e
43
46
  logger.fatal(e.message)
44
47
  logger.fatal("You don't have access to modify the repository")
@@ -99,6 +102,7 @@ class R10kDeployer
99
102
  control_repo.apply_patch(patchfile.path)
100
103
  control_repo.add_all
101
104
  end
105
+ # since we added everything locally we don't create a remote commit
102
106
  successful_commit = control_repo.commit(message, nil, nil, false)
103
107
  control_repo.push_branch('myfork', branch_name, true) if successful_commit
104
108
  mr = control_repo.create_merge_request(control_repo.url, message, {
@@ -42,7 +42,7 @@ class RemoteRelease < Release
42
42
  logger.fatal(e.message)
43
43
  logger.fatal("This probably means the user attached to the token does not have access")
44
44
  exit -1
45
- rescue Gitlab::Error::MissingCredentials
45
+ rescue Gitlab::Error::MissingCredentials => e
46
46
  logger.fatal(e.message)
47
47
  exit -1
48
48
  rescue Gitlab::Error::Forbidden => e
@@ -1,3 +1,3 @@
1
1
  module ReleaseManager
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: release_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Osman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-21 00:00:00.000000000 Z
11
+ date: 2017-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab