From b50c47c7235c270899c31a3cabd92bdf7302470b Mon Sep 17 00:00:00 2001 From: Katja Date: Thu, 5 Sep 2024 14:45:52 -0700 Subject: [PATCH 1/2] add --deployment-id option to add a suffix to the release directory --- lib/egads/command/extract.rb | 4 +++- lib/egads/command/release.rb | 7 +++++-- lib/egads/command/stage.rb | 6 ++++-- lib/egads/version.rb | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/egads/command/extract.rb b/lib/egads/command/extract.rb index dec7acd..dcff309 100644 --- a/lib/egads/command/extract.rb +++ b/lib/egads/command/extract.rb @@ -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' @@ -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 diff --git a/lib/egads/command/release.rb b/lib/egads/command/release.rb index 03e7919..2e23ead 100644 --- a/lib/egads/command/release.rb +++ b/lib/egads/command/release.rb @@ -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 @@ -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 @@ -74,4 +77,4 @@ def atomic_symlink(src, dest) File.rename(tmp, dest) end end -end +end \ No newline at end of file diff --git a/lib/egads/command/stage.rb b/lib/egads/command/stage.rb index d791b5b..20a4fdb 100644 --- a/lib/egads/command/stage.rb +++ b/lib/egads/command/stage.rb @@ -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' @@ -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 diff --git a/lib/egads/version.rb b/lib/egads/version.rb index af2e40f..9fcbc6b 100644 --- a/lib/egads/version.rb +++ b/lib/egads/version.rb @@ -1,3 +1,3 @@ module Egads - VERSION = '5.1.2' + VERSION = '5.2.0' end From 481a33de927f132a517c13a6850bbbd0be1573bc Mon Sep 17 00:00:00 2001 From: Katja Date: Mon, 9 Sep 2024 08:54:03 -0700 Subject: [PATCH 2/2] add newline to release.rb --- lib/egads/command/release.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/egads/command/release.rb b/lib/egads/command/release.rb index 2e23ead..f38eab8 100644 --- a/lib/egads/command/release.rb +++ b/lib/egads/command/release.rb @@ -77,4 +77,4 @@ def atomic_symlink(src, dest) File.rename(tmp, dest) end end -end \ No newline at end of file +end