Skip to content

Commit

Permalink
Fix docker: invalid reference format
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Jun 29, 2021
1 parent 2e941f2 commit d5b70f5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions __tests__/buildx.test.ts
Expand Up @@ -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)(
Expand Down Expand Up @@ -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)(
Expand Down
10 changes: 5 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/buildx.ts
Expand Up @@ -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());
});
}

Expand Down Expand Up @@ -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();
});
}

0 comments on commit d5b70f5

Please sign in to comment.