Skip to content

Commit 17c74a3

Browse files
authored
Update Cromwell to 87 and parse prerelease tags as customized (#822)
1 parent 25f2976 commit 17c74a3

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/deploy-cromwell-on-azure/Configuration.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static Configuration BuildConfiguration(string[] args)
107107

108108
if (System.IO.File.Exists(configFilename))
109109
{
110-
configBuilder.AddJsonFile(configFilename);
110+
configBuilder.AddJsonFile(System.IO.Path.GetFullPath(configFilename));
111111
}
112112

113113
var configurationSource = configBuilder.AddCommandLine(args).Build();

src/deploy-cromwell-on-azure/Deployer.cs

+8-5
Original file line numberDiff line numberDiff line change
@@ -1003,8 +1003,8 @@ private Dictionary<string, string> ConfigureSettings(string managedIdentityClien
10031003
UpdateSetting(settings, defaults, "CromwellImageName",
10041004
value: string.IsNullOrWhiteSpace(configuration.CromwellImageName) ? (string.IsNullOrWhiteSpace(configuration.CromwellVersion) ? null : configuration.CromwellVersion) : configuration.CromwellImageName,
10051005
ConvertValue: string.IsNullOrWhiteSpace(configuration.CromwellImageName) ? (v => installedVersion is null ? $"broadinstitute/cromwell:{v}" : $"{GetCromwellImageNameWithoutTag(settings["CromwellImageName"])}:{v}") : null,
1006-
ignoreDefaults: ImageNameIgnoreDefaults(settings, defaults, "CromwellImageName", configuration.CromwellVersion is null && configuration.CromwellImageName is null, installedVersion,
1007-
tag => GetCromwellImageTag(settings["CromwellImageName"]) <= GetCromwellImageTag(defaults["CromwellImageName"]))); // There's not a good way to detect customization of this property, so default to forced upgrade to the new default.
1006+
ignoreDefaults: ImageNameIgnoreDefaults(settings, defaults, "CromwellImageName", configuration.CromwellVersion is null && configuration.CromwellImageName is null, installedVersion, tagKey: nameof(configuration.CromwellVersion),
1007+
IsInstalledNotCustomized: tag => GetCromwellImageTag(settings["CromwellImageName"]) <= GetCromwellImageTag(defaults["CromwellImageName"]))); // There's not a good way to detect customization of this property, so default to forced upgrade to the new default.
10081008

10091009
UpdateSetting(settings, defaults, "TesImageName", configuration.TesImageName, ignoreDefaults: ImageNameIgnoreDefaults(settings, defaults, "TesImageName", configuration.TesImageName is null, installedVersion));
10101010
UpdateSetting(settings, defaults, "TriggerServiceImageName", configuration.TriggerServiceImageName, ignoreDefaults: ImageNameIgnoreDefaults(settings, defaults, "TriggerServiceImageName", configuration.TriggerServiceImageName is null, installedVersion));
@@ -1050,7 +1050,7 @@ static string GetCromwellImageNameWithoutTag(string imageName)
10501050
=> imageName?[..(imageName.LastIndexOf(':'))] ?? null;
10511051

10521052
static int GetCromwellImageTag(string imageName)
1053-
=> int.TryParse(imageName?[(imageName.LastIndexOf(':') + 1)..] ?? string.Empty, System.Globalization.NumberStyles.Integer, System.Globalization.NumberFormatInfo.InvariantInfo, out var tag) ? tag : 0;
1053+
=> int.TryParse(imageName?[(imageName.LastIndexOf(':') + 1)..] ?? string.Empty, System.Globalization.NumberStyles.Integer, System.Globalization.NumberFormatInfo.InvariantInfo, out var tag) ? tag : int.MaxValue;
10541054
}
10551055

10561056
/// <summary>
@@ -1062,9 +1062,10 @@ static int GetCromwellImageTag(string imageName)
10621062
/// <param name="valueIsNull">True if configuration value to set is null. See <see cref="UpdateSetting{T}(Dictionary{string, string}, Dictionary{string, string}, string, T, Func{T, string}, string, bool?)"/>'s "value" parameter.</param>
10631063
/// <param name="installedVersion">A <see cref="Version"/> of the current configuration, or null if this is not an update.</param>
10641064
/// <param name="IsInstalledNotCustomized">A <see cref="Predicate{T}"/> where the parameter is the image tag of the currently configured image. Only called if the rest of the image name is identical to the default. Return False if the value is considered customized, otherwise True.</param>
1065+
/// <param name="tagKey">Configuration key of tag to use in warning if <paramref name="key"/> is not correct.</param>
10651066
/// <returns>false if current setting should be ignored, null otherwise.</returns>
10661067
/// <remarks>This method provides a value for the "ignoreDefaults" parameter to <see cref="UpdateSetting{T}(Dictionary{string, string}, Dictionary{string, string}, string, T, Func{T, string}, string, bool?)"/> for use with container image names.</remarks>
1067-
private static bool? ImageNameIgnoreDefaults(Dictionary<string, string> settings, Dictionary<string, string> defaults, string key, bool valueIsNull, Version installedVersion, Predicate<string> IsInstalledNotCustomized = default)
1068+
private static bool? ImageNameIgnoreDefaults(Dictionary<string, string> settings, Dictionary<string, string> defaults, string key, bool valueIsNull, Version installedVersion, Predicate<string> IsInstalledNotCustomized = default, string tagKey = default)
10681069
{
10691070
if (installedVersion is null || !valueIsNull)
10701071
{
@@ -1106,7 +1107,8 @@ static int GetCromwellImageTag(string imageName)
11061107

11071108
if (result is null && !sameVersionUpgrade)
11081109
{
1109-
ConsoleEx.WriteLine($"Warning: CromwellOnAzure is being upgraded, but {key} was customized, and is not being upgraded, which might not be what you want. (To remove the customization of {key}, set it to the empty string.)", ConsoleColor.Yellow);
1110+
var configKey = installed.StartsWith(defaultPath + ":") ? tagKey ?? key : key;
1111+
ConsoleEx.WriteLine($"Warning: CromwellOnAzure is being upgraded, but {configKey} was customized, and is not being upgraded, which might not be what you want. (To remove the customization of {configKey}, set it to the empty string.)", ConsoleColor.Yellow);
11101112
}
11111113

11121114
return result;
@@ -2258,6 +2260,7 @@ void ValidateHelmInstall(string helmPath, string featureName)
22582260

22592261
if (!configuration.ManualHelmDeployment)
22602262
{
2263+
configuration.HelmBinaryPath = configuration.HelmBinaryPath is null ? null : Environment.ExpandEnvironmentVariables(configuration.HelmBinaryPath);
22612264
ValidateHelmInstall(configuration.HelmBinaryPath, nameof(configuration.HelmBinaryPath));
22622265
}
22632266

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CromwellImageName=broadinstitute/cromwell:86
1+
CromwellImageName=broadinstitute/cromwell:87

0 commit comments

Comments
 (0)