Skip to content

Fix and cleanup of v2 setup actions #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/setup-buildx-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ jobs:
- v0.2.2
- ""
steps:
-
name: Runner info
run: |
sudo apt-get install -y hwinfo
sudo hwinfo --short
sudo mount
-
name: Checkout
uses: actions/checkout@v2.3.1
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/setup-buildx-precheckin.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/setup-qemu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ jobs:
- all
- arm64,riscv64,arm
steps:
-
name: Runner info
run: |
sudo apt-get install -y hwinfo
sudo hwinfo --short
sudo mount
-
name: Checkout
uses: actions/checkout@v2.3.1
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/setup-qemu-precheckin.yml

This file was deleted.

21 changes: 11 additions & 10 deletions setup-buildx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
-
name: Set up Docker Buildx
id: buildx
uses: docker/actions/setup-buildx@v1
uses: docker/setup-buildx-action@v1
with:
version: latest
-
Expand Down Expand Up @@ -71,13 +71,13 @@ jobs:
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/actions/setup-qemu@v1
uses: docker/setup-qemu-action@v1
with:
platforms: all
-
name: Set up Docker Buildx
id: buildx
uses: docker/actions/setup-buildx@v1
uses: docker/setup-buildx-action@v1
with:
version: latest
-
Expand All @@ -91,13 +91,14 @@ jobs:

Following inputs can be used as `step.with` keys

| Name | Type | Default | Description |
|------------------|---------|-----------------------------------|------------------------------------|
| `version` | String | _the one installed on the runner_ | [Buildx](https://github.com/docker/buildx) version. e.g. `v0.3.0`, `latest` |
| `driver` | String | `docker-container` | Sets the [builder driver](https://github.com/docker/buildx#--driver-driver) to be used. |
| `driver-opt` | String | | Passes additional [driver-specific options](https://github.com/docker/buildx#--driver-opt-options). e.g. `image=moby/buildkit:master` |
| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` |
| `use` | Bool | `true` | Switch to this builder instance |
| Name | Type | Default | Description |
|--------------------|---------|-----------------------------------|------------------------------------|
| `version` | String | _the one installed on the runner_ | [Buildx](https://github.com/docker/buildx) version. e.g. `v0.3.0`, `latest` |
| `driver` | String | `docker-container` | Sets the [builder driver](https://github.com/docker/buildx#--driver-driver) to be used. |
| `driver-opt` | String | | Passes additional [driver-specific options](https://github.com/docker/buildx#--driver-opt-options). e.g. `image=moby/buildkit:master` |
| `buildkitd-flags` | String | | [Flags for buildkitd](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md) daemon. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if should add special case for allow-insecure-entitlement so it works together with allow in build action. Or actually, maybe we should just always enable allow-insecure-entitlement in github actions context as these run in a isolated VM anyway. I could also add --allow-insecure-entitlement=all in buildkit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tonistiigi

wondering if should add special case for allow-insecure-entitlement so it works together with allow in build action. Or actually, maybe we should just always enable allow-insecure-entitlement in github actions context as these run in a isolated VM anyway.

Yes, that was the purpose of integrating buildkit-flags so that I can use a local registry for testing. And indeed in the case of GitHub Actions it seems logical to me to enable allow-insecure-entitlement by default.

I could also add --allow-insecure-entitlement=all in buildkit.

Yes SGTM!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tonistiigi Ok local registry is working in our ci workflow.

| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` |
| `use` | Bool | `true` | Switch to this builder instance |

### outputs

Expand Down
6 changes: 3 additions & 3 deletions setup-buildx/__tests__/buildx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-buildx-'));
describe('buildx', () => {
it('is available', async () => {
expect(await buildx.isAvailable()).toBe(true);
});
}, 100000);

it('count builders', async () => {
const countBuilders = await buildx.countBuilders();
console.log(`countBuilders: ${countBuilders}`);
expect(countBuilders).toBeGreaterThan(0);
});
}, 100000);

it('platforms', async () => {
const platforms = await buildx.platforms();
console.log(`platforms: ${platforms}`);
expect(platforms).not.toBeUndefined();
expect(platforms).not.toEqual('');
});
}, 100000);

it('acquires v0.2.2 version of buildx', async () => {
const buildxBin = await buildx.install('v0.2.2', tmpDir);
Expand Down
11 changes: 7 additions & 4 deletions setup-buildx/action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
name: 'Docker - Setup Buildx'
description: 'GitHub Action to set up Docker Buildx'
author: 'crazy-max'
name: 'Docker Setup Buildx'
description: 'Set up Docker Buildx'
author: 'docker'
branding:
icon: 'anchor'
color: 'blue'
icon: 'truck'

inputs:
version:
Expand All @@ -17,6 +17,9 @@ inputs:
driver-opt:
description: 'Passes additional driver-specific options. Eg. image=moby/buildkit:master'
required: false
buildkitd-flags:
description: 'Flags for buildkitd daemon'
required: false
install:
description: 'Sets up docker build command as an alias to docker buildx'
default: 'false'
Expand Down
36 changes: 21 additions & 15 deletions setup-buildx/dist/index.js

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

10 changes: 6 additions & 4 deletions setup-buildx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-buildx",
"description": "GitHub Action to set up Docker Buildx",
"description": "Set up Docker Buildx",
"main": "lib/main.js",
"scripts": {
"build": "tsc && ncc build",
Expand All @@ -11,15 +11,17 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/docker/actions.git",
"directory": "setup-buildx"
"url": "git+https://github.com/docker/setup-buildx-action.git"
},
"keywords": [
"actions",
"docker",
"buildx"
],
"author": "CrazyMax",
"author": "Docker",
"contributors": [
"CrazyMax"
],
"license": "Apache-2.0",
"dependencies": {
"@actions/core": "^1.2.4",
Expand Down
4 changes: 2 additions & 2 deletions setup-buildx/src/exec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as actionsExec from '@actions/exec';
import * as aexec from '@actions/exec';
import {ExecOptions} from '@actions/exec';

export interface ExecResult {
Expand All @@ -24,7 +24,7 @@ export const exec = async (command: string, args: string[] = [], silent: boolean
}
};

const returnCode: number = await actionsExec.exec(command, args, options);
const returnCode: number = await aexec.exec(command, args, options);

return {
success: returnCode === 0,
Expand Down
Loading