Merge pull request #3072 from quay/joseph.schorr/QUAY-933/dockerfile-path
Fix lookup of Dockerfile in archives
This commit is contained in:
commit
babb7bb803
2 changed files with 4 additions and 3 deletions
|
@ -27,8 +27,8 @@ describe("DockerfileServiceImpl", () => {
|
|||
|
||||
beforeEach(() => {
|
||||
file = "FROM quay.io/coreos/nginx:latest";
|
||||
validArchiveFile = [{name: 'Dockerfile', toBlob: jasmine.createSpy('toBlobSpy').and.returnValue(file)}];
|
||||
invalidArchiveFile = [{name: 'main.exe', toBlob: jasmine.createSpy('toBlobSpy').and.returnValue("")}];
|
||||
validArchiveFile = [{name: 'Dockerfile', path: 'Dockerfile', toBlob: jasmine.createSpy('toBlobSpy').and.returnValue(file)}];
|
||||
invalidArchiveFile = [{name: 'main.exe', path: 'main.exe', toBlob: jasmine.createSpy('toBlobSpy').and.returnValue("")}];
|
||||
|
||||
dataFileServiceMock.setup(mock => mock.readDataArrayAsPossibleArchive).is((buf, success, failure) => {
|
||||
failure([]);
|
||||
|
@ -131,6 +131,7 @@ describe("DockerfileServiceImpl", () => {
|
|||
it("returns rejected promise if given archive file with invalid Dockerfile", (done) => {
|
||||
forDataSpy.and.returnValue(null);
|
||||
invalidArchiveFile[0].name = 'Dockerfile';
|
||||
invalidArchiveFile[0].path = 'Dockerfile';
|
||||
dataFileServiceMock.setup(mock => mock.readDataArrayAsPossibleArchive).is((buf, success, failure) => {
|
||||
success(invalidArchiveFile);
|
||||
});
|
||||
|
|
|
@ -61,7 +61,7 @@ export class DockerfileServiceImpl implements DockerfileService {
|
|||
return new Promise((resolve, reject) => {
|
||||
var found: boolean = false;
|
||||
files.forEach((file) => {
|
||||
if (file['name'] == 'Dockerfile') {
|
||||
if (file['path'] == 'Dockerfile' || file['path'] == '/Dockerfile') {
|
||||
this.DataFileService.blobToString(file.toBlob(), (contents: string) => {
|
||||
var result: DockerfileInfoImpl | null = DockerfileInfoImpl.forData(contents, this.Config);
|
||||
if (result == null) {
|
||||
|
|
Reference in a new issue