Compare commits
	
		
			33 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					16c0bc4a6e | ||
| 
						 | 
					ebcacb9c21 | ||
| 
						 | 
					496a823b8b | ||
| 
						 | 
					a56031a493 | ||
| 
						 | 
					922550f064 | ||
| 
						 | 
					ecf95283f0 | ||
| 
						 | 
					b2a38ee0c6 | ||
| 
						 | 
					7f79690cac | ||
| 
						 | 
					bdd549bec0 | ||
| 
						 | 
					be4a3855af | ||
| 
						 | 
					6c4dbb29f6 | ||
| 
						 | 
					6a58db7e0d | ||
| 
						 | 
					d56292e348 | ||
| 
						 | 
					790eb2db47 | ||
| 
						 | 
					2a81c53912 | ||
| 
						 | 
					00b2400aad | ||
| 
						 | 
					484614d7a1 | ||
| 
						 | 
					d95759405f | ||
| 
						 | 
					5bb6d36be0 | ||
| 
						 | 
					a99c5e53ef | ||
| 
						 | 
					fc1a41d2e5 | ||
| 
						 | 
					95cefc3c57 | ||
| 
						 | 
					8ec3610541 | ||
| 
						 | 
					a946f06b5d | ||
| 
						 | 
					ce223e774e | ||
| 
						 | 
					d267e74486 | ||
| 
						 | 
					d350de3bba | ||
| 
						 | 
					45a8690f10 | ||
| 
						 | 
					b167a89702 | ||
| 
						 | 
					81d4866861 | ||
| 
						 | 
					07aea5fc9c | ||
| 
						 | 
					1d91983c26 | ||
| 
						 | 
					496312bcb8 | 
							
								
								
									
										55
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										55
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							@@ -2,7 +2,7 @@ name: ci
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  schedule:
 | 
			
		||||
    - cron: '0 10 * * *' # everyday at 10am
 | 
			
		||||
    - cron: '0 10 * * *'
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - 'master'
 | 
			
		||||
@@ -10,9 +10,6 @@ on:
 | 
			
		||||
    tags:
 | 
			
		||||
      - 'v*'
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches:
 | 
			
		||||
      - 'master'
 | 
			
		||||
      - 'releases/v*'
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  main:
 | 
			
		||||
@@ -499,3 +496,53 @@ jobs:
 | 
			
		||||
        uses: ./
 | 
			
		||||
        with:
 | 
			
		||||
          cleanup: ${{ matrix.cleanup }}
 | 
			
		||||
 | 
			
		||||
  k3s:
 | 
			
		||||
    runs-on: ubuntu-20.04
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        version:
 | 
			
		||||
          - v0.11.0-rc1
 | 
			
		||||
          - v0.10.5
 | 
			
		||||
    steps:
 | 
			
		||||
      -
 | 
			
		||||
        name: Checkout
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
      -
 | 
			
		||||
        name: Install k3s
 | 
			
		||||
        uses: crazy-max/.github/.github/actions/install-k3s@605d30d5ae97f6680578ace4b56645af79343e60
 | 
			
		||||
        with:
 | 
			
		||||
          version: "v1.21.2-k3s1"
 | 
			
		||||
      -
 | 
			
		||||
        name: Set up Docker Buildx
 | 
			
		||||
        id: buildx
 | 
			
		||||
        uses: ./
 | 
			
		||||
        with:
 | 
			
		||||
          version: ${{ matrix.version }}
 | 
			
		||||
          driver: kubernetes
 | 
			
		||||
          platforms: linux/amd64
 | 
			
		||||
          driver-opts: |
 | 
			
		||||
            image=moby/buildkit:buildx-stable-1
 | 
			
		||||
            qemu.install=true
 | 
			
		||||
          append: |
 | 
			
		||||
            - platforms: linux/arm64
 | 
			
		||||
              driver-opts:
 | 
			
		||||
                - image=moby/buildkit:buildx-stable-1
 | 
			
		||||
                - qemu.install=true
 | 
			
		||||
            - platforms: linux/s390x
 | 
			
		||||
              driver-opts:
 | 
			
		||||
                - image=moby/buildkit:buildx-stable-1
 | 
			
		||||
                - qemu.install=true
 | 
			
		||||
      -
 | 
			
		||||
        name: Create Dockerfile
 | 
			
		||||
        run: |
 | 
			
		||||
          cat > ./Dockerfile <<EOL
 | 
			
		||||
          FROM alpine
 | 
			
		||||
          RUN uname -a
 | 
			
		||||
          EOL
 | 
			
		||||
      -
 | 
			
		||||
        name: Build
 | 
			
		||||
        uses: docker/build-push-action@master
 | 
			
		||||
        with:
 | 
			
		||||
          context: .
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							@@ -6,9 +6,6 @@ on:
 | 
			
		||||
      - 'master'
 | 
			
		||||
      - 'releases/v*'
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches:
 | 
			
		||||
      - 'master'
 | 
			
		||||
      - 'releases/v*'
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  test:
 | 
			
		||||
@@ -17,17 +14,12 @@ jobs:
 | 
			
		||||
      -
 | 
			
		||||
        name: Checkout
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
      -
 | 
			
		||||
        name: Validate
 | 
			
		||||
        uses: docker/bake-action@v2
 | 
			
		||||
        with:
 | 
			
		||||
          targets: validate
 | 
			
		||||
      -
 | 
			
		||||
        name: Set up Docker Buildx
 | 
			
		||||
        uses: ./
 | 
			
		||||
      -
 | 
			
		||||
        name: Test
 | 
			
		||||
        uses: docker/bake-action@v2
 | 
			
		||||
        uses: docker/bake-action@v3
 | 
			
		||||
        with:
 | 
			
		||||
          targets: test
 | 
			
		||||
      -
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										41
									
								
								.github/workflows/validate.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								.github/workflows/validate.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
name: validate
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - 'master'
 | 
			
		||||
      - 'releases/v*'
 | 
			
		||||
  pull_request:
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  prepare:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    outputs:
 | 
			
		||||
      targets: ${{ steps.targets.outputs.matrix }}
 | 
			
		||||
    steps:
 | 
			
		||||
      -
 | 
			
		||||
        name: Checkout
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
      -
 | 
			
		||||
        name: Targets matrix
 | 
			
		||||
        id: targets
 | 
			
		||||
        run: |
 | 
			
		||||
          echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
 | 
			
		||||
 | 
			
		||||
  validate:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    needs:
 | 
			
		||||
      - prepare
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        target: ${{ fromJson(needs.prepare.outputs.targets) }}
 | 
			
		||||
    steps:
 | 
			
		||||
      -
 | 
			
		||||
        name: Checkout
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
      -
 | 
			
		||||
        name: Validate
 | 
			
		||||
        uses: docker/bake-action@v3
 | 
			
		||||
        with:
 | 
			
		||||
          targets: ${{ matrix.target }}
 | 
			
		||||
@@ -148,6 +148,21 @@ describe('getCreateArgs', () => {
 | 
			
		||||
        '--buildkitd-flags', '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
 | 
			
		||||
        '--platform', 'linux/amd64,linux/arm64,linux/arm/v7'
 | 
			
		||||
      ]
 | 
			
		||||
    ],
 | 
			
		||||
    [
 | 
			
		||||
      7,
 | 
			
		||||
      'v0.10.3',
 | 
			
		||||
      new Map<string, string>([
 | 
			
		||||
        ['install', 'false'],
 | 
			
		||||
        ['use', 'false'],
 | 
			
		||||
        ['driver', 'unknown'],
 | 
			
		||||
        ['cleanup', 'true'],
 | 
			
		||||
      ]),
 | 
			
		||||
      [
 | 
			
		||||
        'create',
 | 
			
		||||
        '--name', 'builder-9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d',
 | 
			
		||||
        '--driver', 'unknown',
 | 
			
		||||
      ]
 | 
			
		||||
    ]
 | 
			
		||||
  ])(
 | 
			
		||||
    '[%d] given buildx %s and %p as inputs, returns %p',
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								dist/index.js.map
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js.map
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								dist/sourcemap-register.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/sourcemap-register.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										28
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								package.json
									
									
									
									
									
								
							@@ -29,23 +29,23 @@
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@actions/core": "^1.10.0",
 | 
			
		||||
    "@actions/exec": "^1.1.1",
 | 
			
		||||
    "@docker/actions-toolkit": "^0.1.0-beta.18",
 | 
			
		||||
    "@docker/actions-toolkit": "^0.6.0",
 | 
			
		||||
    "js-yaml": "^4.1.0",
 | 
			
		||||
    "uuid": "^9.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@types/node": "^16.11.26",
 | 
			
		||||
    "@typescript-eslint/eslint-plugin": "^5.14.0",
 | 
			
		||||
    "@typescript-eslint/parser": "^5.14.0",
 | 
			
		||||
    "@vercel/ncc": "^0.33.3",
 | 
			
		||||
    "eslint": "^8.11.0",
 | 
			
		||||
    "eslint-config-prettier": "^8.5.0",
 | 
			
		||||
    "eslint-plugin-jest": "^26.1.1",
 | 
			
		||||
    "eslint-plugin-prettier": "^4.0.0",
 | 
			
		||||
    "jest": "^27.2.5",
 | 
			
		||||
    "prettier": "^2.3.1",
 | 
			
		||||
    "ts-jest": "^27.1.2",
 | 
			
		||||
    "ts-node": "^10.7.0",
 | 
			
		||||
    "typescript": "^4.4.4"
 | 
			
		||||
    "@types/node": "^16.18.21",
 | 
			
		||||
    "@typescript-eslint/eslint-plugin": "^5.56.0",
 | 
			
		||||
    "@typescript-eslint/parser": "^5.56.0",
 | 
			
		||||
    "@vercel/ncc": "^0.36.1",
 | 
			
		||||
    "eslint": "^8.36.0",
 | 
			
		||||
    "eslint-config-prettier": "^8.8.0",
 | 
			
		||||
    "eslint-plugin-jest": "^27.2.1",
 | 
			
		||||
    "eslint-plugin-prettier": "^4.2.1",
 | 
			
		||||
    "jest": "^29.5.0",
 | 
			
		||||
    "prettier": "^2.8.7",
 | 
			
		||||
    "ts-jest": "^29.0.5",
 | 
			
		||||
    "ts-node": "^10.9.1",
 | 
			
		||||
    "typescript": "^4.9.5"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ export async function getCreateArgs(inputs: Inputs, toolkit: Toolkit): Promise<A
 | 
			
		||||
    await Util.asyncForEach(inputs.driverOpts, async driverOpt => {
 | 
			
		||||
      args.push('--driver-opt', driverOpt);
 | 
			
		||||
    });
 | 
			
		||||
    if (inputs.driver != 'remote' && inputs.buildkitdFlags) {
 | 
			
		||||
    if (driverSupportsFlags(inputs.driver) && inputs.buildkitdFlags) {
 | 
			
		||||
      args.push('--buildkitd-flags', inputs.buildkitdFlags);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
@@ -61,7 +61,7 @@ export async function getCreateArgs(inputs: Inputs, toolkit: Toolkit): Promise<A
 | 
			
		||||
  if (inputs.use) {
 | 
			
		||||
    args.push('--use');
 | 
			
		||||
  }
 | 
			
		||||
  if (inputs.driver != 'remote') {
 | 
			
		||||
  if (driverSupportsFlags(inputs.driver)) {
 | 
			
		||||
    if (inputs.config) {
 | 
			
		||||
      args.push('--config', toolkit.buildkit.config.resolveFromFile(inputs.config));
 | 
			
		||||
    } else if (inputs.configInline) {
 | 
			
		||||
@@ -78,12 +78,14 @@ export async function getAppendArgs(inputs: Inputs, node: Node, toolkit: Toolkit
 | 
			
		||||
  const args: Array<string> = ['create', '--name', inputs.name, '--append'];
 | 
			
		||||
  if (node.name) {
 | 
			
		||||
    args.push('--node', node.name);
 | 
			
		||||
  } else if (inputs.driver == 'kubernetes' && (await toolkit.buildx.versionSatisfies('<0.11.0'))) {
 | 
			
		||||
    args.push('--node', `node-${uuid.v4()}`);
 | 
			
		||||
  }
 | 
			
		||||
  if (node['driver-opts'] && (await toolkit.buildx.versionSatisfies('>=0.3.0'))) {
 | 
			
		||||
    await Util.asyncForEach(node['driver-opts'], async driverOpt => {
 | 
			
		||||
      args.push('--driver-opt', driverOpt);
 | 
			
		||||
    });
 | 
			
		||||
    if (inputs.driver != 'remote' && node['buildkitd-flags']) {
 | 
			
		||||
    if (driverSupportsFlags(inputs.driver) && node['buildkitd-flags']) {
 | 
			
		||||
      args.push('--buildkitd-flags', node['buildkitd-flags']);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
@@ -103,3 +105,7 @@ export async function getInspectArgs(inputs: Inputs, toolkit: Toolkit): Promise<
 | 
			
		||||
  }
 | 
			
		||||
  return args;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function driverSupportsFlags(driver: string): boolean {
 | 
			
		||||
  return driver == '' || driver == 'docker-container' || driver == 'docker' || driver == 'kubernetes';
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ actionsToolkit.run(
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    let toolPath;
 | 
			
		||||
    if (Util.isValidUrl(inputs.version)) {
 | 
			
		||||
    if (Util.isValidRef(inputs.version)) {
 | 
			
		||||
      if (standalone) {
 | 
			
		||||
        throw new Error(`Cannot build from source without the Docker CLI`);
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user