Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feature) --deployment-id option to add string suffix to the release directory name #22

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 5 additions & 2 deletions 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 Expand Up @@ -74,4 +77,4 @@ def atomic_symlink(src, dest)
File.rename(tmp, dest)
end
end
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs newline

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
Loading