diff --git a/frontend/server/aws-helper.test.ts b/frontend/server/aws-helper.test.ts index 66a22ac66bd..87a2a00ce01 100644 --- a/frontend/server/aws-helper.test.ts +++ b/frontend/server/aws-helper.test.ts @@ -118,6 +118,14 @@ describe('isS3Endpoint', () => { expect(isS3Endpoint('s3.cn-north-1.amazonaws.com.cn')).toBe(true); }); + it('checks a valid s3 fips GovCloud endpoint', () => { + expect(isS3Endpoint('s3-fips.us-gov-west-1.amazonaws.com')).toBe(true); + }); + + it('checks a valid s3 PrivateLink endpoint', () => { + expect(isS3Endpoint('vpce-1a2b3c4d-5e6f.s3.us-east-1.vpce.amazonaws.com')).toBe(true); + }); + it('checks an invalid s3 endpoint', () => { expect(isS3Endpoint('amazonaws.com')).toBe(false); }); diff --git a/frontend/server/handlers/artifacts.ts b/frontend/server/handlers/artifacts.ts index e87ee444e44..7af04b4aac5 100644 --- a/frontend/server/handlers/artifacts.ts +++ b/frontend/server/handlers/artifacts.ts @@ -95,7 +95,6 @@ export function getArtifactsHandler({ peek, )(req, res); break; - case 's3': getMinioArtifactHandler( { diff --git a/frontend/server/minio-helper.ts b/frontend/server/minio-helper.ts index f3979fde85b..bb272440d27 100644 --- a/frontend/server/minio-helper.ts +++ b/frontend/server/minio-helper.ts @@ -17,7 +17,8 @@ import * as tar from 'tar-stream'; import peek from 'peek-stream'; import gunzip from 'gunzip-maybe'; import { Client as MinioClient, ClientOptions as MinioClientOptions } from 'minio'; -import { awsInstanceProfileCredentials } from './aws-helper'; +import { awsInstanceProfileCredentials, isS3Endpoint } from './aws-helper'; +const { fromNodeProviderChain } = require('@aws-sdk/credential-providers'); /** MinioRequestConfig describes the info required to retrieve an artifact. */ export interface MinioRequestConfig { @@ -37,6 +38,25 @@ export interface MinioClientOptionsWithOptionalSecrets extends Partial=0.21.1",