diff --git a/frontend/server/configs.ts b/frontend/server/configs.ts index 5f8a69f8c2e..f93b6c82b6d 100644 --- a/frontend/server/configs.ts +++ b/frontend/server/configs.ts @@ -58,6 +58,7 @@ export function loadConfigs(argv: string[], env: ProcessEnv): UIConfigs { /** minio client use these to retrieve s3 objects/artifacts */ AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, + AWS_REGION, /** http/https base URL */ HTTP_BASE_URL = '', /** http/https fetch with this authorization header key (for example: 'Authorization') */ @@ -124,6 +125,7 @@ export function loadConfigs(argv: string[], env: ProcessEnv): UIConfigs { aws: { accessKey: AWS_ACCESS_KEY_ID || '', endPoint: 's3.amazonaws.com', + region: AWS_REGION || 'us-east-1', secretKey: AWS_SECRET_ACCESS_KEY || '', }, http: { @@ -201,6 +203,7 @@ export interface MinioConfigs { } export interface AWSConfigs { endPoint: string; + region: string; accessKey: string; secretKey: string; } diff --git a/frontend/server/integration-tests/artifact-get.test.ts b/frontend/server/integration-tests/artifact-get.test.ts index 36aaa375a14..868678233d0 100644 --- a/frontend/server/integration-tests/artifact-get.test.ts +++ b/frontend/server/integration-tests/artifact-get.test.ts @@ -105,6 +105,7 @@ describe('/artifacts', () => { expect(mockedMinioClient).toBeCalledWith({ accessKey: 'aws123', endPoint: 's3.amazonaws.com', + region: 'us-east-1', secretKey: 'awsSecret123', }); done(err); @@ -126,6 +127,30 @@ describe('/artifacts', () => { expect(mockedMinioClient).toBeCalledWith({ accessKey: 'aws123', endPoint: 's3.amazonaws.com', + region: 'us-east-1', + secretKey: 'awsSecret123', + }); + done(err); + }); + }); + + it('responds with a s3 artifact from bucket in non-default region if source=s3', done => { + const mockedMinioClient: jest.Mock = jest.spyOn(minioHelper, 'createMinioClient') as any; + const configs = loadConfigs(argv, { + AWS_ACCESS_KEY_ID: 'aws123', + AWS_SECRET_ACCESS_KEY: 'awsSecret123', + AWS_REGION: 'eu-central-1', + }); + app = new UIServer(configs); + + const request = requests(app.start()); + request + .get('/artifacts/get?source=s3&bucket=ml-pipeline&key=hello%2Fworld.txt') + .expect(200, artifactContent, err => { + expect(mockedMinioClient).toBeCalledWith({ + accessKey: 'aws123', + endPoint: 's3.amazonaws.com', + region: 'eu-central-1', secretKey: 'awsSecret123', }); done(err);