Class: RemoteRelease
- Includes:
- ReleaseManager::Logger
- Defined in:
- lib/release_manager/remote_release.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#release ⇒ Object
runs all the required steps to release the software currently this must be done manually by a release manager.
- #run ⇒ Object
Methods included from ReleaseManager::Logger
Methods inherited from Release
#add_upstream_remote, #auto_release?, #bump, #bump_log, #changelog, #check_requirements, #dry_run?, #initialize, #level, #next_version, #puppet_module, #push, #release_notes, #tag, #upstream_repo, #verbose?, #version
Constructor Details
This class inherits a constructor from Release
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/release_manager/remote_release.rb', line 5 def end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/release_manager/remote_release.rb', line 5 def path @path end |
Instance Method Details
#release ⇒ Object
runs all the required steps to release the software currently this must be done manually by a release manager
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/release_manager/remote_release.rb', line 11 def release begin unless auto_release? print "Have you merged your code? Did you fetch and rebase against the upstream? Want to continue (y/n)?: ".yellow answer = gets.downcase.chomp if answer == 'n' return false end print "Ready to release version #{version.next} to #{puppet_module.source}\n and forever change history(y/n)?: ".yellow answer = gets.downcase.chomp if answer != 'y' puts "Nah, forget it, this release wasn't that cool anyways.".yellow return false end end # updates the metadata.js file to the next version bump # updates the changelog to the next version based on the metadata file id = bump_log # tags the r10k-module with the version found in the metadata.json file tag(id) rescue Rugged::TagError => e logger.fatal(e.) logger.fatal("You might need to rebase your branch") exit 1 end end |
#run ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/release_manager/remote_release.rb', line 39 def run begin check_requirements exit 1 unless release logger.info "Releasing Version #{version} to #{puppet_module.source}" logger.info "Version #{version} has been released successfully" puts "This was a dry run so nothing actually happen".green if dry_run? exit 0 rescue Gitlab::Error::NotFound => e logger.fatal(e.) logger.fatal("This probably means the user attached to the token does not have access") exit -1 rescue Gitlab::Error::MissingCredentials => e logger.fatal(e.) exit -1 rescue Gitlab::Error::Forbidden => e logger.fatal(e.) logger.fatal("You don't have access to modify the repository") exit -1 rescue AlreadyReleased => e logger.warn(e.) exit 0 rescue TagExists => e logger.fatal(e.) exit -1 rescue GitError logger.fatal "There was an issue when running a git command" rescue InvalidMetadataSource logger.fatal "The puppet module's metadata.json source field must be a git url: ie. [email protected]:devops/module.git" exit -1 rescue ModNotFoundException logger.fatal "Invalid module path for #{path}, is there a metadata.json file?" exit -1 end end |