Only require secrets when mutating
Rename `with_lock` to more generic `mutating` and move the env_args check to that point. This allows read-only actions to be run without requiring secrets.
This commit is contained in:
@@ -116,6 +116,12 @@ class CliMainTest < CliTestCase
|
||||
end
|
||||
end
|
||||
|
||||
test "deploy with missing secrets" do
|
||||
assert_raises(KeyError) do
|
||||
run_command("deploy", config_file: "deploy_with_secrets")
|
||||
end
|
||||
end
|
||||
|
||||
test "redeploy" do
|
||||
invoke_options = { "config_file" => "test/fixtures/deploy_simple.yml", "version" => "999", "skip_hooks" => false }
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ class ConfigurationTest < ActiveSupport::TestCase
|
||||
assert_raises(KeyError) do
|
||||
config = Mrsk::Configuration.new(@deploy.tap { |c| c.merge!({
|
||||
env: { "secret" => [ "PASSWORD" ] }
|
||||
}) })
|
||||
}) }).ensure_env_available
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
11
test/fixtures/deploy_with_secrets.yml
vendored
Normal file
11
test/fixtures/deploy_with_secrets.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
service: app
|
||||
image: dhh/app
|
||||
servers:
|
||||
- "1.1.1.1"
|
||||
- "1.1.1.2"
|
||||
registry:
|
||||
username: user
|
||||
password: pw
|
||||
env:
|
||||
secret:
|
||||
- PASSWORD
|
||||
Reference in New Issue
Block a user