release_manager 0.4.0 → 0.5.0

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: 101f96a16896083f39a5ec3509e7d93d03eff654
4
- data.tar.gz: 5f55de39b68dc927703e2253a8bdf6132061b6c8
3
+ metadata.gz: 1b5f2fca5358264908a1a51ed4cb1af63cc69104
4
+ data.tar.gz: 409fdbe6392f38daf968ca3379524d70b379ae2b
5
5
  SHA512:
6
- metadata.gz: 7ab633ea59d29b4a5badbc1d1210deb360d7d87d92470a33532587aa5530254188673452504b5fc737bdb2b7e48b92a67f15f125a24eba2f5ffd2b7c9c7dfe60
7
- data.tar.gz: 1a2f26aee604130ac803958725e97d8d0d47251b1e71c3c159412b6fd8376cccf7cd9e72ee77f48966bc5fb9078213f76f8f133f8fafebd5affdcb01c4e26a52
6
+ metadata.gz: b0b5862f7aceb14806d670ab9cc6a743533ec9ae17a25eb8b1f7ee5f803bc4ee7f68252e8c0af246d29a9da8aafe9db779baf377ee2494ceb10728359357dfe2
7
+ data.tar.gz: e61f58c5af387848e48903a7df2998f28b6474f0b465d529fb42958f632e56ba4713c9147d28ebf868c4a564fd2b7577b974a30fb4f9da38eb596b03ed9d504c
data/.gitignore CHANGED
@@ -8,6 +8,6 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  srv/
11
-
11
+ bundl
12
12
  # rspec failure tracking
13
13
  .rspec_status
@@ -0,0 +1,51 @@
1
+ # setup
2
+ # Please set the following variables in the UI
3
+ # GITLAB_API_PRIVATE_TOKEN (token of user who should execute the scripts and create Merge requests)
4
+ #
5
+ before_script:
6
+ - gem install bundler
7
+ - bundle install
8
+ stages:
9
+ - release
10
+ - deploy_release
11
+ #before_script:
12
+ # Run ssh-agent (inside the build environment)
13
+
14
+ #- eval $(ssh-agent -s)
15
+ # Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
16
+ #- ssh-add <(echo "$SSH_PRIVATE_KEY")
17
+ variables:
18
+ GITLAB_API_ENDPOINT: "http://web/api/v4"
19
+ MAX_THREAD_COUNT: '30'
20
+ BUNDLE_DISABLE_VERSION_CHECK: '1'
21
+ GITLAB_API_HTTPARTY_OPTIONS: "{verify: false}"
22
+
23
+ # we don't always want validation to run so we skip it if SKIP_VALIDATION is set
24
+ validate:
25
+ stage: validate
26
+ tags: ['ruby']
27
+ script: if [ ! -n "${SKIP_VALIDATION}" ]; then ./scripts/validate_r10k.rb Puppetfile; fi
28
+
29
+ # tags the current head and bumps the version to the next number, creating a release
30
+ create_release:
31
+ stage: release
32
+ tags:
33
+ - ruby
34
+ script:
35
+ - bundle exec release-mod -r -a
36
+ only:
37
+ - dev@devops/r10k-control
38
+ when: manual
39
+
40
+ deploy_to_qa:
41
+ tags:
42
+ - ruby
43
+ variables:
44
+ DEPLOY_BRANCH: qa
45
+ stage: deploy_release
46
+ #when: manual
47
+ script:
48
+ - bundle exec deploy-r10k -s $CI_COMMIT_REF_NAME -d $DEPLOY_BRANCH
49
+ # only:
50
+ # - tags@devops/r10k-control
51
+
data/CHANGELOG.md CHANGED
@@ -1,4 +1,17 @@
1
1
  # Release Manager
2
+ ## Unreleased
3
+
4
+ ## 0.5.0
5
+ * Adds more error handling instead of stack dumps
6
+ * Updates gitlab gem to 4.2
7
+ * Updates rugged gem to 0.26
8
+ * Adds deploy-r10k cli command
9
+ * Refactors more git commands to use rugged
10
+ * Adds ability to run deploy-mod without interaction
11
+ * Moves gitlab methods to gitlab adapter
12
+ * Adds support to create merge request
13
+ * Adds ability to remote create a commit with the changelog
14
+ * Adds ability to calculate changes files between two refs
2
15
  ## v0.4.0
3
16
  * Adds ability to sort the puppetfile when writing to file
4
17
  ## v0.3.1
data/Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
1
  FROM ruby:2.3.4
2
2
  RUN apt-get update && apt-get install -y libssh2-1-dev tree git zsh libssh2-1 vim cmake && apt-get clean
3
- RUN useradd -m appuser && su - appuser -c 'ssh-keygen -t rsa -N "password" -f /home/appuser/.ssh/id_rsa' && mkdir /app \
3
+ RUN useradd -m appuser && su - appuser -c 'ssh-keygen -t rsa -N "" -f /home/appuser/.ssh/id_rsa' && mkdir /app \
4
4
  && chown appuser:appuser /app
5
5
  COPY ./Gemfile* /app/
6
6
  COPY .bash_profile /home/appuser/.bash_profile
@@ -11,4 +11,5 @@ RUN su - appuser -c 'git config --global user.email "user@example.com"' && \
11
11
  RUN su - appuser -c "BUNDLE_PATH='/home/appuser/.bundle' GEM_HOME='/home/appuser/.gems' bundle install --gemfile=/app/Gemfile" \
12
12
  && rm -f /app/*
13
13
  # update PATH to find local gems
14
+
14
15
  USER appuser
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source ENV['GEM_SOURCE'] ||'https://rubygems.org'
2
2
  # Specify your gem's dependencies in release_manager.gemspec
3
- gem 'gitlab', '~> 3.7.0'
4
- gem 'rugged'
3
+ gem 'gitlab', '~> 4.2.0'
4
+ gem 'rugged', '~> 0.26'
5
5
  gem 'highline', '~> 1.7'
6
6
 
7
7
  group :test do
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- release_manager (0.4.0)
5
- gitlab (~> 3.7.0)
4
+ release_manager (0.5.0)
5
+ gitlab (~> 4.2.0)
6
6
  highline (~> 1.7)
7
- rugged
7
+ rugged (~> 0.26)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -12,16 +12,15 @@ GEM
12
12
  ast (2.3.0)
13
13
  coderay (1.1.1)
14
14
  diff-lcs (1.3)
15
- gitlab (3.7.0)
16
- httparty (~> 0.13.0)
15
+ gitlab (4.2.0)
16
+ httparty
17
17
  terminal-table
18
18
  highline (1.7.8)
19
- httparty (0.13.7)
20
- json (~> 1.8)
19
+ httparty (0.15.5)
21
20
  multi_xml (>= 0.5.2)
22
- json (1.8.6)
23
21
  method_source (0.8.2)
24
22
  multi_xml (0.6.0)
23
+ parallel (1.11.2)
25
24
  parser (2.4.0.0)
26
25
  ast (~> 2.2)
27
26
  powerpack (0.1.1)
@@ -29,47 +28,49 @@ GEM
29
28
  coderay (~> 1.1.0)
30
29
  method_source (~> 0.8.1)
31
30
  slop (~> 3.4)
32
- rainbow (2.2.1)
33
- rake (10.5.0)
34
- rspec (3.5.0)
35
- rspec-core (~> 3.5.0)
36
- rspec-expectations (~> 3.5.0)
37
- rspec-mocks (~> 3.5.0)
38
- rspec-core (3.5.4)
39
- rspec-support (~> 3.5.0)
40
- rspec-expectations (3.5.0)
31
+ rainbow (2.2.2)
32
+ rake
33
+ rake (12.0.0)
34
+ rspec (3.6.0)
35
+ rspec-core (~> 3.6.0)
36
+ rspec-expectations (~> 3.6.0)
37
+ rspec-mocks (~> 3.6.0)
38
+ rspec-core (3.6.0)
39
+ rspec-support (~> 3.6.0)
40
+ rspec-expectations (3.6.0)
41
41
  diff-lcs (>= 1.2.0, < 2.0)
42
- rspec-support (~> 3.5.0)
43
- rspec-mocks (3.5.0)
42
+ rspec-support (~> 3.6.0)
43
+ rspec-mocks (3.6.0)
44
44
  diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.5.0)
46
- rspec-support (3.5.0)
47
- rubocop (0.48.1)
45
+ rspec-support (~> 3.6.0)
46
+ rspec-support (3.6.0)
47
+ rubocop (0.49.1)
48
+ parallel (~> 1.10)
48
49
  parser (>= 2.3.3.1, < 3.0)
49
50
  powerpack (~> 0.1)
50
51
  rainbow (>= 1.99.1, < 3.0)
51
52
  ruby-progressbar (~> 1.7)
52
53
  unicode-display_width (~> 1.0, >= 1.0.1)
53
54
  ruby-progressbar (1.8.1)
54
- rugged (0.25.1.1)
55
+ rugged (0.26.0)
55
56
  slop (3.6.0)
56
- terminal-table (1.7.3)
57
- unicode-display_width (~> 1.1.1)
58
- unicode-display_width (1.1.3)
57
+ terminal-table (1.8.0)
58
+ unicode-display_width (~> 1.1, >= 1.1.1)
59
+ unicode-display_width (1.3.0)
59
60
 
60
61
  PLATFORMS
61
62
  ruby
62
63
 
63
64
  DEPENDENCIES
64
65
  bundler
65
- gitlab (~> 3.7.0)
66
+ gitlab (~> 4.2.0)
66
67
  highline (~> 1.7)
67
68
  pry
68
69
  rake
69
70
  release_manager!
70
71
  rspec
71
72
  rubocop
72
- rugged
73
+ rugged (~> 0.26)
73
74
 
74
75
  BUNDLED WITH
75
- 1.14.6
76
+ 1.15.2
data/README.md CHANGED
@@ -39,7 +39,7 @@ This gem provides workflow automations around releasing and deploying puppet mod
39
39
 
40
40
  ## Prerequisites
41
41
 
42
- 1. Must be running Gitlab 8.16+
42
+ 1. Must be running Gitlab 9.0+
43
43
  2. Must be using ssh keys with gitlab
44
44
  3. Must be using ssh-agent to handle git authentication
45
45
  4. Must be using Git
@@ -48,8 +48,6 @@ This gem provides workflow automations around releasing and deploying puppet mod
48
48
  7. Must have a Gitlab API Access token (per user)
49
49
  8. Must have the libssh-dev library package installed
50
50
 
51
-
52
-
53
51
  ## Installation
54
52
 
55
53
  Add this line to your application's Gemfile:
data/docker-compose.yml CHANGED
@@ -9,7 +9,7 @@ services:
9
9
  environment:
10
10
  GEM_HOME: '/home/appuser/.gems'
11
11
  BUNDLE_PATH: '/home/appuser/.bundle'
12
- GITLAB_API_ENDPOINT: 'http://web/api/v3'
12
+ GITLAB_API_ENDPOINT: 'http://web/api/v4'
13
13
  # the token may change so this really needs to be more dynamic
14
14
  GITLAB_API_PRIVATE_TOKEN: 'A_zJJfgE8P-8mFGK2_r9'
15
15
  R10K_REPO_URL: "git@web:devops/control-repo.git"
@@ -18,7 +18,25 @@ services:
18
18
  # - app_startup_script.sh
19
19
  volumes:
20
20
  - .:/app
21
-
21
+ runner:
22
+ image: 'registry.gitlab.com/gitlab-org/gitlab-ci-multi-runner:ubuntu-v9.3.0'
23
+ volumes:
24
+ - './srv/gitlab-runner/config:/etc/gitlab-runner'
25
+ - '/var/run/docker.sock:/var/run/docker.sock'
26
+ environment:
27
+ DOCKER_NETWORK_MODE: 'releasemanager_default'
28
+ RUNNER_TAG_LIST: 'ruby'
29
+ REGISTRATION_TOKEN: 'W_nSSWTvuYmGUmUbh65y'
30
+ RUNNER_NAME: 'test-runner'
31
+ CI_SERVER_URL: 'http://web/ci'
32
+ RUNNER_EXECUTOR: 'docker'
33
+ GITLAB_API_ENDPOINT: 'http://web/api/v4'
34
+ REGISTER_RUN_UNTAGGED: 'true'
35
+ DOCKER_IMAGE: 'ruby:2.1'
36
+ REGISTER_LOCKED: 'false'
37
+ # the token may change so this really needs to be more dynamic
38
+ GITLAB_API_PRIVATE_TOKEN: 'A_zJJfgE8P-8mFGK2_r9'
39
+ #entrypoint:
22
40
  web:
23
41
  image: 'gitlab/gitlab-ce:latest'
24
42
  restart: always
data/exe/bump-changelog CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  require 'release_manager'
3
+ require 'release_manager/cli/bump_changelog_cli'
4
+
5
+ ReleaseManager::BumpChangelogCli.run
4
6
 
5
- Changelog.run
data/exe/deploy-r10k ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'release_manager'
3
+ require 'release_manager/cli/deploy_r10k_cli'
4
+ ReleaseManager::DeployR10kCli.run
@@ -15,6 +15,7 @@ class Changelog < WorkflowAction
15
15
 
16
16
  include ReleaseManager::Git::Utilities
17
17
  include ReleaseManager::Logger
18
+ include ReleaseManager::VCSManager
18
19
 
19
20
  def initialize(module_path, version, options = {})
20
21
  @options = options
@@ -22,58 +23,29 @@ class Changelog < WorkflowAction
22
23
  @version = version
23
24
  end
24
25
 
25
- def create_changelog_file
26
- return if File.exists?(changelog_file)
27
- contents = "# Module Name\n\n## Unreleased\n"
28
- File.write(changelog_file, contents)
29
- logger.info("Creating initial changelog file")
30
- commit_changelog("[ReleaseManager] - create empty changelog")
26
+ def empty_changelog_contents
27
+ "# #{module_name}\n\n## Unreleased\n"
28
+ end
29
+
30
+ def module_name
31
+ metadata['name']
31
32
  end
32
33
 
33
34
  def path
34
35
  @root_dir
35
36
  end
36
37
 
37
- def run
38
- create_changelog_file
39
- # write the new changelog unless it does not need updating
40
- if already_released?
38
+ # @param remote [Boolean] - if the commit is a remote git on the vcs server
39
+ # @return [String] - sha of the commit
40
+ def run(remote = false, branch = 'master')
41
+ if already_released?
41
42
  logger.fatal "Version #{version} had already been released, did you bump the version manually?"
42
43
  exit 1
43
- else
44
- File.write(changelog_file, new_content)
45
- commit_changelog if options[:commit]
46
- logger.info "The changelog has been updated to version #{version}"
47
- end
48
- end
49
-
50
- def self.run
51
- options = {}
52
- OptionParser.new do |opts|
53
- opts.program_name = 'bump_changelog'
54
- opts.version = ReleaseManager::VERSION
55
- opts.on_head(<<-EOF
56
-
57
- Summary: updates the changelog.md file with the new
58
- version by reading the metadata.json file
59
-
60
- EOF
61
- )
62
- opts.on("-c", "--[no-]commit", "Commit the updated changelog") do |c|
63
- options[:commit] = c
64
- end
65
- opts.on("-f", "--changelog FILE", "Path to the changelog file") do |c|
66
- options[:file] = c
67
- end
68
- end.parse!
69
- unless options[:file]
70
- puts "Must supply --changelog FILE"
71
- exit 1
72
44
  end
73
- module_path = File.dirname(options[:file])
74
- puppet_module = PuppetModule.new(module_path)
75
- log = Changelog.new(module_path, puppet_module.version, options)
76
- log.run
45
+ File.write(changelog_file, new_content) unless remote
46
+ id = commit_changelog(nil, remote, branch) if options[:commit]
47
+ logger.info "The changelog has been updated to version #{version}"
48
+ id
77
49
  end
78
50
 
79
51
  # @returns [String] the full path to the change log file
@@ -83,7 +55,11 @@ EOF
83
55
 
84
56
  # @returns [Array[String]]
85
57
  def changelog_lines
86
- @changelog_lines ||= File.readlines(changelog_file)
58
+ unless @changelog_lines
59
+ @changelog_lines = File.exists?(changelog_file) ?
60
+ File.readlines(changelog_file) : empty_changelog_contents.lines
61
+ end
62
+ @changelog_lines
87
63
  end
88
64
 
89
65
  # @returns [Integer] line number of where the word unreleased is located
@@ -115,10 +91,20 @@ EOF
115
91
  end
116
92
 
117
93
  # @return [String] the oid of the commit that was created
118
- def commit_changelog(msg = nil)
119
- add_file(changelog_file)
94
+ def commit_changelog(msg = nil, remote = false, branch = 'master')
120
95
  message = msg || "[ReleaseManager] - bump changelog to version #{version}"
121
- create_commit(message)
96
+ if remote
97
+ actions = [{
98
+ action: 'update',
99
+ file_path: changelog_file.split(repo.workdir).last,
100
+ content: new_content
101
+ }]
102
+ obj = vcs_create_commit(source, branch, message, actions)
103
+ obj.id if obj
104
+ else
105
+ add_file(changelog_file)
106
+ create_commit(message)
107
+ end
122
108
  end
123
109
 
124
110
  # checks to make sure the unreleased line is valid, and the file exists
@@ -126,5 +112,21 @@ EOF
126
112
  log = new(path, nil)
127
113
  log.unreleased_index if File.exists?(log.changelog_file)
128
114
  end
115
+
116
+ private
117
+
118
+ # @returns [Hash] the metadata object as a ruby hash
119
+ def metadata
120
+ unless @metadata
121
+ metadata_file =File.join(path, 'metadata.json')
122
+ raise ModNotFoundException unless File.exists?(metadata_file)
123
+ @metadata ||= JSON.parse(File.read(metadata_file))
124
+ end
125
+ @metadata
126
+ end
127
+
128
+ def source
129
+ metadata['source']
130
+ end
129
131
  end
130
132
 
@@ -0,0 +1,36 @@
1
+ require 'optparse'
2
+ require 'release_manager/version'
3
+ require 'release_manager/changelog'
4
+ module ReleaseManager
5
+ class BumpChangelogCli
6
+
7
+ def self.run
8
+ options = {}
9
+ OptionParser.new do |opts|
10
+ opts.program_name = 'bump_changelog'
11
+ opts.version = ReleaseManager::VERSION
12
+ opts.on_head(<<-EOF
13
+
14
+ Summary: updates the changelog.md file with the new
15
+ version by reading the metadata.json file
16
+
17
+ EOF
18
+ )
19
+ opts.on("-c", "--[no-]commit", "Commit the updated changelog") do |c|
20
+ options[:commit] = c
21
+ end
22
+ opts.on("-f", "--changelog FILE", "Path to the changelog file") do |c|
23
+ options[:file] = c
24
+ end
25
+ end.parse!
26
+ unless options[:file]
27
+ puts "Must supply --changelog FILE"
28
+ exit 1
29
+ end
30
+ module_path = File.dirname(options[:file])
31
+ puppet_module = PuppetModule.new(module_path)
32
+ log = Changelog.new(module_path, puppet_module.version, options)
33
+ log.run
34
+ end
35
+ end
36
+ end
@@ -26,16 +26,16 @@ module ReleaseManager
26
26
  opts.on('-c', '--commit', 'Optionally, Commit the Puppetfile change') do |p|
27
27
  options[:commit] = p
28
28
  end
29
- # removing this option as it seems a little dangerous for now
30
- # opts.on('-u', '--push', 'Optionally, Push the changes to the remote') do |p|
31
- # options[:push] = p
32
- # end
33
- # opts.on('-r', '--remote REMOTE', 'Optionally, specify a remote name or url to push changes to') do |p|
34
- # options[:remote] = p
35
- # end
36
29
  opts.on('-d', 'Perform a dry run without making changes') do |p|
37
30
  options[:dry_run] = p
38
31
  end
32
+ opts.on('-a', '--auto', 'Run this script without interaction') do |c|
33
+ options[:auto] = c
34
+ end
35
+ opts.on('-r', '--remote-deploy', "Perform a remote deploy (For CI systems)") do |c|
36
+ options[:remote] = c
37
+ options[:auto] = true
38
+ end
39
39
  end.parse!
40
40
  m = ModuleDeployer.new(options)
41
41
  m.run
@@ -0,0 +1,64 @@
1
+ require 'release_manager/r10k_deployer'
2
+ require 'optparse'
3
+ require 'release_manager/version'
4
+ module ReleaseManager
5
+ class DeployR10kCli
6
+
7
+ def self.puppetfile_path
8
+ ENV['PUPPET_FILE_PATH'] || File.join(File.expand_path(Dir.pwd), 'Puppetfile')
9
+ end
10
+
11
+ def self.validate(options)
12
+ if options[:src_ref].nil? or options[:dest_ref].nil?
13
+ puts "You must supply --source and --dest arguments".red
14
+ puts @o
15
+ exit 1
16
+ end
17
+
18
+ end
19
+
20
+ def self.run
21
+ options = {}
22
+ @o = OptionParser.new do |opts|
23
+ opts.program_name = 'deploy-r10k'
24
+ opts.version = ReleaseManager::VERSION
25
+ opts.on_head(<<-EOF
26
+
27
+ Summary: Deploys the source ref into the dest branch by diffing the two and applying the diff. Generates a merge
28
+ request after committing the changes to the dest branch.
29
+
30
+ 1. fetches the latest code
31
+ 2. creates the necessary remotes
32
+ 3. Forks project
33
+ 4. creates new branch
34
+ 5. creates diff and applies diff to new branch
35
+ 6. push branch and create merge request
36
+
37
+ Examples:
38
+ deploy-r10k dev qa
39
+ deploy-r10k -s dev -d qa
40
+ deploy-r10k -p ~/repos/r10k-control -s dev -d qa
41
+
42
+
43
+ EOF
44
+ )
45
+ opts.on('-p', "--puppetfile [PUPPETFILE]", "Path to R10k Puppetfile, defaults to #{puppetfile_path}") do |p|
46
+ options[:puppetfile] = File.expand_path(p)
47
+ end
48
+ opts.on('-s', "--source [SRC_REF]", "The source ref or branch you want to deploy") do |p|
49
+ options[:src_ref] = p
50
+ end
51
+ opts.on('-d', "--dest [DEST_BRANCH]", "The destination branch you want to deploy to") do |p|
52
+ options[:dest_ref] = p
53
+ end
54
+ end
55
+ @o.parse!
56
+ options[:puppetfile] = options[:puppetfile] || puppetfile_path
57
+ options[:src_ref] ||= ARGV[0]
58
+ options[:dest_ref] ||= ARGV[1]
59
+ validate(options)
60
+ path = File.dirname(options[:puppetfile])
61
+ R10kDeployer.run(path, options)
62
+ end
63
+ end
64
+ end
@@ -1,4 +1,19 @@
1
+ # Purpose: release a new version of a module or r10k-control from the src branch by performing
2
+ # the following tasks:
3
+ # - bump version in metadata file
4
+ # - bump changelog version using version in metadata file
5
+ # - tag the code matching the version in the metadata file
6
+ # - push to upstream
7
+ # This script can be used on modules or r10k-control. If using on a module
8
+ # be sure to pass in the repo path using --repo. The repo is where this script
9
+ # pushes too.
10
+ #
11
+ # You should also use the -d feature which simulates a run of the script without doing
12
+ # anything harmful.
13
+ #
14
+ # Run with -h to see the help
1
15
  require 'release_manager/release'
16
+ require 'release_manager/remote_release'
2
17
  require 'optparse'
3
18
  require 'release_manager/version'
4
19
  module ReleaseManager
@@ -35,8 +50,12 @@ Summary: Bumps the module version to the next revision and
35
50
  opts.on('--verbose', "Extra logging") do |c|
36
51
  options[:verbose] = c
37
52
  end
53
+ opts.on('-r', '--remote-release', "Perform a remote release (For CI systems)") do |c|
54
+ options[:remote] = true
55
+ end
38
56
  end.parse!
39
- r = Release.new(options[:path], options)
57
+ r = options[:remote] ?
58
+ RemoteRelease.new(options[:path], options) : Release.new(options[:path], options)
40
59
  r.run
41
60
  end
42
61
  end
@@ -1,4 +1,5 @@
1
1
  require 'release_manager/sandbox'
2
+ require 'release_manager'
2
3
  module ReleaseManager
3
4
  class SandboxCreateCli
4
5
 
@@ -4,9 +4,12 @@ require 'release_manager/git/utilites'
4
4
 
5
5
  class ControlRepo
6
6
  attr_accessor :path, :repo, :url
7
+ DEFAULT_BRANCH = ENV['CONTROL_REPO_DEFAULT_BRANCH'] || 'dev'
8
+ DEFAULT_BRANCHES = ENV['CONTROL_REPO_DEFAULT_BRANCHES'] || %w(dev qa integration acceptance production)
7
9
 
8
10
  include ReleaseManager::Git::Utilities
9
11
  include ReleaseManager::Logger
12
+ include ReleaseManager::VCSManager
10
13
 
11
14
  def initialize(path, url = nil)
12
15
  @path = path
@@ -32,4 +35,15 @@ class ControlRepo
32
35
  @puppetfile
33
36
  end
34
37
 
38
+ def commit(message, diff_obj, branch_name, remote = false)
39
+ message = "[ReleaseManager] - #{message}"
40
+ if remote
41
+ actions = diff_2_commit(diff_obj)
42
+ obj = vcs_create_commit(url, branch_name, message, actions)
43
+ obj.id if obj
44
+ else
45
+ create_commit(message)
46
+ end
47
+ end
48
+
35
49
  end
@@ -11,3 +11,7 @@ class RepoNotFound < Exception; end
11
11
  class InvalidModule < Exception; end
12
12
  class InvalidToken < Exception; end
13
13
  class InvalidSshkey < Exception; end
14
+ class InvalidBranchName < Exception; end
15
+ class PatchError < Exception; end
16
+ class AlreadyReleased < Exception; end
17
+ class TagExists < Exception; end