Skip to content

Possibility to use secrets when downloading remote artifacts #123

@aleksanderson

Description

@aleksanderson

Reason/Context

Initial discussion: https://discord.com/channels/1162356525969449100/1377342093474926713

--

microcs-testcontainer-node has the withSecret() method. The documentation https://github.com/microcks/microcks-testcontainers-node explains how to set this up and use it for the Contract Test use case. However, it is not possible to reference the secret in cases when we need to download remote artifacts, e.g., .withMainRemoteArtifacts() and .withSecondaryRemoteArtifacts()

Use cases:

  • Create a mock server using Microcks Testcontainer and inject it with the OpenAPI specification hosted in a remote private repository.

Description

Extend the .withMainRemoteArtifacts() and .withSecondaryRemoteArtifacts() methods to accept the secret created earlier via .withSecret()

There are two options:

Option 1 - A fully backward compatible:

microcksContainer
  .withMainRemoteArtifacts([
    { url: "https://gitlab.com/user/repo/artifact1.yaml", secretName: "gl-secret" },
   "https://github.com/user/repo/artifact2.yaml" 
  ])
  .withSecondaryRemoteArtifacts([
    { url: "https://gitlab.com/user/repo/examples1.yaml", secretName: "gl-secret" },
    "https://github.com/user/repo/examples2.yaml"
  ]);

Option 2 - Breaking change:

microcksContainer
  .withMainRemoteArtifacts([
    { url: "https://gitlab.com/user/repo/artifact1.yaml", secretName: "gl-secret" },
    { url: "https://github.com/user/repo/artifact2.yaml" }
  ])
  .withSecondaryRemoteArtifacts([
    { url: "https://gitlab.com/user/repo/examples1.yaml", secretName: "gl-secret" },
    { url: "https://github.com/user/repo/examples2.yaml" }
  ]);

Implementation ideas

This is an example of a proposed change set (breaking change option): https://github.com/aleksanderson/microcks-testcontainers-node/pull/1/files

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions