Handle git sha version of buildx

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2021-07-01 15:48:09 +02:00
parent 74b5bf4701
commit c77e0eff0f
6 changed files with 20 additions and 3085 deletions

View File

@@ -1,5 +1,5 @@
{ {
"printWidth": 120, "printWidth": 240,
"tabWidth": 2, "tabWidth": 2,
"useTabs": false, "useTabs": false,
"semi": true, "semi": true,

View File

@@ -32,8 +32,9 @@ describe('parseVersion', () => {
test.each([ test.each([
['github.com/docker/buildx 0.4.1+azure bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'], ['github.com/docker/buildx 0.4.1+azure bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'], ['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2'] ['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2'],
['github.com/docker/buildx f117971 f11797113e5a9b86bd976329c5dbb8a8bfdfadfa', 'f117971']
])('given %p', async (stdout, expected) => { ])('given %p', async (stdout, expected) => {
expect(await buildx.parseVersion(stdout)).toEqual(expected); expect(buildx.parseVersion(stdout)).toEqual(expected);
}); });
}); });

View File

@@ -124,13 +124,7 @@ FOO=bar`
); );
const res = await context.getInputList('secrets', true); const res = await context.getInputList('secrets', true);
console.log(res); console.log(res);
expect(res).toEqual([ expect(res).toEqual(['GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789', 'MYSECRET=aaaaaaaa', 'bbbbbbb', 'ccccccccc', 'FOO=bar']);
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
'MYSECRET=aaaaaaaa',
'bbbbbbb',
'ccccccccc',
'FOO=bar'
]);
}); });
it('multiline values escape quotes', async () => { it('multiline values escape quotes', async () => {

3
codecov.yml Normal file
View File

@@ -0,0 +1,3 @@
comment: false
github_checks:
annotations: false

3075
dist/index.js generated vendored

File diff suppressed because it is too large Load Diff

View File

@@ -29,10 +29,10 @@ export async function getVersion(): Promise<string> {
}); });
} }
export async function parseVersion(stdout: string): Promise<string> { export function parseVersion(stdout: string): string {
const matches = /\sv?([0-9.]+)/.exec(stdout); const matches = /\sv?([0-9a-f]{7}|[0-9.]+)/.exec(stdout);
if (!matches) { if (!matches) {
throw new Error(`Cannot parse buildx version`); throw new Error(`Cannot parse buildx version`);
} }
return semver.clean(matches[1]); return matches[1];
} }