1
0
Fork 0
mirror of https://github.com/docker/setup-buildx-action.git synced 2024-11-25 13:01:57 +00:00

Fix docker: invalid reference format

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-06-29 14:02:42 +02:00
parent 2e941f2def
commit d5b70f51d8
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
3 changed files with 12 additions and 12 deletions

View file

@ -23,7 +23,7 @@ describe('getVersion', () => {
silent: true
})
.then(res => {
return !res.stdout.includes(' ') && res.exitCode == 0;
return !res.stdout.trim().includes(' ') && res.exitCode == 0;
});
}
(isDaemonRunning() ? it : it.skip)(
@ -55,7 +55,7 @@ describe('inspect', () => {
silent: true
})
.then(res => {
return !res.stdout.includes(' ') && res.exitCode == 0;
return !res.stdout.trim().includes(' ') && res.exitCode == 0;
});
}
(isDaemonRunning() ? it : it.skip)(

10
dist/index.js generated vendored
View file

@ -72,7 +72,7 @@ function getVersion() {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr.trim());
}
return parseVersion(res.stdout);
return parseVersion(res.stdout.trim());
});
});
}
@ -227,24 +227,24 @@ function getBuildKitVersion(containerID) {
.then(bkitimage => {
if (bkitimage.exitCode == 0 && bkitimage.stdout.length > 0) {
return exec
.getExecOutput(`docker`, ['run', '--rm', bkitimage.stdout, '--version'], {
.getExecOutput(`docker`, ['run', '--rm', bkitimage.stdout.trim(), '--version'], {
ignoreReturnCode: true,
silent: true
})
.then(bkitversion => {
if (bkitversion.exitCode == 0 && bkitversion.stdout.length > 0) {
return `${bkitimage.stdout} => ${bkitversion.stdout}`;
return `${bkitimage.stdout.trim()} => ${bkitversion.stdout.trim()}`;
}
else if (bkitversion.stderr.length > 0) {
core.warning(bkitversion.stderr.trim());
}
return bkitversion.stdout;
return bkitversion.stdout.trim();
});
}
else if (bkitimage.stderr.length > 0) {
core.warning(bkitimage.stderr.trim());
}
return bkitimage.stdout;
return bkitimage.stdout.trim();
});
});
}

View file

@ -42,7 +42,7 @@ export async function getVersion(): Promise<string> {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr.trim());
}
return parseVersion(res.stdout);
return parseVersion(res.stdout.trim());
});
}
@ -196,21 +196,21 @@ export async function getBuildKitVersion(containerID: string): Promise<string> {
.then(bkitimage => {
if (bkitimage.exitCode == 0 && bkitimage.stdout.length > 0) {
return exec
.getExecOutput(`docker`, ['run', '--rm', bkitimage.stdout, '--version'], {
.getExecOutput(`docker`, ['run', '--rm', bkitimage.stdout.trim(), '--version'], {
ignoreReturnCode: true,
silent: true
})
.then(bkitversion => {
if (bkitversion.exitCode == 0 && bkitversion.stdout.length > 0) {
return `${bkitimage.stdout} => ${bkitversion.stdout}`;
return `${bkitimage.stdout.trim()} => ${bkitversion.stdout.trim()}`;
} else if (bkitversion.stderr.length > 0) {
core.warning(bkitversion.stderr.trim());
}
return bkitversion.stdout;
return bkitversion.stdout.trim();
});
} else if (bkitimage.stderr.length > 0) {
core.warning(bkitimage.stderr.trim());
}
return bkitimage.stdout;
return bkitimage.stdout.trim();
});
}