diff --git a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryAddAccountCommand.java b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryAddAccountCommand.java index d9dbadd45f..a0e4301cfd 100644 --- a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryAddAccountCommand.java +++ b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryAddAccountCommand.java @@ -77,6 +77,12 @@ protected String getProviderName() { ) private Long cacheIntervalSeconds = 30L; + @Parameter( + names = "--insecure-registry", + description = DockerRegistryCommandProperties.CACHE_INTERVAL_SECONDS_DESCRIPTION + ) + private Boolean insecureRegistry = false; + @Override protected Account buildAccount(String accountName) { DockerRegistryAccount account = (DockerRegistryAccount) new DockerRegistryAccount().setName(accountName); @@ -87,7 +93,8 @@ protected Account buildAccount(String accountName) { .setPasswordFile(passwordFile) .setUsername(username) .setEmail(email) - .setCacheIntervalSeconds(cacheIntervalSeconds); + .setCacheIntervalSeconds(cacheIntervalSeconds) + .setInsecureRegistry(insecureRegistry); return account; } diff --git a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryCommandProperties.java b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryCommandProperties.java index 30a7c3c6d2..116edfb3c7 100644 --- a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryCommandProperties.java +++ b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryCommandProperties.java @@ -45,4 +45,6 @@ class DockerRegistryCommandProperties { static final String CACHE_INTERVAL_SECONDS_DESCRIPTION = "How many seconds elapse between polling your docker registry. Certain registries are sensitive to over-polling, and " + "larger intervals (e.g. 10 minutes = 600 seconds) are desirable if you're seeing rate limiting."; + + static final String INSECURE_REGISTRY_DESCRIPTION = "Treat the docker registry as insecure (don't validate the ssl cert)."; } diff --git a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryEditAccountCommand.java b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryEditAccountCommand.java index 7e950b9505..82ff796fed 100644 --- a/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryEditAccountCommand.java +++ b/halyard-cli/src/main/java/com/netflix/spinnaker/halyard/cli/command/v1/config/providers/dockerRegistry/DockerRegistryEditAccountCommand.java @@ -88,6 +88,12 @@ protected String getProviderName() { ) private Long cacheIntervalSeconds; + @Parameter( + names = "--insecure-registry", + description = DockerRegistryCommandProperties.INSECURE_REGISTRY_DESCRIPTION + ) + private Boolean insecureRegistry = false; + @Override protected Account editAccount(DockerRegistryAccount account) { account.setAddress(isSet(address) ? address : account.getAddress()); @@ -115,6 +121,7 @@ protected Account editAccount(DockerRegistryAccount account) { account.setUsername(isSet(username) ? username : account.getUsername()); account.setEmail(isSet(email) ? email : account.getEmail()); account.setCacheIntervalSeconds(isSet(cacheIntervalSeconds) ? cacheIntervalSeconds : account.getCacheIntervalSeconds()); + account.setInsecureRegistry(isSet(insecureRegistry) ? insecureRegistry : account.getInsecureRegistry()); return account; } diff --git a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/providers/dockerRegistry/DockerRegistryAccount.java b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/providers/dockerRegistry/DockerRegistryAccount.java index 763a8df910..d3bb199ab9 100644 --- a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/providers/dockerRegistry/DockerRegistryAccount.java +++ b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/model/v1/providers/dockerRegistry/DockerRegistryAccount.java @@ -34,6 +34,7 @@ public class DockerRegistryAccount extends Account { private String password; private String email; private Long cacheIntervalSeconds = 30L; + private Boolean insecureRegistry = false; private List repositories = new ArrayList<>(); @LocalFile private String passwordFile; @LocalFile private String dockerconfigFile; diff --git a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/validate/v1/providers/dockerRegistry/DockerRegistryAccountValidator.java b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/validate/v1/providers/dockerRegistry/DockerRegistryAccountValidator.java index 3b6b6e6e24..74e01f449a 100644 --- a/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/validate/v1/providers/dockerRegistry/DockerRegistryAccountValidator.java +++ b/halyard-config/src/main/java/com/netflix/spinnaker/halyard/config/validate/v1/providers/dockerRegistry/DockerRegistryAccountValidator.java @@ -79,6 +79,7 @@ public void validate(ConfigProblemSetBuilder p, DockerRegistryAccount n) { .passwordFile(n.getPasswordFile()) .dockerconfigFile(n.getDockerconfigFile()) .username(n.getUsername()) + .insecureRegistry(n.getInsecureRegistry()) .build(); } catch (Exception e) { p.addProblem(Severity.ERROR, "Failed to instantiate docker credentials for account \"" + n.getName() + "\".");