Skip to content

[Enhancement]: Environment Variables for Named Image Paths #1517

@jzabroski

Description

@jzabroski

Problem

If an image is not available, e.g. due to a bug, the simplest workaround recommended today is to add .WithImage("docker-registry-url-path-to-image") to the code.

Solution

Ideally, image builders would have names, and those names would be able to specify via environment variable an alternative url to the ones hardcoded in TestContainers packages.

Benefit

C# code is not directly edited, and changes can be flipped via command line environment variables, such as in Runners (GitHub Actions, AZP, etc). This would also facilitate other user stories, such as using The GitHub Actions matrix strategy to run the job with multiple images.

Alternatives

  1. Lots of commits to my GitHub repository's /src/ or /tests/ folders that have nothing to do with the actual purpose of the repository, or than to alter dependencies.
  2. Implement my own environment variables for the images I care about, and do:
    var sqlServerImage = Environment.GetEnvironmentVariable("FM_TestContainers_SqlServer_RemoteUri");
    if (sqlServerImage != null)
      builder = builder.WithImage(sqlServerImage);

Would you like to help contributing this enhancement?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions