From 38ec012cb376083e20b1d3b726f7bc8044ba647e Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Wed, 23 Sep 2020 11:33:39 -0700 Subject: [PATCH] fix(coreos): handle coreos deprecation (#270) --- src/index.ts | 4 +++- system-test/test.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index a1b27a2..58a2b5b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -259,7 +259,9 @@ export class GCEImages { images = images.filter(this._filterDeprecated); } - if (images.length === 0) { + // All CoreOS images are now deprecated, See: + // https://cloud.google.com/compute/docs/eol/coreOS + if (images.length === 0 && !osParts.name.startsWith('coreos')) { throw new Error('Could not find a suitable image.'); } return images; diff --git a/system-test/test.ts b/system-test/test.ts index 07a9982..46b7240 100644 --- a/system-test/test.ts +++ b/system-test/test.ts @@ -74,6 +74,8 @@ describe('system tests', () => { const images = (await gceImages.getLatest()) as ImageMap; assert.strictEqual(typeof images, 'object'); Object.keys(images).forEach(osName => { + // https://cloud.google.com/compute/docs/eol/coreOS + if (osName.startsWith('coreos')) return; assert.strictEqual(typeof images[osName], 'object'); }); });