Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

Commit bbbc720

Browse files
authored
Merge pull request #494 from thestormforge/trials-image-envvar
Expose each Optimize Trial image as an environment variable
2 parents 4759b67 + 8acb9cc commit bbbc720

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

internal/experiment/generation/generation.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,14 @@ func ensureTrialJobPod(exp *optimizev1beta2.Experiment) *corev1.PodTemplateSpec
5555

5656
// trialJobImage returns the image name for a type of job.
5757
func trialJobImage(job string) string {
58-
// Allow the image name to be overridden using environment variables, primarily for development work
59-
imageName := os.Getenv("OPTIMIZE_TRIALS_IMAGE_REPOSITORY")
58+
// Allow the image name to be overridden using an environment variable, primarily for making the image name discoverable
59+
imageName := os.Getenv("OPTIMIZE_TRIALS_" + strings.ToUpper(strings.ReplaceAll(job, "-", "_")) + "_IMAGE")
60+
if imageName != "" {
61+
return imageName
62+
}
63+
64+
// Also allow the image name to be overridden using environment variables, primarily for development work
65+
imageName = os.Getenv("OPTIMIZE_TRIALS_IMAGE_REPOSITORY")
6066
if imageName == "" {
6167
imageName = "thestormforge/optimize-trials"
6268
}

0 commit comments

Comments
 (0)