Skip to content

Commit

Permalink
Check Buildx version
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
CrazyMax committed Aug 23, 2020
1 parent f11192a commit 3e57a33
Show file tree
Hide file tree
Showing 7 changed files with 2,251 additions and 23 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ on:
jobs:
single:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
buildx-version:
- ""
- latest
steps:
-
name: Run local registry
Expand All @@ -31,6 +37,7 @@ jobs:
id: buildx
uses: ./setup-buildx/ # change to docker/setup-buildx-action@master
with:
version: ${{ matrix.buildx-version }}
driver-opt: network=host
buildkitd-flags: --allow-insecure-entitlement security.insecure
-
Expand Down Expand Up @@ -63,6 +70,9 @@ jobs:
strategy:
fail-fast: false
matrix:
buildx-version:
- ""
- latest
dockerfile:
- multi
- multi-sudo
Expand All @@ -84,6 +94,7 @@ jobs:
id: buildx
uses: ./setup-buildx/ # change to docker/setup-buildx-action@master
with:
version: ${{ matrix.buildx-version }}
driver-opt: network=host
buildkitd-flags: --allow-insecure-entitlement security.insecure
-
Expand All @@ -110,6 +121,12 @@ jobs:

git-context:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
buildx-version:
#- "" # GIT_AUTH_TOKEN not available in the current version on the GitHub Runner
- latest
steps:
-
name: Run local registry
Expand All @@ -128,7 +145,7 @@ jobs:
id: buildx
uses: ./setup-buildx/ # change to docker/setup-buildx-action@master
with:
version: latest
version: ${{ matrix.buildx-version }}
driver-opt: network=host
buildkitd-flags: --allow-insecure-entitlement security.insecure
-
Expand Down
18 changes: 18 additions & 0 deletions __tests__/buildx.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'fs';
import * as semver from 'semver';
import * as buildx from '../src/buildx';

const digest = 'sha256:bfb45ab72e46908183546477a08f8867fc40cebadd00af54b071b097aed127a9';
Expand All @@ -13,3 +14,20 @@ describe('getImageID', () => {
expect(imageID).toEqual(digest);
});
});

describe('getVersion', () => {
it('valid', async () => {
const version = await buildx.getVersion();
console.log(`version: ${version}`);
expect(semver.valid(version)).not.toBeNull();
}, 100000);
});

describe('parseVersion', () => {
test.each([
['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2']
])('given %p', async (stdout, expected) => {
expect(await buildx.parseVersion(stdout)).toEqual(expected);
});
});
Loading

0 comments on commit 3e57a33

Please sign in to comment.