Skip to content

Commit

Permalink
Fix #831
Browse files Browse the repository at this point in the history
docker-image resource source `registry_mirror` property
schema should allow for just a url rather than host/user/pass object.
  • Loading branch information
kdvolder committed Sep 7, 2022
1 parent 0c7974f commit 3b0a265
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ private void initializeDefaultResourceTypes() {
addProp(source, "aws_secret_access_key", t_ne_string);
addProp(source, "aws_session_token", t_ne_string);
addProp(source, "insecure_registries", t_strings);
addProp(source, "registry_mirror", registry_mirror);
addProp(source, "registry_mirror", t_ne_string);
addProp(source, "ca_certs", f.yseq(f.ybean("CaCertsEntry",
f.yprop("domain", t_ne_string),
f.yprop("cert", t_ne_string)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
*Optional.* Hostname and credentials pointing to a docker registry mirror service.
*Optional.* A URL pointing to a docker registry mirror service.

Note: `registry_mirror` is ignored if `repository` contains an explicitly-declared
registry-hostname-prefixed value, such as `my-registry.com/foo/bar`, in which case
the registry cited in the `repository` value is used instead of the `registry_mirror`.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -159,6 +158,22 @@ public class ConcourseEditorTest {
" source:\n" +
" repository: alpine\n" +
" tag: latest\n" +
" registry_mirror: https://my-registry.com\n" +
"run:\n" +
" path: sh\n" +
" args:\n" +
" - -exc\n" +
" - sleep 60\n"
);
editor.assertProblems(/*NONE*/);

editor = harness.newEditor(LanguageId.CONCOURSE_TASK,
"platform: linux\n" +
"image_resource:\n" +
" type: registry-image\n" +
" source:\n" +
" repository: alpine\n" +
" tag: latest\n" +
" registry_mirror:\n" +
" host: my-registry.com\n" +
" username: myuser\n" +
Expand All @@ -171,6 +186,7 @@ public class ConcourseEditorTest {
" - sleep 60\n"
);
editor.assertProblems("bad|Unknown");

}

@Test public void GH_639_globStar() throws Exception {
Expand Down Expand Up @@ -2455,10 +2471,7 @@ public void resourceAttributeHovers() throws Exception {
" aws_secret_access_key: {{aws_secret_key}}\n" +
" aws_session_token: ((aws_token))\n" +
" insecure_registries: no-list\n" +
" registry_mirror:\n" +
" host: dockermirror.com\n" +
" username: mirroruser\n" +
" password: ((mirror_pass))\n" +
" registry_mirror: https://some.registry.host\n" +
" max_concurrent_downloads: num-down\n" +
" max_concurrent_uploads: num-up\n" +
" ca_certs:\n" +
Expand Down Expand Up @@ -2497,10 +2510,7 @@ public void resourceAttributeHovers() throws Exception {
editor.assertHoverContains("aws_secret_access_key", "AWS secret key to use");
editor.assertHoverContains("aws_session_token", "AWS session token (assumed role)");
editor.assertHoverContains("insecure_registries", "array of CIDRs");
editor.assertHoverContains("registry_mirror", "Hostname and credentials pointing to a docker registry mirror service");
editor.assertHoverContains("host", "hostname pointing to a Docker registry mirror service");
editor.assertHoverContains("username", 2, "username to use when authenticating to the mirror");
editor.assertHoverContains("password", 2, "password to use when authenticating to the mirror");
editor.assertHoverContains("registry_mirror", "URL pointing to a docker registry mirror service");

editor.assertHoverContains("ca_certs", "Each entry specifies the x509 CA certificate for");
editor.assertHoverContains("client_certs", "Each entry specifies the x509 certificate and key");
Expand Down

0 comments on commit 3b0a265

Please sign in to comment.