apmate 0.3.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/apmate.rb +2 -0
- data/lib/apmate/cli.rb +35 -11
- data/lib/apmate/commands/mass_promote.rb +26 -0
- data/lib/apmate/commands/promote.rb +10 -5
- data/lib/apmate/commands/publish_artifact.rb +33 -0
- data/lib/apmate/version.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c6507f70059c24dfb3709eb473070445d1ad8d0b32534b411476946faa31ffd3
|
4
|
+
data.tar.gz: 4f2f14f931aaeef2ed276dd19fdb3b9ad2b2a2a609355b1d9c925dde186845aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfbd1626ed4fc6f4e271de92665b18c338bc650d74191854b6386234bd9d3855555205cbb2e721c938b9d0072a65b956df086be31bc0903e758e7430fb4186af
|
7
|
+
data.tar.gz: 8b83961996bc60aa77c022daee964706ff0e8371744b6e19c8f1270eaa59627c485a87f2c0816f9d1275ded4f5930e2398aaca8168e2c8ead8f5b82406d7de51
|
data/lib/apmate.rb
CHANGED
@@ -9,5 +9,7 @@ require 'apmate/commands/get/artifact'
|
|
9
9
|
require 'apmate/commands/get/artifact_environment'
|
10
10
|
require 'apmate/commands/get/artifact_name'
|
11
11
|
require 'apmate/commands/apply'
|
12
|
+
require 'apmate/commands/mass_promote'
|
12
13
|
require 'apmate/commands/promote'
|
13
14
|
require 'apmate/commands/execution'
|
15
|
+
require 'apmate/commands/publish_artifact'
|
data/lib/apmate/cli.rb
CHANGED
@@ -17,8 +17,10 @@ class Apmate::CLI
|
|
17
17
|
get_artifact_environment: '/api/artifacts/environment',
|
18
18
|
get_artifact: '/api/artifacts',
|
19
19
|
get_artifact_name: '/api/artifacts/name',
|
20
|
+
mass_promote_environment: '/api/applications/mass_promote',
|
20
21
|
promote_environment: '/api/environments/promote',
|
21
|
-
create_execution: '/api/executions'
|
22
|
+
create_execution: '/api/executions',
|
23
|
+
publish_artifact: '/api/artifacts/publish'
|
22
24
|
}
|
23
25
|
|
24
26
|
def self.apply_file(file, opts)
|
@@ -106,23 +108,43 @@ class Apmate::CLI
|
|
106
108
|
log_output(output, opts)
|
107
109
|
end
|
108
110
|
|
109
|
-
def self.
|
111
|
+
def self.apmate_mass_promote(env_from, env_to, opts)
|
112
|
+
Apmate::Logger.logger.debug "Beginning post request for mass promote."
|
113
|
+
|
114
|
+
uri = URI("#{Apmate::CLI::APMATE_URL}#{ENDPOINTS[:mass_promote_environment]}")
|
115
|
+
Apmate::Logger.logger.debug "uri: #{uri}"
|
116
|
+
|
117
|
+
payload = { env_from: env_from, env_to: env_to }
|
118
|
+
Apmate::Logger.logger.debug "payload: #{payload}"
|
119
|
+
|
120
|
+
apmate_post uri, payload, opts
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.apmate_promote(env_from, env_to, artifact, opts)
|
110
124
|
Apmate::Logger.logger.debug "Beginning post request."
|
111
125
|
|
112
126
|
uri = URI("#{Apmate::CLI::APMATE_URL}#{ENDPOINTS[:promote_environment]}")
|
113
127
|
Apmate::Logger.logger.debug "uri: #{uri}"
|
114
128
|
|
115
|
-
payload = { environment_from: env_from, environment_to: env_to }
|
129
|
+
payload = { environment_from: env_from, environment_to: env_to, artifact: artifact }
|
116
130
|
Apmate::Logger.logger.debug "payload: #{payload}"
|
117
131
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
132
|
+
apmate_post uri, payload, opts
|
133
|
+
end
|
134
|
+
|
135
|
+
def self.publish_artifact(name, environment_name, opts)
|
136
|
+
Apmate::Logger.logger.debug "Beginning to publish artifact."
|
137
|
+
|
138
|
+
uri = URI("#{Apmate::CLI::APMATE_URL}#{ENDPOINTS[:publish_artifact]}")
|
139
|
+
Apmate::Logger.logger.debug "uri: #{uri}"
|
140
|
+
|
141
|
+
payload = { artifact: { name: name, environment_name: environment_name } }
|
142
|
+
opts.each do |opt, value|
|
143
|
+
payload[:artifact][opt] = value
|
123
144
|
end
|
124
|
-
|
125
|
-
|
145
|
+
Apmate::Logger.logger.debug "payload: #{payload}"
|
146
|
+
|
147
|
+
apmate_post uri, payload, opts
|
126
148
|
end
|
127
149
|
|
128
150
|
def self.log_output(output, opts)
|
@@ -152,8 +174,10 @@ class Apmate::CLI
|
|
152
174
|
Command::HELP,
|
153
175
|
Command::APPLY,
|
154
176
|
get_command,
|
177
|
+
Command::MASS_PROMOTE,
|
155
178
|
Command::PROMOTE,
|
156
|
-
Command::CREATE_EXECUTION
|
179
|
+
Command::CREATE_EXECUTION,
|
180
|
+
Command::PUBLISH_ARTIFACT
|
157
181
|
].each do |cmd|
|
158
182
|
command.add_command cmd
|
159
183
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Apmate::CLI::Command
|
2
|
+
MASS_PROMOTE = Cri::Command.define do
|
3
|
+
name 'mass_promote'
|
4
|
+
usage 'mass_promote <environment_from> <environment_to> [artifact]'
|
5
|
+
summary "Promotes all artifacts' environment values from one general environment to another environment."
|
6
|
+
description %q(
|
7
|
+
Promotes all artifacts' environment values from one general environment to another environment.
|
8
|
+
WARNING: Use with caution. There is no "undo" for this. Take a backup first.
|
9
|
+
)
|
10
|
+
|
11
|
+
flag :h, :help, 'show help for this command' do |value, cmd|
|
12
|
+
puts cmd.help
|
13
|
+
exit 0
|
14
|
+
end
|
15
|
+
|
16
|
+
run do |opts, args, cmd|
|
17
|
+
Apmate::Logger.log_level(opts)
|
18
|
+
Apmate::Logger.verbosity(opts)
|
19
|
+
Apmate::Logger.logger.debug "opts: #{opts}"
|
20
|
+
Apmate::Logger.logger.debug "args: #{args}"
|
21
|
+
Apmate::Logger.logger.debug "cmd: #{cmd.to_s}"
|
22
|
+
cmd.run(['-h']) unless (args.count == 2)
|
23
|
+
Apmate::CLI.apmate_mass_promote(args[0], args[1], opts)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
module Apmate::CLI::Command
|
2
2
|
PROMOTE = Cri::Command.define do
|
3
3
|
name 'promote'
|
4
|
-
usage 'promote <environment_from> <environment_to>'
|
5
|
-
summary 'Promotes values from one environment to another environment.'
|
6
|
-
description
|
4
|
+
usage 'promote <environment_from> <environment_to> [artifact]'
|
5
|
+
summary 'Promotes artifact environment values from one environment to another environment.'
|
6
|
+
description %q(
|
7
|
+
Promotes artifact environment values from one environment to another environment.
|
8
|
+
Default behavior promotes all artifact environment values from one environment to another environment.
|
9
|
+
Optionally, you may specify a single artifact to be promoted.
|
10
|
+
)
|
7
11
|
|
8
12
|
flag :h, :help, 'show help for this command' do |value, cmd|
|
9
13
|
puts cmd.help
|
@@ -16,8 +20,9 @@ module Apmate::CLI::Command
|
|
16
20
|
Apmate::Logger.logger.debug "opts: #{opts}"
|
17
21
|
Apmate::Logger.logger.debug "args: #{args}"
|
18
22
|
Apmate::Logger.logger.debug "cmd: #{cmd.to_s}"
|
19
|
-
cmd.run(['-h']) unless args.count == 2
|
20
|
-
|
23
|
+
cmd.run(['-h']) unless (args.count == 2 || args.count == 3)
|
24
|
+
artifact = args[2] || nil
|
25
|
+
Apmate::CLI.apmate_promote(args[0], args[1], artifact, opts)
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Apmate::CLI::Command
|
2
|
+
PUBLISH_ARTIFACT = Cri::Command.define do
|
3
|
+
name 'publish_artifact'
|
4
|
+
usage 'publish_artifact [options] <name> <environment_name>'
|
5
|
+
summary "Publishes artifact information to Apmate for each environment with environment_name."
|
6
|
+
description %q(
|
7
|
+
Publishes artifact information to Apmate for each environment with environment_name.
|
8
|
+
Must have at least one option specified.
|
9
|
+
WARNING: Use with caution. There is no "undo" for this. Take a backup first.
|
10
|
+
)
|
11
|
+
|
12
|
+
flag :h, :help, 'show help for this command' do |value, cmd|
|
13
|
+
puts cmd.help
|
14
|
+
exit 0
|
15
|
+
end
|
16
|
+
|
17
|
+
option nil, :version, 'set artifact version', argument: :required
|
18
|
+
option nil, :checksum, 'set artifact checksum (SHA256)', argument: :required
|
19
|
+
option nil, :repository, 'set artifact repository', argument: :required
|
20
|
+
option nil, :promote, 'mark artifact for promotion', argument: :required
|
21
|
+
|
22
|
+
run do |opts, args, cmd|
|
23
|
+
Apmate::Logger.log_level(opts)
|
24
|
+
Apmate::Logger.verbosity(opts)
|
25
|
+
Apmate::Logger.logger.debug "opts: #{opts}"
|
26
|
+
Apmate::Logger.logger.debug "args: #{args}"
|
27
|
+
Apmate::Logger.logger.debug "cmd: #{cmd.to_s}"
|
28
|
+
cmd.run(['-h']) unless (args.count == 2)
|
29
|
+
cmd.run(['-h']) unless (opts.count > 0)
|
30
|
+
Apmate::CLI.publish_artifact(args[0], args[1], opts)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/apmate/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apmate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Baldridge
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "<="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.15.9
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "<="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.15.9
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,7 +85,9 @@ files:
|
|
85
85
|
- lib/apmate/commands/get/artifact_environment.rb
|
86
86
|
- lib/apmate/commands/get/artifact_name.rb
|
87
87
|
- lib/apmate/commands/help.rb
|
88
|
+
- lib/apmate/commands/mass_promote.rb
|
88
89
|
- lib/apmate/commands/promote.rb
|
90
|
+
- lib/apmate/commands/publish_artifact.rb
|
89
91
|
- lib/apmate/logger/logger.rb
|
90
92
|
- lib/apmate/version.rb
|
91
93
|
homepage:
|
@@ -108,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
110
|
version: '0'
|
109
111
|
requirements: []
|
110
112
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
113
|
+
rubygems_version: 2.7.7
|
112
114
|
signing_key:
|
113
115
|
specification_version: 4
|
114
116
|
summary: A CLI interface for Apmate Environment Datastore.
|