Skip to content

Commit

Permalink
Merge pull request #22 from kickstarter/release-directory-suffix-option
Browse files Browse the repository at this point in the history
(feature) `--deployment-id` option to add string suffix to the release directory name
  • Loading branch information
katjacresanti authored Sep 9, 2024
2 parents f1722a8 + 481a33d commit 6871e42
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion lib/egads/command/extract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Extract < Group
include Thor::Actions

desc "[remote, plumbing] Downloads tarball for SHA from S3 and extracts it to the filesystem"
class_option :deployment_id, type: :string, default: nil, banner: 'Append suffix to release directory'
class_option :force, type: :boolean, aliases: '-f', default: false, banner: "Overwrite existing files"
argument :sha, type: :string, required: true, desc: 'git SHA to download and extract'

Expand Down Expand Up @@ -89,7 +90,8 @@ def do_extract(path)

# Directory created upon successful extraction
def release_dir
RemoteConfig.release_dir(sha)
suffix = options[:deployment_id] ? "_#{options[:deployment_id]}" : ''
RemoteConfig.release_dir(sha) + suffix
end

# Directory where in-progress extraction occurs
Expand Down
5 changes: 4 additions & 1 deletion lib/egads/command/release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Release < Group
include Thor::Actions

desc "[remote] Symlinks SHA to current and restarts services. If needed, stages SHA"
class_option :deployment_id, type: :string, default: nil, banner: 'Append suffix to release directory'
class_option :force, type: :boolean, default: false, banner: "Overwrite existing release"
argument :sha, type: :string, required: true, desc: 'git SHA to stage'
def setup_environment
Expand Down Expand Up @@ -44,8 +45,10 @@ def trim
end

protected

def dir
RemoteConfig.release_dir(sha)
suffix = options[:deployment_id] ? "_#{options[:deployment_id]}" : ''
RemoteConfig.release_dir(sha) + suffix
end

def release_to
Expand Down
6 changes: 4 additions & 2 deletions lib/egads/command/stage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module Egads
class Stage < Group
include Thor::Actions


desc "[remote] Readies SHA for release. If needed, generates URL for SHA and extracts"
class_option :deployment_id, type: :string, default: nil, banner: 'Append suffix to release directory'
class_option :force, type: :boolean, default: false, banner: "Overwrite existing files"
argument :sha, type: :string, required: true, desc: 'git SHA to stage'

Expand Down Expand Up @@ -57,8 +57,10 @@ def mark_as_staged
end

protected

def dir
RemoteConfig.release_dir(sha)
suffix = options[:deployment_id] ? "_#{options[:deployment_id]}" : ''
RemoteConfig.release_dir(sha) + suffix
end

def stage_flag_path
Expand Down
2 changes: 1 addition & 1 deletion lib/egads/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Egads
VERSION = '5.1.2'
VERSION = '5.2.0'
end

0 comments on commit 6871e42

Please sign in to comment.