From 2921f960487ee6061dc6255ff48b1b6b46d32b4b Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Mon, 25 Sep 2023 14:40:31 +0200 Subject: [PATCH] api/aws: support `--aws-ami=lts` for test/spawning it allows to use the 'lts' channel when testing quickly with kola. Signed-off-by: Mathieu Tortuyaux --- platform/api/aws/ami.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platform/api/aws/ami.go b/platform/api/aws/ami.go index 3697e121d..4ad0c62e7 100644 --- a/platform/api/aws/ami.go +++ b/platform/api/aws/ami.go @@ -39,6 +39,9 @@ var amiCache struct { stableOnce sync.Once stableAMIs *releaseAMIs + + ltsOnce sync.Once + ltsAMIs *releaseAMIs } // resolveAMI is used to minimize network requests while allowing resolution of @@ -77,6 +80,11 @@ func resolveAMI(ami string, region string) string { amiCache.stableAMIs = resolveChannel(ami) }) channelAmis = amiCache.stableAMIs + case "lts": + amiCache.ltsOnce.Do(func() { + amiCache.ltsAMIs = resolveChannel(ami) + }) + channelAmis = amiCache.ltsAMIs default: return ami }