Skip to content

Commit

Permalink
Add support for minio hosted artifacts (#389)
Browse files Browse the repository at this point in the history
* Add support for minio artifacts

* Add new tests for parity
  • Loading branch information
vanpelt authored and yebrahim committed Nov 28, 2018
1 parent a2e533d commit f3789fb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
24 changes: 24 additions & 0 deletions frontend/src/lib/WorkflowParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,30 @@ describe('WorkflowParser', () => {
source: StorageService.GCS,
});
});

it('handles Minio bucket without key', () => {
expect(WorkflowParser.parseStoragePath('minio://testbucket/')).toEqual({
bucket: 'testbucket',
key: '',
source: StorageService.MINIO,
});
});

it('handles Minio bucket and key', () => {
expect(WorkflowParser.parseStoragePath('minio://testbucket/testkey')).toEqual({
bucket: 'testbucket',
key: 'testkey',
source: StorageService.MINIO,
});
});

it('handles Minio bucket and multi-part key', () => {
expect(WorkflowParser.parseStoragePath('minio://testbucket/test/key/path')).toEqual({
bucket: 'testbucket',
key: 'test/key/path',
source: StorageService.MINIO,
});
});
});

describe('getOutboundNodes', () => {
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/lib/WorkflowParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ export default class WorkflowParser {
key: pathParts.slice(1).join('/'),
source: StorageService.GCS,
};
} else if (strPath.startsWith('minio://')) {
const pathParts = strPath.substr('minio://'.length).split('/');
return {
bucket: pathParts[0],
key: pathParts.slice(1).join('/'),
source: StorageService.MINIO,
};
} else {
throw new Error('Unsupported storage path: ' + strPath);
}
Expand Down

0 comments on commit f3789fb

Please sign in to comment.