Skip to content

Commit ca44bff

Browse files
authored
[ST] Update mechanism for changing the Docker registry, repository, and tag (#10946)
Signed-off-by: Lukas Kral <[email protected]>
1 parent 212b285 commit ca44bff

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

systemtest/src/main/java/io/strimzi/systemtest/Environment.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ public class Environment {
190190
* Defaults
191191
*/
192192
public static final String STRIMZI_ORG_DEFAULT = "strimzi";
193-
public static final String STRIMZI_TAG_DEFAULT = "latest";
194193
public static final String STRIMZI_REGISTRY_DEFAULT = "quay.io";
195194
public static final String TEST_CLIENTS_ORG_DEFAULT = "strimzi-test-clients";
196195
private static final String TEST_LOG_DIR_DEFAULT = TestUtils.USER_PATH + "/../systemtest/target/logs/";
@@ -225,9 +224,9 @@ public class Environment {
225224
* Set values
226225
*/
227226
public static final String SYSTEM_TEST_STRIMZI_IMAGE_PULL_SECRET = getOrDefault(STRIMZI_IMAGE_PULL_SECRET_ENV, "");
228-
public static final String STRIMZI_ORG = getOrDefault(STRIMZI_ORG_ENV, STRIMZI_ORG_DEFAULT);
229-
public static final String STRIMZI_TAG = getOrDefault(STRIMZI_TAG_ENV, STRIMZI_TAG_DEFAULT);
230-
public static final String STRIMZI_REGISTRY = getOrDefault(STRIMZI_REGISTRY_ENV, STRIMZI_REGISTRY_DEFAULT);
227+
public static final String STRIMZI_ORG = getOrDefault(STRIMZI_ORG_ENV, "");
228+
public static final String STRIMZI_TAG = getOrDefault(STRIMZI_TAG_ENV, "");
229+
public static final String STRIMZI_REGISTRY = getOrDefault(STRIMZI_REGISTRY_ENV, "");
231230
public static final String TEST_LOG_DIR = getOrDefault(TEST_LOG_DIR_ENV, TEST_LOG_DIR_DEFAULT);
232231
public static final String PERFORMANCE_DIR = getOrDefault(PERFORMANCE_DIR_ENV, PERFORMANCE_DIR_DEFAULT);
233232
public static final String ST_KAFKA_VERSION = getOrDefault(ST_KAFKA_VERSION_ENV, ST_KAFKA_VERSION_DEFAULT);

systemtest/src/main/java/io/strimzi/systemtest/utils/StUtils.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ public static boolean isAllowOnCurrentEnvironment(String envVariableForCheck) {
108108
public static String changeOrgAndTag(String image) {
109109
Matcher m = IMAGE_PATTERN_FULL_PATH.matcher(image);
110110
if (m.find()) {
111-
String registry = setImageProperties(m.group("registry"), Environment.STRIMZI_REGISTRY, Environment.STRIMZI_REGISTRY_DEFAULT);
112-
String org = setImageProperties(m.group("org"), Environment.STRIMZI_ORG, Environment.STRIMZI_ORG_DEFAULT);
111+
String registry = setImageProperties(m.group("registry"), Environment.STRIMZI_REGISTRY);
112+
String org = setImageProperties(m.group("org"), Environment.STRIMZI_ORG);
113113

114114
return registry + "/" + org + "/" + m.group("image") + ":" + buildTag(m.group("tag"));
115115
}
116116
m = IMAGE_PATTERN.matcher(image);
117117
if (m.find()) {
118-
String org = setImageProperties(m.group("org"), Environment.STRIMZI_ORG, Environment.STRIMZI_ORG_DEFAULT);
118+
String org = setImageProperties(m.group("org"), Environment.STRIMZI_ORG);
119119

120120
return Environment.STRIMZI_REGISTRY + "/" + org + "/" + m.group("image") + ":" + buildTag(m.group("tag"));
121121
}
@@ -132,15 +132,15 @@ public static String changeOrgAndTagInImageMap(String imageMap) {
132132
return sb.toString();
133133
}
134134

135-
private static String setImageProperties(String current, String envVar, String defaultEnvVar) {
136-
if (!envVar.equals(defaultEnvVar) && !current.equals(envVar)) {
135+
private static String setImageProperties(String current, String envVar) {
136+
if (!envVar.isEmpty() && !current.equals(envVar)) {
137137
return envVar;
138138
}
139139
return current;
140140
}
141141

142142
private static String buildTag(String currentTag) {
143-
if (!currentTag.equals(Environment.STRIMZI_TAG) && !Environment.STRIMZI_TAG_DEFAULT.equals(Environment.STRIMZI_TAG)) {
143+
if (!Environment.STRIMZI_TAG.isEmpty() && !currentTag.equals(Environment.STRIMZI_TAG)) {
144144
Matcher t = KAFKA_COMPONENT_PATTERN.matcher(currentTag);
145145
if (t.find()) {
146146
currentTag = Environment.STRIMZI_TAG + t.group("kafka") + t.group("version");

0 commit comments

Comments
 (0)