Compare commits
	
		
			293 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 14487ce63c | ||
|   | 0ec91264d8 | ||
|   | b749522b90 | ||
|   | c566248492 | ||
|   | 13275dd76e | ||
|   | 67dc78bbaf | ||
|   | 0760504437 | ||
|   | 1c198f4467 | ||
|   | 288d9e2e4a | ||
|   | 88844b95d8 | ||
|   | 1be4244e8d | ||
|   | 094d2bc0cd | ||
|   | 548776e8d0 | ||
|   | 91838c2ba3 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 1332e65dc3 | ||
|   | 66147ca503 | ||
|   | 8ea72f78e8 | ||
|   | 6481840af9 | ||
|   | 84ad562665 | ||
|   | 9bea05fc44 | ||
|   | 471d1dc4e0 | ||
|   | b89ff0a6f2 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 1e3ae3a4d3 | ||
|   | b16f42f92a | ||
|   | dc0fea5e62 | ||
|   | 0adf995921 | ||
|   | d88cd289df | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 3d09a6bd70 | ||
|   | ca877d9245 | ||
|   | d2fe919bb5 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | f0fc9ece82 | ||
|   | 67a2d409c0 | ||
|   | 0b1b1c9c43 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | b6a7c2c4ee | ||
|   | 31ca4e5d51 | ||
|   | e613db9d5a | ||
|   | b32b51a8ed | ||
|   | 594bf46f0f | ||
|   | fd37bd55af | ||
|   | e6478a2405 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 78785bddff | ||
|   | 128779fed7 | ||
|   | 7e094594be | ||
|   | 32ee877a58 | ||
|   | d1a4129c41 | ||
|   | 49c623eaf8 | ||
|   | bcc9f4afe7 | ||
|   | da5b6c75b9 | ||
|   | 11be14d908 | ||
|   | f5a8591a7f | ||
|   | 8796455d32 | ||
|   | 750f367828 | ||
|   | 48aba3b46d | ||
|   | 678328cf8e | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | cdf0a37e6f | ||
|   | d719b79de1 | ||
|   | c333dfd43d | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 6b56a4c3f8 | ||
|   | 92fb0d73b6 | ||
|   | 40532c5d6f | ||
|   | 70dd953427 | ||
|   | 41b4e8020e | ||
|   | 22cd91d73b | ||
|   | 6bdcc4fb8c | ||
|   | b5e932e401 | ||
|   | 325a8bf0f1 | ||
|   | 0259cb088b | ||
|   | 1b8e4efb78 | ||
|   | 75ffdcce88 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 73b7dbf5d4 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | f79ca49284 | ||
|   | 5e99dacf67 | ||
|   | b249570060 | ||
|   | 4f58ea7922 | ||
|   | 49b5ea61c6 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 13c9fddd72 | ||
|   | e44afff359 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 67ebad331f | ||
|   | 32945a3392 | ||
|   | e0fe9cf0f2 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 8f1ff6bf9a | ||
|   | 5cd11c3a4c | ||
|   | 0aba704831 | ||
|   | 23c657a01f | ||
|   | 16ebe778df | ||
|   | 646a62b4f2 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | d92ab1347f | ||
|   | 4f7cdeb0f0 | ||
|   | ad3cd774a4 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 3efbc13366 | ||
|   | 2dbe91db48 | ||
|   | 7de3854c4c | ||
|   | 175aa53a3f | ||
|   | 806a2a461f | ||
|   | a8d35412fb | ||
|   | 1672e74297 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | a04f51d3b4 | ||
|   | 5176d81f87 | ||
|   | ec10ae8f96 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 597e8fc414 | ||
|   | e050dfa622 | ||
|   | d1fcdb6ee0 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | a6067b9a1a | ||
|   | 1ca370b3a9 | ||
|   | 2c95ebed5c | ||
|   | d189d0ef33 | ||
|   | a254f8ca60 | ||
|   | 94dae62c78 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 267a69d6cc | ||
|   | f23fb2a7cb | ||
|   | ef76d100ee | ||
|   | 522345f555 | ||
|   | 1a162644f9 | ||
|   | 9eea548195 | ||
|   | 11c2faaa9e | ||
|   | de2365af33 | ||
|   | bca5082da7 | ||
|   | e7aab408d9 | ||
|   | 63eb7590c6 | ||
|   | 53ec48606f | ||
|   | fe9d9f1d0c | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | ad37ba1ad0 | ||
|   | aabbd3f4d7 | ||
|   | 9c7c277413 | ||
|   | 987902144c | ||
|   | 709dde20a7 | ||
|   | ec2d640ea6 | ||
|   | 3dc0757c66 | ||
|   | dcb0699155 | ||
|   | a3c06e8698 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | e75138d857 | ||
|   | 9552610e81 | ||
|   | 99c83871c1 | ||
|   | af64c4e18f | ||
|   | 6fdff4fb09 | ||
|   | 9e59c61762 | ||
|   | 49351df2b7 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 723ff6ffad | ||
|   | 15560696de | ||
|   | 57e1d34ac3 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 309982ebc9 | ||
|   | 9476c25b2a | ||
|   | 97be5a4928 | ||
|   | 9cac6c8ea0 | ||
|   | 31159d49c0 | ||
|   | 07e1c3e148 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | f7febd621d | ||
|   | f6010ea701 | ||
|   | c0a6b9680f | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 0dfe9c3d41 | ||
|   | 94f8f8c2ee | ||
|   | 22f4433c58 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 6721c56015 | ||
|   | 4367da978b | ||
|   | 0883ebe52d | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 76e5c2d6ea | ||
|   | 29d67824d8 | ||
|   | c382f710d3 | ||
|   | 5a5b70d974 | ||
|   | dc24cf9e25 | ||
|   | 667cb22c52 | ||
|   | d880b1964b | ||
|   | e51051ad0b | ||
|   | 86c2bd0031 | ||
|   | 268d2b1611 | ||
|   | 2b8dc7f529 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 840c12be17 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 26368743c0 | ||
|   | cfed4e995e | ||
|   | dca03ca8fd | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | e030091ff4 | ||
|   | 84354d3b32 | ||
|   | de5408fe94 | ||
|   | cfc1555281 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | f6a172d30e | ||
|   | ca052bb54a | ||
|   | 025c2051f3 | ||
|   | 12076d2fb1 | ||
|   | ef6cba3353 | ||
|   | 4c16cf906a | ||
|   | a3118a86c8 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | c86eb8b0f7 | ||
|   | 2a53c6ccda | ||
|   | ccef1f210d | ||
|   | 79117b6ea5 | ||
|   | df19a799eb | ||
|   | 0e2ab16cd2 | ||
|   | 54d0f58d64 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 563a2f55e4 | ||
|   | 6003d3266a | ||
|   | e1e22cdde8 | ||
|   | fc15b64049 | ||
|   | 6c58ea3670 | ||
|   | 729f7f4926 | ||
|   | 99d83235bc | ||
|   | 1d5307d7af | ||
|   | cf8d130912 | ||
|   | 8804d8e2ac | ||
|   | 1984549052 | ||
|   | 5bc9e2e9b9 | ||
|   | eb539f44b1 | ||
|   | b6ff9e5753 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 929fba6cce | ||
|   | 7f1f43ba33 | ||
|   | 40d6a900e0 | ||
|   | d56be63626 | ||
|   | eb3cfeaf00 | ||
|   | d0fc12d8a4 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 68615d5b67 | ||
|   | c3b570184c | ||
|   | 7e6f77677b | ||
|   | 2ce6beaad4 | ||
|   | 4c8d1e6826 | ||
|   | b0312962ef | ||
|   | 96acf63e4c | ||
|   | f8bc7f4600 | ||
|   | c2064be02c | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 4f02f34098 | ||
|   | 090ca155fc | ||
|   | ec4854f780 | ||
|   | 2cdde995de | ||
|   | 008747aa03 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 1580753126 | ||
|   | 2a7db1d68a | ||
|   | 35e7dd5921 | ||
|   | af5a7ed5ba | ||
|   | 2a85189a6c | ||
|   | 6c2079483e | ||
|   | afdf0c0a67 | ||
|   | 00ae31ab6e | ||
|   | 701942b6e5 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 90e54d0b1d | ||
|   | 831ca179d3 | ||
|   | 6bd0e5492f | ||
|   | b3eddbb94c | ||
|   | ffd798c1f1 | ||
|   | 62d8db0960 | ||
|   | 8ab81cb898 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | d47e7c357d | ||
|   | 4976231911 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | d236adc992 | ||
|   | 94d76d3bc1 | ||
|   | 2b28f2a854 | ||
|   | 9f6f8c940b | ||
|   | 8411d080ee | ||
|   | 4a13e500e5 | ||
|   | 7416668686 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | b4f76a5dc6 | ||
|   | b7feb766fa | ||
|   | fae8018297 | ||
|   | b625868b13 | ||
|   | 5193ef1da6 | ||
|   | d3afd779e4 | ||
|   | 7a786bb2b9 | ||
|   | c66ae3adcf | ||
|   | 248131c7bf | ||
|   | b425c4cd5a | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 9834ce5b4d | ||
|   | fdf7f43ecf | ||
|   | e3a4c332fb | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | c48d200483 | ||
|   | 8d2cf95286 | ||
|   | 3c7915695f | ||
|   | 0a283b683f | ||
|   | c544b50d70 | ||
|   | dd31262fa7 | ||
|   | 5f01267817 | ||
|   | 0f847266c3 | ||
|   | ea8499618b | ||
|   | 4c1b68d83a | ||
|   | 5909c5bffe | ||
|   | 285730d174 | ||
|   | 4bbe0177ef | ||
|   | cc4d1d4d5f | ||
|   | e7d3750abc | ||
|   | 4556201a14 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 9fa62cfa91 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 8026f009fc | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 6b35a7a7f1 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | c6e64b478a | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | e2505c6383 | ||
|   | 0565240e2d | ||
|   | 3ab07f8801 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | b9e7e4daec | ||
|   | 04d1a3b049 | ||
|   | 1a4d1a13fb | ||
|   | 675965c0e1 | ||
|   | 58ee34cb6b | ||
|   | c97c4060bd | ||
|   | 47d5369e0b | ||
|   | 8895c7468f | ||
|   | 59ba712c53 | ||
|   | 0c20fff10d | 
| @ -1,2 +1,12 @@ | ||||
| /coverage | ||||
| /node_modules | ||||
| 
 | ||||
| # Dependency directories | ||||
| node_modules/ | ||||
| jspm_packages/ | ||||
| 
 | ||||
| # yarn v2 | ||||
| .yarn/cache | ||||
| .yarn/unplugged | ||||
| .yarn/build-state.yml | ||||
| .yarn/install-state.gz | ||||
| .pnp.* | ||||
|  | ||||
							
								
								
									
										3
									
								
								.eslintignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.eslintignore
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | ||||
| /dist/** | ||||
| /coverage/** | ||||
| /node_modules/** | ||||
| @ -1,18 +1,19 @@ | ||||
| { | ||||
|   "env": { | ||||
|     "node": true, | ||||
|     "es2021": true, | ||||
|     "es6": true, | ||||
|     "jest": true | ||||
|   }, | ||||
|   "extends": [ | ||||
|     "eslint:recommended", | ||||
|     "plugin:@typescript-eslint/eslint-recommended", | ||||
|     "plugin:@typescript-eslint/recommended", | ||||
|     "plugin:jest/recommended", | ||||
|     "plugin:prettier/recommended" | ||||
|   ], | ||||
|   "parser": "@typescript-eslint/parser", | ||||
|   "parserOptions": { | ||||
|     "ecmaVersion": "latest", | ||||
|     "ecmaVersion": 2023, | ||||
|     "sourceType": "module" | ||||
|   }, | ||||
|   "plugins": [ | ||||
|  | ||||
							
								
								
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							| @ -1,2 +1,4 @@ | ||||
| /.yarn/releases/** binary | ||||
| /.yarn/plugins/** binary | ||||
| /dist/** linguist-generated=true | ||||
| /lib/** linguist-generated=true | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								.github/build-push-summary.png
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.github/build-push-summary.png
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 81 KiB | 
							
								
								
									
										17
									
								
								.github/workflows/.e2e-run.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								.github/workflows/.e2e-run.yml
									
									
									
									
										vendored
									
									
								
							| @ -38,6 +38,9 @@ jobs: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         include: | ||||
|           - | ||||
|             buildx_version: edge | ||||
|             buildkit_image: moby/buildkit:latest | ||||
|           - | ||||
|             buildx_version: latest | ||||
|             buildkit_image: moby/buildkit:buildx-stable-1 | ||||
| @ -65,20 +68,22 @@ jobs: | ||||
|         if: inputs.type == 'local' | ||||
|         run: | | ||||
|           if [ ! -e /etc/docker/daemon.json ]; then | ||||
|             echo '{}' | tee /etc/docker/daemon.json >/dev/null | ||||
|             echo '{}' | sudo tee /etc/docker/daemon.json >/dev/null | ||||
|           fi | ||||
|           DOCKERD_CONFIG=$(jq '.+{"insecure-registries":["http://${{ env.REGISTRY_FQDN }}"]}' /etc/docker/daemon.json) | ||||
|           sudo tee /etc/docker/daemon.json <<<"$DOCKERD_CONFIG" >/dev/null | ||||
|           cat /etc/docker/daemon.json | ||||
|           sudo service docker restart | ||||
|       - | ||||
|         name: Install ${{ inputs.name }} | ||||
|         if: inputs.type == 'local' | ||||
|         run: | | ||||
|           sudo -E bash ./.github/e2e/${{ inputs.id }}/install.sh | ||||
|           sudo chown $(id -u):$(id -g) -R ~/.docker | ||||
|       - | ||||
|         name: Docker meta | ||||
|         id: meta | ||||
|         uses: docker/metadata-action@v4 | ||||
|         uses: docker/metadata-action@v5 | ||||
|         with: | ||||
|           images: ${{ env.REGISTRY_SLUG || inputs.slug }} | ||||
|           tags: | | ||||
| @ -87,13 +92,13 @@ jobs: | ||||
|             type=raw,gh-runid-${{ github.run_id }} | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ matrix.buildx_version }} | ||||
|           config: /tmp/buildkitd.toml | ||||
|           buildkitd-config: /tmp/buildkitd.toml | ||||
|           buildkitd-flags: --debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host | ||||
|           driver-opts: | | ||||
|             image=${{ matrix.buildkit_image }} | ||||
| @ -101,7 +106,7 @@ jobs: | ||||
|       - | ||||
|         name: Login to Registry | ||||
|         if: github.event_name != 'pull_request' && (env.REGISTRY_USER || inputs.username_secret) != '' | ||||
|         uses: docker/login-action@v2 | ||||
|         uses: docker/login-action@v3 | ||||
|         with: | ||||
|           registry: ${{ env.REGISTRY_FQDN || inputs.registry }} | ||||
|           username: ${{ env.REGISTRY_USER || secrets[inputs.username_secret] }} | ||||
|  | ||||
							
								
								
									
										579
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										579
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @ -24,8 +24,8 @@ on: | ||||
|   pull_request: | ||||
| 
 | ||||
| env: | ||||
|   BUILDX_VERSION: latest | ||||
|   BUILDKIT_IMAGE: moby/buildkit:buildx-stable-1 | ||||
|   BUILDX_VERSION: edge | ||||
|   BUILDKIT_IMAGE: moby/buildkit:latest | ||||
| 
 | ||||
| jobs: | ||||
|   minimal: | ||||
| @ -38,7 +38,7 @@ jobs: | ||||
|           path: action | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -64,11 +64,11 @@ jobs: | ||||
|           path: action | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         id: buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -113,11 +113,11 @@ jobs: | ||||
|           path: action | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         id: buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -170,11 +170,11 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         id: buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -220,7 +220,7 @@ jobs: | ||||
|       - | ||||
|         name: Docker meta | ||||
|         id: meta | ||||
|         uses: docker/metadata-action@v4 | ||||
|         uses: docker/metadata-action@v5 | ||||
|         with: | ||||
|           images: ${{ env.DOCKER_IMAGE }} | ||||
|           tags: | | ||||
| @ -233,7 +233,7 @@ jobs: | ||||
|             type=sha | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -288,7 +288,6 @@ jobs: | ||||
|       - | ||||
|         name: Check | ||||
|         run: | | ||||
|           echo "${{ toJson(steps.docker_build) }}" | ||||
|           if [ "${{ steps.docker_build.outcome }}" != "failure" ] || [ "${{ steps.docker_build.conclusion }}" != "success" ]; then | ||||
|             echo "::error::Should have failed" | ||||
|             exit 1 | ||||
| @ -302,10 +301,10 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -324,7 +323,6 @@ jobs: | ||||
|       - | ||||
|         name: Check | ||||
|         run: | | ||||
|           echo "${{ toJson(steps.docker_build) }}" | ||||
|           if [ "${{ steps.docker_build.outcome }}" != "failure" ] || [ "${{ steps.docker_build.conclusion }}" != "success" ]; then | ||||
|             echo "::error::Should have failed" | ||||
|             exit 1 | ||||
| @ -378,7 +376,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -393,6 +391,31 @@ jobs: | ||||
|             MYSECRET=foo | ||||
|             INVALID_SECRET= | ||||
| 
 | ||||
|   secret-envs: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|       - | ||||
|         name: Build | ||||
|         uses: ./ | ||||
|         env: | ||||
|           ENV_SECRET: foo | ||||
|         with: | ||||
|           context: . | ||||
|           file: ./test/secret.Dockerfile | ||||
|           secret-envs: | | ||||
|             MYSECRET=ENV_SECRET | ||||
|             INVALID_SECRET= | ||||
| 
 | ||||
|   network: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
| @ -401,7 +424,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -425,7 +448,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -447,7 +470,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -472,7 +495,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -495,7 +518,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -520,7 +543,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -542,6 +565,8 @@ jobs: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         include: | ||||
|           - buildx: edge | ||||
|             buildkit: moby/buildkit:latest | ||||
|           - buildx: latest | ||||
|             buildkit: moby/buildkit:buildx-stable-1 | ||||
|           - buildx: latest | ||||
| @ -554,7 +579,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ matrix.buildx }} | ||||
|           driver-opts: | | ||||
| @ -573,19 +598,31 @@ jobs: | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         attrs: | ||||
|           - '' | ||||
|           - mode=max | ||||
|           - builder-id=foo | ||||
|           - false | ||||
|           - true | ||||
|         include: | ||||
|           - target: image | ||||
|             output: type=image,name=localhost:5000/name/app:latest,push=true | ||||
|             attr: mode=max | ||||
|           - target: image | ||||
|             output: type=image,name=localhost:5000/name/app:latest,push=true | ||||
|             attr: '' | ||||
|           - target: binary | ||||
|             output: /tmp/buildx-build | ||||
|             attr: mode=max | ||||
|           - target: binary | ||||
|             output: /tmp/buildx-build | ||||
|             attr: '' | ||||
|     services: | ||||
|       registry: | ||||
|         image: registry:2 | ||||
|         ports: | ||||
|           - 5000:5000 | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -597,11 +634,24 @@ jobs: | ||||
|         with: | ||||
|           context: ./test/go | ||||
|           file: ./test/go/Dockerfile | ||||
|           target: binary | ||||
|           outputs: type=oci,dest=/tmp/build.tar | ||||
|           provenance: ${{ matrix.attrs }} | ||||
|           cache-from: type=gha,scope=provenance | ||||
|           cache-to: type=gha,scope=provenance,mode=max | ||||
|           target: ${{ matrix.target }} | ||||
|           outputs: ${{ matrix.output }} | ||||
|           provenance: ${{ matrix.attr }} | ||||
|       - | ||||
|         name: Inspect Provenance | ||||
|         if: matrix.target == 'image' | ||||
|         run: | | ||||
|           docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .Provenance}}' | ||||
|       - | ||||
|         name: Check output folder | ||||
|         if: matrix.target == 'binary' | ||||
|         run: | | ||||
|           tree /tmp/buildx-build | ||||
|       - | ||||
|         name: Print local Provenance | ||||
|         if: matrix.target == 'binary' | ||||
|         run: | | ||||
|           cat /tmp/buildx-build/provenance.json | jq | ||||
| 
 | ||||
|   sbom: | ||||
|     runs-on: ubuntu-latest | ||||
| @ -624,7 +674,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -642,22 +692,17 @@ jobs: | ||||
|           cache-from: type=gha,scope=attests-${{ matrix.target }} | ||||
|           cache-to: type=gha,scope=attests-${{ matrix.target }},mode=max | ||||
|       - | ||||
|         name: Inspect image | ||||
|         name: Inspect SBOM | ||||
|         if: matrix.target == 'image' | ||||
|         run: | | ||||
|           docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}' | ||||
|           docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .SBOM}}' | ||||
|       - | ||||
|         name: Check output folder | ||||
|         if: matrix.target == 'binary' | ||||
|         run: | | ||||
|           tree /tmp/buildx-build | ||||
|       - | ||||
|         name: Print provenance | ||||
|         if: matrix.target == 'binary' | ||||
|         run: | | ||||
|           cat /tmp/buildx-build/provenance.json | jq | ||||
|       - | ||||
|         name: Print SBOM | ||||
|         name: Print local SBOM | ||||
|         if: matrix.target == 'binary' | ||||
|         run: | | ||||
|           cat /tmp/buildx-build/sbom.spdx.json | jq | ||||
| @ -681,11 +726,11 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         id: buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -750,7 +795,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver: ${{ matrix.driver }} | ||||
| @ -820,10 +865,10 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -869,10 +914,10 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -897,6 +942,63 @@ jobs: | ||||
|         run: | | ||||
|           docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}' | ||||
| 
 | ||||
|   local-cache: | ||||
|     runs-on: ubuntu-latest | ||||
|     services: | ||||
|       registry: | ||||
|         image: registry:2 | ||||
|         ports: | ||||
|           - 5000:5000 | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             network=host | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|           buildkitd-flags: --debug | ||||
|       - | ||||
|         name: Cache Build | ||||
|         uses: actions/cache@v4 | ||||
|         with: | ||||
|           path: /tmp/.buildx-cache | ||||
|           key: ${{ runner.os }}-local-test-${{ github.sha }} | ||||
|           restore-keys: | | ||||
|             ${{ runner.os }}-local-test- | ||||
|       - | ||||
|         name: Build and push | ||||
|         uses: ./ | ||||
|         with: | ||||
|           context: ./test | ||||
|           file: ./test/multi.Dockerfile | ||||
|           platforms: linux/amd64,linux/arm64 | ||||
|           push: true | ||||
|           tags: | | ||||
|             localhost:5000/name/app:latest | ||||
|             localhost:5000/name/app:1.0.0 | ||||
|           cache-from: type=local,src=/tmp/.buildx-cache | ||||
|           cache-to: type=local,dest=/tmp/.buildx-cache-new | ||||
|       - | ||||
|         name: Inspect | ||||
|         run: | | ||||
|           docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}' | ||||
|       - | ||||
|         # Temp fix | ||||
|         # https://github.com/docker/build-push-action/issues/252 | ||||
|         # https://github.com/moby/buildkit/issues/1896 | ||||
|         name: Move cache | ||||
|         run: | | ||||
|           rm -rf /tmp/.buildx-cache | ||||
|           mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||||
| 
 | ||||
|   standalone: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
| @ -913,7 +1015,7 @@ jobs: | ||||
|           fi | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -934,7 +1036,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -956,7 +1058,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver: docker | ||||
| @ -990,7 +1092,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -1053,7 +1155,7 @@ jobs: | ||||
|           echo '{"proxies":{"default":{"httpProxy":"http://127.0.0.1:3128","httpsProxy":"http://127.0.0.1:3128"}}}' > ~/.docker/config.json | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -1085,7 +1187,7 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
| @ -1100,3 +1202,366 @@ jobs: | ||||
|         with: | ||||
|           context: ./test | ||||
|           file: ./test/Dockerfile | ||||
| 
 | ||||
|   annotations: | ||||
|     runs-on: ubuntu-latest | ||||
|     env: | ||||
|       DOCKER_IMAGE: localhost:5000/name/app | ||||
|     services: | ||||
|       registry: | ||||
|         image: registry:2 | ||||
|         ports: | ||||
|           - 5000:5000 | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Docker meta | ||||
|         id: meta | ||||
|         uses: docker/metadata-action@v5 | ||||
|         with: | ||||
|           images: ${{ env.DOCKER_IMAGE }} | ||||
|           tags: | | ||||
|             type=schedule | ||||
|             type=ref,event=branch | ||||
|             type=ref,event=pr | ||||
|             type=semver,pattern={{version}} | ||||
|             type=semver,pattern={{major}}.{{minor}} | ||||
|             type=semver,pattern={{major}} | ||||
|             type=sha | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             network=host | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|       - | ||||
|         name: Build and push to local registry | ||||
|         uses: ./ | ||||
|         with: | ||||
|           context: ./test | ||||
|           file: ./test/Dockerfile | ||||
|           push: true | ||||
|           tags: ${{ steps.meta.outputs.tags }} | ||||
|           annotations: | | ||||
|             index:com.example.key=value | ||||
|             index:com.example.key2=value2 | ||||
|             manifest:com.example.key3=value3 | ||||
|       - | ||||
|         name: Check manifest | ||||
|         run: | | ||||
|           docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }} --format '{{json .}}' | ||||
| 
 | ||||
|   multi-output: | ||||
|     runs-on: ubuntu-latest | ||||
|     services: | ||||
|       registry: | ||||
|         image: registry:2 | ||||
|         ports: | ||||
|           - 5000:5000 | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             network=host | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|           buildkitd-flags: --debug | ||||
|       - | ||||
|         name: Build | ||||
|         uses: ./ | ||||
|         with: | ||||
|           context: ./test | ||||
|           file: ./test/Dockerfile | ||||
|           outputs: | | ||||
|             type=image,name=localhost:5000/name/app:latest,push=true | ||||
|             type=docker,name=app:local | ||||
|             type=oci,dest=/tmp/oci.tar | ||||
|       - | ||||
|         name: Check registry | ||||
|         run: | | ||||
|           docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}' | ||||
|       - | ||||
|         name: Check docker | ||||
|         run: | | ||||
|           docker image inspect app:local | ||||
|       - | ||||
|         name: Check oci | ||||
|         run: | | ||||
|           set -ex | ||||
|           mkdir -p /tmp/oci-out | ||||
|           tar xf /tmp/oci.tar -C /tmp/oci-out | ||||
|           tree -nh /tmp/oci-out | ||||
| 
 | ||||
|   load-and-push: | ||||
|     runs-on: ubuntu-latest | ||||
|     services: | ||||
|       registry: | ||||
|         image: registry:2 | ||||
|         ports: | ||||
|           - 5000:5000 | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             network=host | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|           buildkitd-flags: --debug | ||||
|       - | ||||
|         name: Build | ||||
|         uses: ./ | ||||
|         with: | ||||
|           context: ./test | ||||
|           file: ./test/Dockerfile | ||||
|           load: true | ||||
|           push: true | ||||
|           tags: localhost:5000/name/app:latest | ||||
|       - | ||||
|         name: Check registry | ||||
|         run: | | ||||
|           docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}' | ||||
|       - | ||||
|         name: Check docker | ||||
|         run: | | ||||
|           docker image inspect localhost:5000/name/app:latest | ||||
| 
 | ||||
|   summary-disable: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|         with: | ||||
|           path: action | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|       - | ||||
|         name: Build | ||||
|         uses: ./action | ||||
|         with: | ||||
|           file: ./test/Dockerfile | ||||
|         env: | ||||
|           DOCKER_BUILD_SUMMARY: false | ||||
| 
 | ||||
|   summary-disable-deprecated: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|         with: | ||||
|           path: action | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|       - | ||||
|         name: Build | ||||
|         uses: ./action | ||||
|         with: | ||||
|           file: ./test/Dockerfile | ||||
|         env: | ||||
|           DOCKER_BUILD_NO_SUMMARY: true | ||||
| 
 | ||||
|   summary-not-supported: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|         with: | ||||
|           path: action | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: v0.12.1 | ||||
|           driver-opts: | | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|       - | ||||
|         name: Build | ||||
|         uses: ./action | ||||
|         with: | ||||
|           file: ./test/Dockerfile | ||||
| 
 | ||||
|   record-upload-disable: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|         with: | ||||
|           path: action | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|       - | ||||
|         name: Build | ||||
|         uses: ./action | ||||
|         with: | ||||
|           file: ./test/Dockerfile | ||||
|         env: | ||||
|           DOCKER_BUILD_RECORD_UPLOAD: false | ||||
| 
 | ||||
|   record-retention-days: | ||||
|     runs-on: ubuntu-latest | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         days: | ||||
|           - 2 | ||||
|           - 0 | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|         with: | ||||
|           path: action | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|       - | ||||
|         name: Build | ||||
|         uses: ./action | ||||
|         with: | ||||
|           file: ./test/Dockerfile | ||||
|         env: | ||||
|           DOCKER_BUILD_RECORD_RETENTION_DAYS: ${{ matrix.days }} | ||||
| 
 | ||||
|   checks: | ||||
|     runs-on: ubuntu-latest | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         buildx-version: | ||||
|           - edge | ||||
|           - latest | ||||
|           - v0.14.1 | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ matrix.buildx-version }} | ||||
|           driver-opts: | | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|       - | ||||
|         name: Build | ||||
|         uses: ./ | ||||
|         with: | ||||
|           context: ./test | ||||
|           file: ./test/lint.Dockerfile | ||||
| 
 | ||||
|   annotations-disabled: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|       - | ||||
|         name: Build | ||||
|         uses: ./ | ||||
|         with: | ||||
|           context: ./test | ||||
|           file: ./test/lint.Dockerfile | ||||
|         env: | ||||
|           DOCKER_BUILD_CHECKS_ANNOTATIONS: false | ||||
| 
 | ||||
|   call-check: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|       - | ||||
|         name: Build | ||||
|         id: docker_build | ||||
|         continue-on-error: true | ||||
|         uses: ./ | ||||
|         with: | ||||
|           context: ./test | ||||
|           file: ./test/lint.Dockerfile | ||||
|           call: check | ||||
|       - | ||||
|         name: Check | ||||
|         run: | | ||||
|           if [ "${{ steps.docker_build.outcome }}" != "failure" ] || [ "${{ steps.docker_build.conclusion }}" != "success" ]; then | ||||
|             echo "::error::Should have failed" | ||||
|             exit 1 | ||||
|           fi | ||||
| 
 | ||||
|   no-default-attestations: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|         with: | ||||
|           path: action | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} | ||||
|           driver-opts: | | ||||
|             image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} | ||||
|       - | ||||
|         name: Build | ||||
|         uses: ./action | ||||
|         with: | ||||
|           file: ./test/Dockerfile | ||||
|         env: | ||||
|           BUILDX_NO_DEFAULT_ATTESTATIONS: 1 | ||||
|  | ||||
							
								
								
									
										4
									
								
								.github/workflows/e2e.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/e2e.yml
									
									
									
									
										vendored
									
									
								
							| @ -90,8 +90,8 @@ jobs: | ||||
|             type: remote | ||||
|           - | ||||
|             name: Artifactory | ||||
|             registry: sforzando-build-team-local.jfrog.io | ||||
|             slug: sforzando-build-team-local.jfrog.io/build-push-action-e2e | ||||
|             registry: infradock.jfrog.io | ||||
|             slug: infradock.jfrog.io/test-ghaction/build-push-action | ||||
|             username_secret: ARTIFACTORY_USERNAME | ||||
|             password_secret: ARTIFACTORY_TOKEN | ||||
|             type: remote | ||||
|  | ||||
							
								
								
									
										17
									
								
								.github/workflows/pr-assign-author.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								.github/workflows/pr-assign-author.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| name: pr-assign-author | ||||
| 
 | ||||
| permissions: | ||||
|   contents: read | ||||
| 
 | ||||
| on: | ||||
|   pull_request_target: | ||||
|     types: | ||||
|       - opened | ||||
|       - reopened | ||||
| 
 | ||||
| jobs: | ||||
|   run: | ||||
|     uses: crazy-max/.github/.github/workflows/pr-assign-author.yml@1b673f36fad86812f538c1df9794904038a23cbf | ||||
|     permissions: | ||||
|       contents: read | ||||
|       pull-requests: write | ||||
							
								
								
									
										21
									
								
								.github/workflows/publish.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								.github/workflows/publish.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| name: publish | ||||
| 
 | ||||
| on: | ||||
|   release: | ||||
|     types: | ||||
|       - published | ||||
| 
 | ||||
| jobs: | ||||
|   publish: | ||||
|     runs-on: ubuntu-latest | ||||
|     permissions: | ||||
|       contents: read | ||||
|       id-token: write | ||||
|       packages: write | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Publish | ||||
|         uses: actions/publish-immutable-action@v0.0.4 | ||||
							
								
								
									
										8
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							| @ -20,11 +20,13 @@ jobs: | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Test | ||||
|         uses: docker/bake-action@v3 | ||||
|         uses: docker/bake-action@v6 | ||||
|         with: | ||||
|           source: . | ||||
|           targets: test | ||||
|       - | ||||
|         name: Upload coverage | ||||
|         uses: codecov/codecov-action@v3 | ||||
|         uses: codecov/codecov-action@v5 | ||||
|         with: | ||||
|           file: ./coverage/clover.xml | ||||
|           files: ./coverage/clover.xml | ||||
|           token: ${{ secrets.CODECOV_TOKEN }} | ||||
|  | ||||
							
								
								
									
										16
									
								
								.github/workflows/validate.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								.github/workflows/validate.yml
									
									
									
									
										vendored
									
									
								
							| @ -15,16 +15,17 @@ jobs: | ||||
|   prepare: | ||||
|     runs-on: ubuntu-latest | ||||
|     outputs: | ||||
|       targets: ${{ steps.targets.outputs.matrix }} | ||||
|       targets: ${{ steps.generate.outputs.targets }} | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Targets matrix | ||||
|         id: targets | ||||
|         run: | | ||||
|           echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT | ||||
|         name: List targets | ||||
|         id: generate | ||||
|         uses: docker/bake-action/subaction/list-targets@v6 | ||||
|         with: | ||||
|           target: validate | ||||
| 
 | ||||
|   validate: | ||||
|     runs-on: ubuntu-latest | ||||
| @ -35,11 +36,8 @@ jobs: | ||||
|       matrix: | ||||
|         target: ${{ fromJson(needs.prepare.outputs.targets) }} | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Validate | ||||
|         uses: docker/bake-action@v3 | ||||
|         uses: docker/bake-action@v6 | ||||
|         with: | ||||
|           targets: ${{ matrix.target }} | ||||
|  | ||||
							
								
								
									
										66
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										66
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,7 +1,5 @@ | ||||
| node_modules | ||||
| lib | ||||
| # https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore | ||||
| 
 | ||||
| # Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore | ||||
| # Logs | ||||
| logs | ||||
| *.log | ||||
| @ -9,6 +7,7 @@ npm-debug.log* | ||||
| yarn-debug.log* | ||||
| yarn-error.log* | ||||
| lerna-debug.log* | ||||
| .pnpm-debug.log* | ||||
| 
 | ||||
| # Diagnostic reports (https://nodejs.org/api/report.html) | ||||
| report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||||
| @ -19,34 +18,14 @@ pids | ||||
| *.seed | ||||
| *.pid.lock | ||||
| 
 | ||||
| # Directory for instrumented libs generated by jscoverage/JSCover | ||||
| lib-cov | ||||
| 
 | ||||
| # Coverage directory used by tools like istanbul | ||||
| coverage | ||||
| *.lcov | ||||
| 
 | ||||
| # nyc test coverage | ||||
| .nyc_output | ||||
| 
 | ||||
| # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||||
| .grunt | ||||
| 
 | ||||
| # Bower dependency directory (https://bower.io/) | ||||
| bower_components | ||||
| 
 | ||||
| # node-waf configuration | ||||
| .lock-wscript | ||||
| 
 | ||||
| # Compiled binary addons (https://nodejs.org/api/addons.html) | ||||
| build/Release | ||||
| 
 | ||||
| # Dependency directories | ||||
| node_modules/ | ||||
| jspm_packages/ | ||||
| 
 | ||||
| # TypeScript v1 declaration files | ||||
| typings/ | ||||
| 
 | ||||
| # TypeScript cache | ||||
| *.tsbuildinfo | ||||
| 
 | ||||
| @ -56,36 +35,19 @@ typings/ | ||||
| # Optional eslint cache | ||||
| .eslintcache | ||||
| 
 | ||||
| # Optional REPL history | ||||
| .node_repl_history | ||||
| 
 | ||||
| # Output of 'npm pack' | ||||
| *.tgz | ||||
| 
 | ||||
| # Yarn Integrity file | ||||
| .yarn-integrity | ||||
| 
 | ||||
| # dotenv environment variables file | ||||
| # dotenv environment variable files | ||||
| .env | ||||
| .env.test | ||||
| .env.development.local | ||||
| .env.test.local | ||||
| .env.production.local | ||||
| .env.local | ||||
| 
 | ||||
| # parcel-bundler cache (https://parceljs.org/) | ||||
| .cache | ||||
| 
 | ||||
| # next.js build output | ||||
| .next | ||||
| 
 | ||||
| # nuxt.js build output | ||||
| .nuxt | ||||
| 
 | ||||
| # vuepress build output | ||||
| .vuepress/dist | ||||
| 
 | ||||
| # Serverless directories | ||||
| .serverless/ | ||||
| 
 | ||||
| # FuseBox cache | ||||
| .fusebox/ | ||||
| 
 | ||||
| # DynamoDB Local files | ||||
| .dynamodb/ | ||||
| # yarn v2 | ||||
| .yarn/cache | ||||
| .yarn/unplugged | ||||
| .yarn/build-state.yml | ||||
| .yarn/install-state.gz | ||||
| .pnp.* | ||||
|  | ||||
							
								
								
									
										6
									
								
								.prettierignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								.prettierignore
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| # Dependency directories | ||||
| node_modules/ | ||||
| jspm_packages/ | ||||
| 
 | ||||
| # yarn v2 | ||||
| .yarn/ | ||||
							
								
								
									
										541
									
								
								.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										541
									
								
								.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										13
									
								
								.yarnrc.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.yarnrc.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| logFilters: | ||||
|   - code: YN0013 | ||||
|     level: discard | ||||
|   - code: YN0019 | ||||
|     level: discard | ||||
|   - code: YN0076 | ||||
|     level: discard | ||||
| 
 | ||||
| nodeLinker: node-modules | ||||
| 
 | ||||
| plugins: | ||||
|   - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs | ||||
|     spec: "@yarnpkg/plugin-interactive-tools" | ||||
							
								
								
									
										132
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										132
									
								
								README.md
									
									
									
									
									
								
							| @ -19,21 +19,11 @@ ___ | ||||
|   * [Git context](#git-context) | ||||
|   * [Path context](#path-context) | ||||
| * [Examples](#examples) | ||||
|   * [Multi-platform image](https://docs.docker.com/build/ci/github-actions/multi-platform/) | ||||
|   * [Secrets](https://docs.docker.com/build/ci/github-actions/secrets/) | ||||
|   * [Push to multi-registries](https://docs.docker.com/build/ci/github-actions/push-multi-registries/) | ||||
|   * [Manage tags and labels](https://docs.docker.com/build/ci/github-actions/manage-tags-labels/) | ||||
|   * [Cache management](https://docs.docker.com/build/ci/github-actions/cache/) | ||||
|   * [Export to Docker](https://docs.docker.com/build/ci/github-actions/export-docker/) | ||||
|   * [Test before push](https://docs.docker.com/build/ci/github-actions/test-before-push/) | ||||
|   * [Local registry](https://docs.docker.com/build/ci/github-actions/local-registry/) | ||||
|   * [Share built image between jobs](https://docs.docker.com/build/ci/github-actions/share-image-jobs/) | ||||
|   * [Named contexts](https://docs.docker.com/build/ci/github-actions/named-contexts/) | ||||
|   * [Copy image between registries](https://docs.docker.com/build/ci/github-actions/copy-image-registries/) | ||||
|   * [Update Docker Hub repo description](https://docs.docker.com/build/ci/github-actions/update-dockerhub-desc/) | ||||
| * [Summaries](#summaries) | ||||
| * [Customizing](#customizing) | ||||
|   * [inputs](#inputs) | ||||
|   * [outputs](#outputs) | ||||
|   * [environment variables](#environment-variables) | ||||
| * [Troubleshooting](#troubleshooting) | ||||
| * [Contributing](#contributing) | ||||
| 
 | ||||
| @ -65,28 +55,26 @@ name: ci | ||||
| 
 | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - 'main' | ||||
| 
 | ||||
| jobs: | ||||
|   docker: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|       - | ||||
|         name: Login to Docker Hub | ||||
|         uses: docker/login-action@v2 | ||||
|         uses: docker/login-action@v3 | ||||
|         with: | ||||
|           username: ${{ secrets.DOCKERHUB_USERNAME }} | ||||
|           username: ${{ vars.DOCKERHUB_USERNAME }} | ||||
|           password: ${{ secrets.DOCKERHUB_TOKEN }} | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|       - | ||||
|         name: Build and push | ||||
|         uses: docker/build-push-action@v4 | ||||
|         uses: docker/build-push-action@v6 | ||||
|         with: | ||||
|           push: true | ||||
|           tags: user/app:latest | ||||
| @ -104,28 +92,15 @@ expression `{{defaultContext}}`. Here we can use it to provide a subdirectory | ||||
| to the default Git context: | ||||
| 
 | ||||
| ```yaml | ||||
|       - | ||||
|         # Setting up Docker Buildx with docker-container driver is required | ||||
|         # at the moment to be able to use a subdirectory with Git context | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|       - | ||||
|         name: Build and push | ||||
|         uses: docker/build-push-action@v4 | ||||
|         uses: docker/build-push-action@v6 | ||||
|         with: | ||||
|           context: "{{defaultContext}}:mysubdir" | ||||
|           push: true | ||||
|           tags: user/app:latest | ||||
| ``` | ||||
| 
 | ||||
| > **Warning** | ||||
| > | ||||
| > Subdirectory for Git context is available from [BuildKit v0.9.0](https://github.com/moby/buildkit/releases/tag/v0.9.0). | ||||
| > If you're using the `docker` builder (default if `setup-buildx-action` not used), | ||||
| > then BuildKit in Docker Engine will be used. As Docker Engine < v22.x.x embeds | ||||
| > Buildkit 0.8.2 at the moment, it does not support this feature. It's therefore | ||||
| > required to use the `setup-buildx-action` at the moment. | ||||
| 
 | ||||
| Building from the current repository automatically uses the [GitHub Token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication), | ||||
| so it does not need to be passed. If you want to authenticate against another | ||||
| private repository, you have to use a [secret](https://docs.docker.com/build/ci/github-actions/secrets) | ||||
| @ -134,7 +109,7 @@ named `GIT_AUTH_TOKEN` to be able to authenticate against it with Buildx: | ||||
| ```yaml | ||||
|       - | ||||
|         name: Build and push | ||||
|         uses: docker/build-push-action@v4 | ||||
|         uses: docker/build-push-action@v6 | ||||
|         with: | ||||
|           push: true | ||||
|           tags: user/app:latest | ||||
| @ -149,8 +124,6 @@ name: ci | ||||
| 
 | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - 'main' | ||||
| 
 | ||||
| jobs: | ||||
|   docker: | ||||
| @ -158,22 +131,22 @@ jobs: | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v3 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Login to Docker Hub | ||||
|         uses: docker/login-action@v2 | ||||
|         uses: docker/login-action@v3 | ||||
|         with: | ||||
|           username: ${{ secrets.DOCKERHUB_USERNAME }} | ||||
|           username: ${{ vars.DOCKERHUB_USERNAME }} | ||||
|           password: ${{ secrets.DOCKERHUB_TOKEN }} | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|       - | ||||
|         name: Build and push | ||||
|         uses: docker/build-push-action@v4 | ||||
|         uses: docker/build-push-action@v6 | ||||
|         with: | ||||
|           context: . | ||||
|           push: true | ||||
| @ -189,17 +162,54 @@ jobs: | ||||
| * [Cache management](https://docs.docker.com/build/ci/github-actions/cache/) | ||||
| * [Export to Docker](https://docs.docker.com/build/ci/github-actions/export-docker/) | ||||
| * [Test before push](https://docs.docker.com/build/ci/github-actions/test-before-push/) | ||||
| * [Validating build configuration](https://docs.docker.com/build/ci/github-actions/checks/) | ||||
| * [Local registry](https://docs.docker.com/build/ci/github-actions/local-registry/) | ||||
| * [Share built image between jobs](https://docs.docker.com/build/ci/github-actions/share-image-jobs/) | ||||
| * [Named contexts](https://docs.docker.com/build/ci/github-actions/named-contexts/) | ||||
| * [Copy image between registries](https://docs.docker.com/build/ci/github-actions/copy-image-registries/) | ||||
| * [Update Docker Hub repo description](https://docs.docker.com/build/ci/github-actions/update-dockerhub-desc/) | ||||
| * [SBOM and provenance attestations](https://docs.docker.com/build/ci/github-actions/attestations/) | ||||
| * [Annotations](https://docs.docker.com/build/ci/github-actions/annotations/) | ||||
| * [Reproducible builds](https://docs.docker.com/build/ci/github-actions/reproducible-builds/) | ||||
| 
 | ||||
| ## Summaries | ||||
| 
 | ||||
| This action generates a [job summary](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/) | ||||
| that provides a detailed overview of the build execution. The summary shows an | ||||
| overview of all the steps executed during the build, including the build inputs | ||||
| and eventual errors. | ||||
| 
 | ||||
|  | ||||
| 
 | ||||
| The summary also includes a link for downloading the build record with | ||||
| additional details about the build, including build stats, logs, outputs, and | ||||
| more. The build record can be imported to Docker Desktop for inspecting the | ||||
| build in greater detail. | ||||
| 
 | ||||
| > [!WARNING] | ||||
| > | ||||
| > If you're using the [`actions/download-artifact`](https://github.com/actions/download-artifact) | ||||
| > action in your workflow, you need to ignore the build record artifacts | ||||
| > if `name` and `pattern` inputs are not specified ([defaults to download all artifacts](https://github.com/actions/download-artifact?tab=readme-ov-file#download-all-artifacts) of the workflow), | ||||
| > otherwise the action will fail: | ||||
| > ```yaml | ||||
| > - uses: actions/download-artifact@v4 | ||||
| >   with: | ||||
| >     pattern: "!*.dockerbuild" | ||||
| > ``` | ||||
| > More info: https://github.com/actions/toolkit/pull/1874 | ||||
| 
 | ||||
| Summaries are enabled by default, but can be disabled with the | ||||
| `DOCKER_BUILD_SUMMARY` [environment variable](#environment-variables). | ||||
| 
 | ||||
| For more information about summaries, refer to the | ||||
| [documentation](https://docs.docker.com/go/build-summary/). | ||||
| 
 | ||||
| ## Customizing | ||||
| 
 | ||||
| ### inputs | ||||
| 
 | ||||
| Following inputs can be used as `step.with` keys | ||||
| The following inputs can be used as `step.with` keys: | ||||
| 
 | ||||
| > `List` type is a newline-delimited string | ||||
| > ```yaml | ||||
| @ -217,12 +227,14 @@ Following inputs can be used as `step.with` keys | ||||
| |--------------------|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||||
| | `add-hosts`        | List/CSV    | List of [customs host-to-IP mapping](https://docs.docker.com/engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host) (e.g., `docker:10.180.0.1`)      | | ||||
| | `allow`            | List/CSV    | List of [extra privileged entitlement](https://docs.docker.com/engine/reference/commandline/buildx_build/#allow) (e.g., `network.host,security.insecure`)                         | | ||||
| | `annotations`      | List        | List of annotation to set to the image                                                                                                                                            | | ||||
| | `attests`          | List        | List of [attestation](https://docs.docker.com/build/attestations/) parameters (e.g., `type=sbom,generator=image`)                                                                 |  | ||||
| | `builder`          | String      | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action)                                                                                       | | ||||
| | `build-args`       | List        | List of [build-time variables](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-arg)                                                                      | | ||||
| | `build-contexts`   | List        | List of additional [build contexts](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-context) (e.g., `name=path`)                                         | | ||||
| | `cache-from`       | List        | List of [external cache sources](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-from) (e.g., `type=local,src=path/to/dir`)                              | | ||||
| | `cache-to`         | List        | List of [cache export destinations](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-to) (e.g., `type=local,dest=path/to/dir`)                            | | ||||
| | `call`             | String      | Set [method for evaluating build](https://docs.docker.com/reference/cli/docker/buildx/build/#call) (e.g., `check`)                                                                | | ||||
| | `cgroup-parent`    | String      | Optional [parent cgroup](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) for the container used in the build              | | ||||
| | `context`          | String      | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) | | ||||
| | `file`             | String      | Path to the Dockerfile. (default `{context}/Dockerfile`)                                                                                                                          | | ||||
| @ -231,13 +243,14 @@ Following inputs can be used as `step.with` keys | ||||
| | `network`          | String      | Set the networking mode for the `RUN` instructions during build                                                                                                                   | | ||||
| | `no-cache`         | Bool        | Do not use cache when building the image (default `false`)                                                                                                                        | | ||||
| | `no-cache-filters` | List/CSV    | Do not cache specified stages                                                                                                                                                     | | ||||
| | `outputs`¹         | List        | List of [output destinations](https://docs.docker.com/engine/reference/commandline/buildx_build/#output) (format: `type=local,dest=path`)                                         | | ||||
| | `outputs`          | List        | List of [output destinations](https://docs.docker.com/engine/reference/commandline/buildx_build/#output) (format: `type=local,dest=path`)                                         | | ||||
| | `platforms`        | List/CSV    | List of [target platforms](https://docs.docker.com/engine/reference/commandline/buildx_build/#platform) for build                                                                 | | ||||
| | `provenance`       | Bool/String | Generate [provenance](https://docs.docker.com/build/attestations/slsa-provenance/) attestation for the build (shorthand for `--attest=type=provenance`)                           | | ||||
| | `pull`             | Bool        | Always attempt to pull all referenced images (default `false`)                                                                                                                    | | ||||
| | `push`             | Bool        | [Push](https://docs.docker.com/engine/reference/commandline/buildx_build/#push) is a shorthand for `--output=type=registry` (default `false`)                                     | | ||||
| | `sbom`             | Bool/String | Generate [SBOM](https://docs.docker.com/build/attestations/sbom/) attestation for the build (shorthand for `--attest=type=sbom`)                                                  | | ||||
| | `secrets`          | List        | List of [secrets](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to expose to the build (e.g., `key=string`, `GIT_AUTH_TOKEN=mytoken`)                | | ||||
| | `secret-envs`      | List/CSV    | List of [secret env vars](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to expose to the build (e.g., `key=envname`, `MY_SECRET=MY_ENV_VAR`)         | | ||||
| | `secret-files`     | List        | List of [secret files](https://docs.docker.com/engine/reference/commandline/buildx_build/#secret) to expose to the build (e.g., `key=filename`, `MY_SECRET=./secret.txt`)         | | ||||
| | `shm-size`         | String      | Size of [`/dev/shm`](https://docs.docker.com/engine/reference/commandline/buildx_build/#shm-size) (e.g., `2g`)                                                                    | | ||||
| | `ssh`              | List        | List of [SSH agent socket or keys](https://docs.docker.com/engine/reference/commandline/buildx_build/#ssh) to expose to the build                                                 | | ||||
| @ -246,13 +259,9 @@ Following inputs can be used as `step.with` keys | ||||
| | `ulimit`           | List        | [Ulimit](https://docs.docker.com/engine/reference/commandline/buildx_build/#ulimit) options (e.g., `nofile=1024:1024`)                                                            | | ||||
| | `github-token`     | String      | GitHub Token used to authenticate against a repository for [Git context](#git-context) (default `${{ github.token }}`)                                                            | | ||||
| 
 | ||||
| > **Note** | ||||
| > | ||||
| > * ¹ multiple `outputs` are [not yet supported](https://github.com/moby/buildkit/issues/1555) | ||||
| 
 | ||||
| ### outputs | ||||
| 
 | ||||
| Following outputs are available | ||||
| The following outputs are available: | ||||
| 
 | ||||
| | Name       | Type    | Description           | | ||||
| |------------|---------|-----------------------| | ||||
| @ -260,6 +269,15 @@ Following outputs are available | ||||
| | `digest`   | String  | Image digest          | | ||||
| | `metadata` | JSON    | Build result metadata | | ||||
| 
 | ||||
| ### environment variables | ||||
| 
 | ||||
| | Name                                 | Type   | Default | Description                                                                                                                                                                                                                                                        | | ||||
| |--------------------------------------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||||
| | `DOCKER_BUILD_CHECKS_ANNOTATIONS`    | Bool   | `true`  | If `false`, GitHub annotations are not generated for [build checks](https://docs.docker.com/build/checks/)                                                                                                                                                         | | ||||
| | `DOCKER_BUILD_SUMMARY`               | Bool   | `true`  | If `false`, [build summary](https://docs.docker.com/build/ci/github-actions/build-summary/) generation is disabled                                                                                                                                                 | | ||||
| | `DOCKER_BUILD_RECORD_UPLOAD`         | Bool   | `true`  | If `false`, build record upload as [GitHub artifact](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts) is disabled                                                                                                            | | ||||
| | `DOCKER_BUILD_RECORD_RETENTION_DAYS` | Number |         | Duration after which build record artifact will expire in days. Defaults to repository/org [retention settings](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#artifact-and-log-retention-policy) if unset or `0` | | ||||
| 
 | ||||
| ## Troubleshooting | ||||
| 
 | ||||
| See [TROUBLESHOOTING.md](TROUBLESHOOTING.md) | ||||
|  | ||||
| @ -4,7 +4,6 @@ | ||||
|   * [BuildKit container logs](#buildkit-container-logs) | ||||
|   * [With containerd](#with-containerd) | ||||
| * [`repository name must be lowercase`](#repository-name-must-be-lowercase) | ||||
| * [Image not loaded](#image-not-loaded) | ||||
| 
 | ||||
| ## Cannot push to a registry | ||||
| 
 | ||||
| @ -45,13 +44,13 @@ jobs: | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v3 | ||||
|         uses: actions/checkout@v4 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|         uses: docker/setup-qemu-action@v3 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         uses: docker/setup-buildx-action@v3 | ||||
|         with: | ||||
|           buildkitd-flags: --debug | ||||
|       - | ||||
| @ -59,7 +58,7 @@ jobs: | ||||
|         uses: crazy-max/ghaction-setup-containerd@v2 | ||||
|       - | ||||
|         name: Build Docker image | ||||
|         uses: docker/build-push-action@v4 | ||||
|         uses: docker/build-push-action@v6 | ||||
|         with: | ||||
|           context: . | ||||
|           platforms: linux/amd64,linux/arm64 | ||||
| @ -112,7 +111,7 @@ to generate sanitized tags: | ||||
|     tags: latest | ||||
| 
 | ||||
| - name: Build and push | ||||
|   uses: docker/build-push-action@v4 | ||||
|   uses: docker/build-push-action@v6 | ||||
|   with: | ||||
|     context: . | ||||
|     push: true | ||||
| @ -130,35 +129,9 @@ Or a dedicated step to sanitize the slug: | ||||
|     script: return 'ghcr.io/${{ github.repository }}'.toLowerCase() | ||||
| 
 | ||||
| - name: Build and push | ||||
|   uses: docker/build-push-action@v4 | ||||
|   uses: docker/build-push-action@v6 | ||||
|   with: | ||||
|     context: . | ||||
|     push: true | ||||
|     tags: ${{ steps.repo_slug.outputs.result }}:latest | ||||
| ``` | ||||
| 
 | ||||
| ## Image not loaded | ||||
| 
 | ||||
| Sometimes when your workflows are heavy consumers of disk storage, it can happen that build-push-action declares that the built image is loaded, but then not found in the following workflow steps. | ||||
| 
 | ||||
| - You can use the following solution as workaround, to free space on disk before building docker image using the following workflow step | ||||
| 
 | ||||
| ```yaml | ||||
|       # Free disk space | ||||
|       - name: Free Disk space | ||||
|         shell: bash | ||||
|         run: | | ||||
|           sudo rm -rf /usr/local/lib/android  # will release about 10 GB if you don't need Android | ||||
|           sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET | ||||
| ``` | ||||
| 
 | ||||
| - Another workaround can be to call `docker/setup-buildx-action` with docker driver | ||||
| 
 | ||||
| ```yaml | ||||
| name: Set up Docker Buildx | ||||
| uses: docker/setup-buildx-action@v2 | ||||
| with: | ||||
|   driver: docker | ||||
| ``` | ||||
| 
 | ||||
| More details in the [related issue](https://github.com/docker/build-push-action/issues/321) | ||||
|  | ||||
| @ -1,13 +1,16 @@ | ||||
| import {beforeEach, describe, expect, jest, test} from '@jest/globals'; | ||||
| import {afterEach, beforeEach, describe, expect, jest, test} from '@jest/globals'; | ||||
| import * as fs from 'fs'; | ||||
| import * as path from 'path'; | ||||
| 
 | ||||
| import {Builder} from '@docker/actions-toolkit/lib/buildx/builder'; | ||||
| import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx'; | ||||
| import {Build} from '@docker/actions-toolkit/lib/buildx/build'; | ||||
| import {Context} from '@docker/actions-toolkit/lib/context'; | ||||
| import {Docker} from '@docker/actions-toolkit/lib/docker/docker'; | ||||
| import {GitHub} from '@docker/actions-toolkit/lib/github'; | ||||
| import {Toolkit} from '@docker/actions-toolkit/lib/toolkit'; | ||||
| import {BuilderInfo} from '@docker/actions-toolkit/lib/types/builder'; | ||||
| 
 | ||||
| import {BuilderInfo} from '@docker/actions-toolkit/lib/types/buildx/builder'; | ||||
| import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github'; | ||||
| 
 | ||||
| import * as context from '../src/context'; | ||||
| @ -35,6 +38,16 @@ jest.spyOn(Docker, 'isAvailable').mockImplementation(async (): Promise<boolean> | ||||
|   return true; | ||||
| }); | ||||
| 
 | ||||
| const metadataJson = path.join(tmpDir, 'metadata.json'); | ||||
| jest.spyOn(Build.prototype, 'getMetadataFilePath').mockImplementation((): string => { | ||||
|   return metadataJson; | ||||
| }); | ||||
| 
 | ||||
| const imageIDFilePath = path.join(tmpDir, 'iidfile.txt'); | ||||
| jest.spyOn(Build.prototype, 'getImageIDFilePath').mockImplementation((): string => { | ||||
|   return imageIDFilePath; | ||||
| }); | ||||
| 
 | ||||
| jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<BuilderInfo> => { | ||||
|   return { | ||||
|     name: 'builder2', | ||||
| @ -55,6 +68,7 @@ jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<Bu | ||||
| }); | ||||
| 
 | ||||
| describe('getArgs', () => { | ||||
|   const originalEnv = process.env; | ||||
|   beforeEach(() => { | ||||
|     process.env = Object.keys(process.env).reduce((object, key) => { | ||||
|       if (!key.startsWith('INPUT_')) { | ||||
| @ -63,6 +77,9 @@ describe('getArgs', () => { | ||||
|       return object; | ||||
|     }, {}); | ||||
|   }); | ||||
|   afterEach(() => { | ||||
|     process.env = originalEnv; | ||||
|   }); | ||||
| 
 | ||||
|   // prettier-ignore
 | ||||
|   test.each([ | ||||
| @ -78,9 +95,10 @@ describe('getArgs', () => { | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       1, | ||||
| @ -101,9 +119,10 @@ ccc"`], | ||||
|         '--build-arg', 'MY_ARG=val1,val2,val3', | ||||
|         '--build-arg', 'ARG=val', | ||||
|         '--build-arg', `MULTILINE=aaaa\nbbbb\nccc`, | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         'https://github.com/docker/build-push-action.git#refs/heads/master' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       2, | ||||
| @ -117,11 +136,12 @@ ccc"`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--tag', 'name/app:7.4', | ||||
|         '--tag', 'name/app:latest', | ||||
|         'https://github.com/docker/build-push-action.git#refs/heads/master' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       3, | ||||
| @ -141,7 +161,8 @@ ccc"`], | ||||
|         '--label', 'org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit', | ||||
|         '--output', 'type=local,dest=./release-out', | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       4, | ||||
| @ -158,7 +179,8 @@ ccc"`], | ||||
|         'build', | ||||
|         '--platform', 'linux/amd64,linux/arm64', | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       5, | ||||
| @ -172,9 +194,10 @@ ccc"`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       6, | ||||
| @ -189,10 +212,11 @@ ccc"`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       7, | ||||
| @ -210,7 +234,8 @@ ccc"`], | ||||
|         '--output', '.', | ||||
|         '--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`, | ||||
|         'https://github.com/docker/build-push-action.git#refs/heads/master' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       8, | ||||
| @ -230,13 +255,14 @@ ccc"`], | ||||
|       [ | ||||
|         'build', | ||||
|         '--file', './test/Dockerfile', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--platform', 'linux/amd64,linux/arm64', | ||||
|         '--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`, | ||||
|         '--builder', 'builder-git-context-2', | ||||
|         '--push', | ||||
|         'https://github.com/docker/build-push-action.git#refs/heads/master' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       9, | ||||
| @ -264,7 +290,7 @@ ccc"`], | ||||
|       [ | ||||
|         'build', | ||||
|         '--file', './test/Dockerfile', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--platform', 'linux/amd64,linux/arm64', | ||||
|         '--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`, | ||||
|         '--secret', `id=MYSECRET,src=${tmpName}`, | ||||
| @ -273,7 +299,8 @@ ccc"`], | ||||
|         '--builder', 'builder-git-context-2', | ||||
|         '--push', | ||||
|         'https://github.com/docker/build-push-action.git#refs/heads/master' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       10, | ||||
| @ -301,7 +328,7 @@ ccc`], | ||||
|       [ | ||||
|         'build', | ||||
|         '--file', './test/Dockerfile', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--platform', 'linux/amd64,linux/arm64', | ||||
|         '--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`, | ||||
|         '--secret', `id=MYSECRET,src=${tmpName}`, | ||||
| @ -310,7 +337,8 @@ ccc`], | ||||
|         '--builder', 'builder-git-context-2', | ||||
|         '--push', | ||||
|         'https://github.com/docker/build-push-action.git#refs/heads/master' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       11, | ||||
| @ -330,13 +358,14 @@ ccc`], | ||||
|       [ | ||||
|         'build', | ||||
|         '--file', './test/Dockerfile', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--secret', `id=MY_SECRET,src=${tmpName}`, | ||||
|         '--builder', 'builder-git-context-2', | ||||
|         '--network', 'host', | ||||
|         '--push', | ||||
|         'https://github.com/docker/build-push-action.git#refs/heads/master' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       12, | ||||
| @ -356,7 +385,8 @@ ccc`], | ||||
|         '--label', 'org.opencontainers.image.description=Reference implementation of operation "filter results (top-n)"', | ||||
|         '--output', 'type=local,dest=./release-out', | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       13, | ||||
| @ -377,12 +407,13 @@ ccc`], | ||||
|         '--add-host', 'docker:10.180.0.1', | ||||
|         '--add-host', 'foo:10.0.0.1', | ||||
|         '--file', './test/Dockerfile', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '--network', 'host', | ||||
|         '--push', | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       14, | ||||
| @ -406,13 +437,14 @@ nproc=3`], | ||||
|         '--add-host', 'foo:10.0.0.1', | ||||
|         '--cgroup-parent', 'foo', | ||||
|         '--file', './test/Dockerfile', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--shm-size', '2g', | ||||
|         '--ulimit', 'nofile=1024:1024', | ||||
|         '--ulimit', 'nproc=3', | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       15, | ||||
| @ -426,10 +458,11 @@ nproc=3`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--metadata-file', metadataJson, | ||||
|         'https://github.com/docker/build-push-action.git#refs/heads/master:docker' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       16, | ||||
| @ -444,11 +477,12 @@ nproc=3`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`, | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--metadata-file', metadataJson, | ||||
|         'https://github.com/docker/build-push-action.git#refs/heads/master:subdir' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       17, | ||||
| @ -463,10 +497,11 @@ nproc=3`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       18, | ||||
| @ -480,11 +515,12 @@ nproc=3`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         "--provenance", `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`, | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       19, | ||||
| @ -499,11 +535,12 @@ nproc=3`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         "--provenance", `builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`, | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--attest', `type=provenance,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       20, | ||||
| @ -518,11 +555,12 @@ nproc=3`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         "--provenance", `mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`, | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--attest', `type=provenance,mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       21, | ||||
| @ -537,11 +575,12 @@ nproc=3`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         "--provenance", 'false', | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--attest', 'type=provenance,disabled=true', | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       22, | ||||
| @ -556,11 +595,12 @@ nproc=3`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         "--provenance", 'builder-id=foo', | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--attest', 'type=provenance,builder-id=foo', | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       23, | ||||
| @ -575,11 +615,12 @@ nproc=3`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         "--output", 'type=docker', | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       24, | ||||
| @ -593,11 +634,12 @@ nproc=3`], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--load', | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       25, | ||||
| @ -613,15 +655,216 @@ nproc=3`], | ||||
|       [ | ||||
|         'build', | ||||
|         '--build-arg', 'FOO=bar#baz', | ||||
|         '--iidfile', path.join(tmpDir, 'iidfile'), | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--load', | ||||
|         '--metadata-file', path.join(tmpDir, 'metadata-file'), | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ] | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       26, | ||||
|       '0.10.0', | ||||
|       new Map<string, string>([ | ||||
|         ['context', '.'], | ||||
|         ['no-cache', 'false'], | ||||
|         ['load', 'true'], | ||||
|         ['push', 'false'], | ||||
|         ['pull', 'false'], | ||||
|         ['secret-envs', `MY_SECRET=MY_SECRET_ENV
 | ||||
| ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
 | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--secret', 'id=MY_SECRET,env=MY_SECRET_ENV', | ||||
|         '--secret', 'id=ANOTHER_SECRET,env=ANOTHER_SECRET_ENV', | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--load', | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       27, | ||||
|       '0.10.0', | ||||
|       new Map<string, string>([ | ||||
|         ['context', '.'], | ||||
|         ['no-cache', 'false'], | ||||
|         ['load', 'true'], | ||||
|         ['push', 'false'], | ||||
|         ['pull', 'false'], | ||||
|         ['secret-envs', 'MY_SECRET=MY_SECRET_ENV,ANOTHER_SECRET=ANOTHER_SECRET_ENV'] | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--secret', 'id=MY_SECRET,env=MY_SECRET_ENV', | ||||
|         '--secret', 'id=ANOTHER_SECRET,env=ANOTHER_SECRET_ENV', | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--load', | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       28, | ||||
|       '0.11.0', | ||||
|       new Map<string, string>([ | ||||
|         ['context', '.'], | ||||
|         ['annotations', 'example1=www\nindex:example2=xxx\nmanifest:example3=yyy\nmanifest-descriptor[linux/amd64]:example4=zzz'], | ||||
|         ['outputs', 'type=local,dest=./release-out'], | ||||
|         ['load', 'false'], | ||||
|         ['no-cache', 'false'], | ||||
|         ['push', 'false'], | ||||
|         ['pull', 'false'], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--output', 'type=local,dest=./release-out', | ||||
|         '--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       29, | ||||
|       '0.12.0', | ||||
|       new Map<string, string>([ | ||||
|         ['context', '.'], | ||||
|         ['annotations', 'example1=www\nindex:example2=xxx\nmanifest:example3=yyy\nmanifest-descriptor[linux/amd64]:example4=zzz'], | ||||
|         ['outputs', 'type=local,dest=./release-out'], | ||||
|         ['load', 'false'], | ||||
|         ['no-cache', 'false'], | ||||
|         ['push', 'false'], | ||||
|         ['pull', 'false'], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--annotation', 'example1=www', | ||||
|         '--annotation', 'index:example2=xxx', | ||||
|         '--annotation', 'manifest:example3=yyy', | ||||
|         '--annotation', 'manifest-descriptor[linux/amd64]:example4=zzz', | ||||
|         '--output', 'type=local,dest=./release-out', | ||||
|         '--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       30, | ||||
|       '0.12.0', | ||||
|       new Map<string, string>([ | ||||
|         ['context', '.'], | ||||
|         ['outputs', `type=image,"name=localhost:5000/name/app:latest,localhost:5000/name/app:foo",push-by-digest=true,name-canonical=true,push=true`], | ||||
|         ['load', 'false'], | ||||
|         ['no-cache', 'false'], | ||||
|         ['push', 'false'], | ||||
|         ['pull', 'false'], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         "--output", `type=image,"name=localhost:5000/name/app:latest,localhost:5000/name/app:foo",push-by-digest=true,name-canonical=true,push=true`, | ||||
|         '--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       31, | ||||
|       '0.13.1', | ||||
|       new Map<string, string>([ | ||||
|         ['context', '.'], | ||||
|         ['load', 'false'], | ||||
|         ['no-cache', 'false'], | ||||
|         ['push', 'false'], | ||||
|         ['pull', 'false'], | ||||
|         ['provenance', 'mode=max'], | ||||
|         ['sbom', 'true'], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--attest', `type=provenance,mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`, | ||||
|         '--attest', `type=sbom,disabled=false`, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       32, | ||||
|       '0.13.1', | ||||
|       new Map<string, string>([ | ||||
|         ['context', '.'], | ||||
|         ['load', 'false'], | ||||
|         ['no-cache', 'false'], | ||||
|         ['push', 'false'], | ||||
|         ['pull', 'false'], | ||||
|         ['attests', 'type=provenance,mode=min'], | ||||
|         ['provenance', 'mode=max'], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--attest', `type=provenance,mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       33, | ||||
|       '0.13.1', | ||||
|       new Map<string, string>([ | ||||
|         ['context', '.'], | ||||
|         ['load', 'false'], | ||||
|         ['no-cache', 'false'], | ||||
|         ['push', 'false'], | ||||
|         ['pull', 'false'], | ||||
|         ['attests', 'type=provenance,mode=min'], | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--attest', `type=provenance,mode=min,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ], | ||||
|       undefined | ||||
|     ], | ||||
|     [ | ||||
|       34, | ||||
|       '0.13.1', | ||||
|       new Map<string, string>([ | ||||
|         ['context', '.'], | ||||
|         ['load', 'false'], | ||||
|         ['no-cache', 'false'], | ||||
|         ['push', 'false'], | ||||
|         ['pull', 'false'] | ||||
|       ]), | ||||
|       [ | ||||
|         'build', | ||||
|         '--iidfile', imageIDFilePath, | ||||
|         '--metadata-file', metadataJson, | ||||
|         '.' | ||||
|       ], | ||||
|       new Map<string, string>([ | ||||
|         ['BUILDX_NO_DEFAULT_ATTESTATIONS', '1'] | ||||
|       ]) | ||||
|     ], | ||||
|   ])( | ||||
|     '[%d] given %p with %p as inputs, returns %p', | ||||
|     async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>) => { | ||||
|     async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>, envs: Map<string, string> | undefined) => { | ||||
|       if (envs) { | ||||
|         envs.forEach((value: string, name: string) => { | ||||
|           process.env[name] = value; | ||||
|         }); | ||||
|       } | ||||
|       inputs.forEach((value: string, name: string) => { | ||||
|         setInput(name, value); | ||||
|       }); | ||||
|  | ||||
							
								
								
									
										11
									
								
								action.yml
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								action.yml
									
									
									
									
									
								
							| @ -13,6 +13,9 @@ inputs: | ||||
|   allow: | ||||
|     description: "List of extra privileged entitlement (e.g., network.host,security.insecure)" | ||||
|     required: false | ||||
|   annotations: | ||||
|     description: "List of annotation to set to the image" | ||||
|     required: false | ||||
|   attests: | ||||
|     description: "List of attestation parameters (e.g., type=sbom,generator=image)" | ||||
|     required: false | ||||
| @ -31,6 +34,9 @@ inputs: | ||||
|   cache-to: | ||||
|     description: "List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir)" | ||||
|     required: false | ||||
|   call: | ||||
|     description: "Set method for evaluating build (e.g., check)" | ||||
|     required: false | ||||
|   cgroup-parent: | ||||
|     description: "Optional parent cgroup for the container used in the build" | ||||
|     required: false | ||||
| @ -80,6 +86,9 @@ inputs: | ||||
|   secrets: | ||||
|     description: "List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken)" | ||||
|     required: false | ||||
|   secret-envs: | ||||
|     description: "List of secret env vars to expose to the build (e.g., key=envname, MY_SECRET=MY_ENV_VAR)" | ||||
|     required: false | ||||
|   secret-files: | ||||
|     description: "List of secret files to expose to the build (e.g., key=filename, MY_SECRET=./secret.txt)" | ||||
|     required: false | ||||
| @ -112,6 +121,6 @@ outputs: | ||||
|     description: 'Build result metadata' | ||||
| 
 | ||||
| runs: | ||||
|   using: 'node16' | ||||
|   using: 'node20' | ||||
|   main: 'dist/index.js' | ||||
|   post: 'dist/index.js' | ||||
|  | ||||
| @ -1,15 +1,20 @@ | ||||
| # syntax=docker/dockerfile:1 | ||||
| 
 | ||||
| ARG NODE_VERSION=16 | ||||
| ARG DOCKER_VERSION=20.10.13 | ||||
| ARG BUILDX_VERSION=0.8.0 | ||||
| ARG NODE_VERSION=20 | ||||
| 
 | ||||
| FROM node:${NODE_VERSION}-alpine AS base | ||||
| RUN apk add --no-cache cpio findutils git | ||||
| WORKDIR /src | ||||
| RUN --mount=type=bind,target=.,rw \ | ||||
|   --mount=type=cache,target=/src/.yarn/cache <<EOT | ||||
|   corepack enable | ||||
|   yarn --version | ||||
|   yarn config set --home enableTelemetry 0 | ||||
| EOT | ||||
| 
 | ||||
| FROM base AS deps | ||||
| RUN --mount=type=bind,target=.,rw \ | ||||
|   --mount=type=cache,target=/src/.yarn/cache \ | ||||
|   --mount=type=cache,target=/src/node_modules \ | ||||
|   yarn install && mkdir /vendor && cp yarn.lock /vendor | ||||
| 
 | ||||
| @ -18,18 +23,19 @@ COPY --from=deps /vendor / | ||||
| 
 | ||||
| FROM deps AS vendor-validate | ||||
| RUN --mount=type=bind,target=.,rw <<EOT | ||||
| set -e | ||||
| git add -A | ||||
| cp -rf /vendor/* . | ||||
| if [ -n "$(git status --porcelain -- yarn.lock)" ]; then | ||||
|   echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"' | ||||
|   git status --porcelain -- yarn.lock | ||||
|   exit 1 | ||||
| fi | ||||
|   set -e | ||||
|   git add -A | ||||
|   cp -rf /vendor/* . | ||||
|   if [ -n "$(git status --porcelain -- yarn.lock)" ]; then | ||||
|     echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"' | ||||
|     git status --porcelain -- yarn.lock | ||||
|     exit 1 | ||||
|   fi | ||||
| EOT | ||||
| 
 | ||||
| FROM deps AS build | ||||
| RUN --mount=type=bind,target=.,rw \ | ||||
|   --mount=type=cache,target=/src/.yarn/cache \ | ||||
|   --mount=type=cache,target=/src/node_modules \ | ||||
|   yarn run build && mkdir /out && cp -Rf dist /out/ | ||||
| 
 | ||||
| @ -38,39 +44,37 @@ COPY --from=build /out / | ||||
| 
 | ||||
| FROM build AS build-validate | ||||
| RUN --mount=type=bind,target=.,rw <<EOT | ||||
| set -e | ||||
| git add -A | ||||
| cp -rf /out/* . | ||||
| if [ -n "$(git status --porcelain -- dist)" ]; then | ||||
|   echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"' | ||||
|   git status --porcelain -- dist | ||||
|   exit 1 | ||||
| fi | ||||
|   set -e | ||||
|   git add -A | ||||
|   cp -rf /out/* . | ||||
|   if [ -n "$(git status --porcelain -- dist)" ]; then | ||||
|     echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"' | ||||
|     git status --porcelain -- dist | ||||
|     exit 1 | ||||
|   fi | ||||
| EOT | ||||
| 
 | ||||
| FROM deps AS format | ||||
| RUN --mount=type=bind,target=.,rw \ | ||||
|   --mount=type=cache,target=/src/.yarn/cache \ | ||||
|   --mount=type=cache,target=/src/node_modules \ | ||||
|   yarn run format \ | ||||
|   && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out | ||||
|   && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out | ||||
| 
 | ||||
| FROM scratch AS format-update | ||||
| COPY --from=format /out / | ||||
| 
 | ||||
| FROM deps AS lint | ||||
| RUN --mount=type=bind,target=.,rw \ | ||||
|   --mount=type=cache,target=/src/.yarn/cache \ | ||||
|   --mount=type=cache,target=/src/node_modules \ | ||||
|   yarn run lint | ||||
| 
 | ||||
| FROM docker:${DOCKER_VERSION} as docker | ||||
| FROM docker/buildx-bin:${BUILDX_VERSION} as buildx | ||||
| 
 | ||||
| FROM deps AS test | ||||
| RUN --mount=type=bind,target=.,rw \ | ||||
|   --mount=type=cache,target=/src/.yarn/cache \ | ||||
|   --mount=type=cache,target=/src/node_modules \ | ||||
|   --mount=type=bind,from=docker,source=/usr/local/bin/docker,target=/usr/bin/docker \ | ||||
|   --mount=type=bind,from=buildx,source=/buildx,target=/usr/libexec/docker/cli-plugins/docker-buildx \ | ||||
|   yarn run test --coverageDirectory=/tmp/coverage | ||||
|   yarn run test --coverage --coverageDirectory=/tmp/coverage | ||||
| 
 | ||||
| FROM scratch AS test-coverage | ||||
| COPY --from=test /tmp/coverage / | ||||
|  | ||||
							
								
								
									
										91
									
								
								dist/index.js
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										91
									
								
								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
											
										
									
								
							
							
								
								
									
										2133
									
								
								dist/licenses.txt
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2133
									
								
								dist/licenses.txt
									
									
									
										generated
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,9 +1,15 @@ | ||||
| target "_common" { | ||||
|   args = { | ||||
|     BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| group "default" { | ||||
|   targets = ["build"] | ||||
| } | ||||
| 
 | ||||
| group "pre-checkin" { | ||||
|   targets = ["vendor-update", "format", "build"] | ||||
|   targets = ["vendor", "format", "build"] | ||||
| } | ||||
| 
 | ||||
| group "validate" { | ||||
| @ -11,42 +17,49 @@ group "validate" { | ||||
| } | ||||
| 
 | ||||
| target "build" { | ||||
|   inherits = ["_common"] | ||||
|   dockerfile = "dev.Dockerfile" | ||||
|   target = "build-update" | ||||
|   output = ["."] | ||||
| } | ||||
| 
 | ||||
| target "build-validate" { | ||||
|   inherits = ["_common"] | ||||
|   dockerfile = "dev.Dockerfile" | ||||
|   target = "build-validate" | ||||
|   output = ["type=cacheonly"] | ||||
| } | ||||
| 
 | ||||
| target "format" { | ||||
|   inherits = ["_common"] | ||||
|   dockerfile = "dev.Dockerfile" | ||||
|   target = "format-update" | ||||
|   output = ["."] | ||||
| } | ||||
| 
 | ||||
| target "lint" { | ||||
|   inherits = ["_common"] | ||||
|   dockerfile = "dev.Dockerfile" | ||||
|   target = "lint" | ||||
|   output = ["type=cacheonly"] | ||||
| } | ||||
| 
 | ||||
| target "vendor-update" { | ||||
| target "vendor" { | ||||
|   inherits = ["_common"] | ||||
|   dockerfile = "dev.Dockerfile" | ||||
|   target = "vendor-update" | ||||
|   output = ["."] | ||||
| } | ||||
| 
 | ||||
| target "vendor-validate" { | ||||
|   inherits = ["_common"] | ||||
|   dockerfile = "dev.Dockerfile" | ||||
|   target = "vendor-validate" | ||||
|   output = ["type=cacheonly"] | ||||
| } | ||||
| 
 | ||||
| target "test" { | ||||
|   inherits = ["_common"] | ||||
|   dockerfile = "dev.Dockerfile" | ||||
|   target = "test-coverage" | ||||
|   output = ["./coverage"] | ||||
|  | ||||
| @ -1,3 +0,0 @@ | ||||
| # Cache | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/cache/) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Copy images between registries | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/copy-image-registries/) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Update Docker Hub repo description | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/update-dockerhub-desc/) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Export image to Docker | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/export-docker/) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Isolated builders | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/configure-builder/#isolated-builders) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Local registry | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/local-registry/) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Multi-platform image | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/multi-platform/) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Named contexts | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/named-contexts/) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Push to multi-registries | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/push-multi-registries/) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Secrets | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/secrets/) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Share built image between jobs | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/share-image-jobs/) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Handle tags and labels | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/manage-tags-labels/) | ||||
| @ -1,3 +0,0 @@ | ||||
| # Test your image before pushing it | ||||
| 
 | ||||
| This page has moved to [Docker Docs website](https://docs.docker.com/build/ci/github-actions/test-before-push/) | ||||
							
								
								
									
										55
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										55
									
								
								package.json
									
									
									
									
									
								
							| @ -1,13 +1,16 @@ | ||||
| { | ||||
|   "name": "docker-build-push", | ||||
|   "description": "Build and push Docker images", | ||||
|   "main": "lib/main.js", | ||||
|   "main": "src/main.ts", | ||||
|   "scripts": { | ||||
|     "build": "ncc build src/main.ts --source-map --minify --license licenses.txt", | ||||
|     "lint": "eslint src/**/*.ts __tests__/**/*.ts", | ||||
|     "format": "eslint --fix src/**/*.ts __tests__/**/*.ts", | ||||
|     "test": "jest --coverage", | ||||
|     "all": "yarn run build && yarn run format && yarn test" | ||||
|     "build": "ncc build --source-map --minify --license licenses.txt", | ||||
|     "lint": "yarn run prettier && yarn run eslint", | ||||
|     "format": "yarn run prettier:fix && yarn run eslint:fix", | ||||
|     "eslint": "eslint --max-warnings=0 .", | ||||
|     "eslint:fix": "eslint --fix .", | ||||
|     "prettier": "prettier --check \"./**/*.ts\"", | ||||
|     "prettier:fix": "prettier --write \"./**/*.ts\"", | ||||
|     "test": "jest" | ||||
|   }, | ||||
|   "repository": { | ||||
|     "type": "git", | ||||
| @ -19,33 +22,27 @@ | ||||
|     "build", | ||||
|     "push" | ||||
|   ], | ||||
|   "author": "Docker", | ||||
|   "contributors": [ | ||||
|     { | ||||
|       "name": "CrazyMax", | ||||
|       "url": "https://crazymax.dev" | ||||
|     } | ||||
|   ], | ||||
|   "author": "Docker Inc.", | ||||
|   "license": "Apache-2.0", | ||||
|   "packageManager": "yarn@3.6.3", | ||||
|   "dependencies": { | ||||
|     "@actions/core": "^1.10.0", | ||||
|     "@docker/actions-toolkit": "^0.8.0", | ||||
|     "@actions/core": "^1.11.1", | ||||
|     "@docker/actions-toolkit": "0.59.0", | ||||
|     "handlebars": "^4.7.7" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@types/csv-parse": "^1.2.2", | ||||
|     "@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" | ||||
|     "@types/node": "^20.12.12", | ||||
|     "@typescript-eslint/eslint-plugin": "^7.9.0", | ||||
|     "@typescript-eslint/parser": "^7.9.0", | ||||
|     "@vercel/ncc": "^0.38.1", | ||||
|     "eslint": "^8.57.0", | ||||
|     "eslint-config-prettier": "^9.1.0", | ||||
|     "eslint-plugin-jest": "^28.5.0", | ||||
|     "eslint-plugin-prettier": "^5.1.3", | ||||
|     "jest": "^29.7.0", | ||||
|     "prettier": "^3.2.5", | ||||
|     "ts-jest": "^29.1.2", | ||||
|     "ts-node": "^10.9.2", | ||||
|     "typescript": "^5.4.5" | ||||
|   } | ||||
| } | ||||
|  | ||||
							
								
								
									
										208
									
								
								src/context.ts
									
									
									
									
									
								
							
							
						
						
									
										208
									
								
								src/context.ts
									
									
									
									
									
								
							| @ -1,28 +1,31 @@ | ||||
| import * as core from '@actions/core'; | ||||
| import * as handlebars from 'handlebars'; | ||||
| 
 | ||||
| import {Build} from '@docker/actions-toolkit/lib/buildx/build'; | ||||
| import {Context} from '@docker/actions-toolkit/lib/context'; | ||||
| import {GitHub} from '@docker/actions-toolkit/lib/github'; | ||||
| import {Inputs as BuildxInputs} from '@docker/actions-toolkit/lib/buildx/inputs'; | ||||
| import {Toolkit} from '@docker/actions-toolkit/lib/toolkit'; | ||||
| import {Util} from '@docker/actions-toolkit/lib/util'; | ||||
| 
 | ||||
| export interface Inputs { | ||||
|   addHosts: string[]; | ||||
|   'add-hosts': string[]; | ||||
|   allow: string[]; | ||||
|   annotations: string[]; | ||||
|   attests: string[]; | ||||
|   buildArgs: string[]; | ||||
|   buildContexts: string[]; | ||||
|   'build-args': string[]; | ||||
|   'build-contexts': string[]; | ||||
|   builder: string; | ||||
|   cacheFrom: string[]; | ||||
|   cacheTo: string[]; | ||||
|   cgroupParent: string; | ||||
|   'cache-from': string[]; | ||||
|   'cache-to': string[]; | ||||
|   call: string; | ||||
|   'cgroup-parent': string; | ||||
|   context: string; | ||||
|   file: string; | ||||
|   labels: string[]; | ||||
|   load: boolean; | ||||
|   network: string; | ||||
|   noCache: boolean; | ||||
|   noCacheFilters: string[]; | ||||
|   'no-cache': boolean; | ||||
|   'no-cache-filters': string[]; | ||||
|   outputs: string[]; | ||||
|   platforms: string[]; | ||||
|   provenance: string; | ||||
| @ -30,47 +33,51 @@ export interface Inputs { | ||||
|   push: boolean; | ||||
|   sbom: string; | ||||
|   secrets: string[]; | ||||
|   secretFiles: string[]; | ||||
|   shmSize: string; | ||||
|   'secret-envs': string[]; | ||||
|   'secret-files': string[]; | ||||
|   'shm-size': string; | ||||
|   ssh: string[]; | ||||
|   tags: string[]; | ||||
|   target: string; | ||||
|   ulimit: string[]; | ||||
|   githubToken: string; | ||||
|   'github-token': string; | ||||
| } | ||||
| 
 | ||||
| export async function getInputs(): Promise<Inputs> { | ||||
|   return { | ||||
|     addHosts: Util.getInputList('add-hosts'), | ||||
|     'add-hosts': Util.getInputList('add-hosts'), | ||||
|     allow: Util.getInputList('allow'), | ||||
|     annotations: Util.getInputList('annotations', {ignoreComma: true}), | ||||
|     attests: Util.getInputList('attests', {ignoreComma: true}), | ||||
|     buildArgs: Util.getInputList('build-args', {ignoreComma: true}), | ||||
|     buildContexts: Util.getInputList('build-contexts', {ignoreComma: true}), | ||||
|     'build-args': Util.getInputList('build-args', {ignoreComma: true}), | ||||
|     'build-contexts': Util.getInputList('build-contexts', {ignoreComma: true}), | ||||
|     builder: core.getInput('builder'), | ||||
|     cacheFrom: Util.getInputList('cache-from', {ignoreComma: true}), | ||||
|     cacheTo: Util.getInputList('cache-to', {ignoreComma: true}), | ||||
|     cgroupParent: core.getInput('cgroup-parent'), | ||||
|     'cache-from': Util.getInputList('cache-from', {ignoreComma: true}), | ||||
|     'cache-to': Util.getInputList('cache-to', {ignoreComma: true}), | ||||
|     call: core.getInput('call'), | ||||
|     'cgroup-parent': core.getInput('cgroup-parent'), | ||||
|     context: core.getInput('context') || Context.gitContext(), | ||||
|     file: core.getInput('file'), | ||||
|     labels: Util.getInputList('labels', {ignoreComma: true}), | ||||
|     load: core.getBooleanInput('load'), | ||||
|     network: core.getInput('network'), | ||||
|     noCache: core.getBooleanInput('no-cache'), | ||||
|     noCacheFilters: Util.getInputList('no-cache-filters'), | ||||
|     outputs: Util.getInputList('outputs', {ignoreComma: true}), | ||||
|     'no-cache': core.getBooleanInput('no-cache'), | ||||
|     'no-cache-filters': Util.getInputList('no-cache-filters'), | ||||
|     outputs: Util.getInputList('outputs', {ignoreComma: true, quote: false}), | ||||
|     platforms: Util.getInputList('platforms'), | ||||
|     provenance: BuildxInputs.getProvenanceInput('provenance'), | ||||
|     provenance: Build.getProvenanceInput('provenance'), | ||||
|     pull: core.getBooleanInput('pull'), | ||||
|     push: core.getBooleanInput('push'), | ||||
|     sbom: core.getInput('sbom'), | ||||
|     secrets: Util.getInputList('secrets', {ignoreComma: true}), | ||||
|     secretFiles: Util.getInputList('secret-files', {ignoreComma: true}), | ||||
|     shmSize: core.getInput('shm-size'), | ||||
|     'secret-envs': Util.getInputList('secret-envs'), | ||||
|     'secret-files': Util.getInputList('secret-files', {ignoreComma: true}), | ||||
|     'shm-size': core.getInput('shm-size'), | ||||
|     ssh: Util.getInputList('ssh'), | ||||
|     tags: Util.getInputList('tags'), | ||||
|     target: core.getInput('target'), | ||||
|     ulimit: Util.getInputList('ulimit', {ignoreComma: true}), | ||||
|     githubToken: core.getInput('github-token') | ||||
|     'github-token': core.getInput('github-token') | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
| @ -88,44 +95,66 @@ export async function getArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<s | ||||
| 
 | ||||
| async function getBuildArgs(inputs: Inputs, context: string, toolkit: Toolkit): Promise<Array<string>> { | ||||
|   const args: Array<string> = ['build']; | ||||
|   await Util.asyncForEach(inputs.addHosts, async addHost => { | ||||
|   await Util.asyncForEach(inputs['add-hosts'], async addHost => { | ||||
|     args.push('--add-host', addHost); | ||||
|   }); | ||||
|   if (inputs.allow.length > 0) { | ||||
|     args.push('--allow', inputs.allow.join(',')); | ||||
|   } | ||||
|   if (await toolkit.buildx.versionSatisfies('>=0.10.0')) { | ||||
|     await Util.asyncForEach(inputs.attests, async attest => { | ||||
|       args.push('--attest', attest); | ||||
|   await Util.asyncForEach(inputs.allow, async allow => { | ||||
|     args.push('--allow', allow); | ||||
|   }); | ||||
|   if (await toolkit.buildx.versionSatisfies('>=0.12.0')) { | ||||
|     await Util.asyncForEach(inputs.annotations, async annotation => { | ||||
|       args.push('--annotation', annotation); | ||||
|     }); | ||||
|   } else if (inputs.annotations.length > 0) { | ||||
|     core.warning("Annotations are only supported by buildx >= 0.12.0; the input 'annotations' is ignored."); | ||||
|   } | ||||
|   await Util.asyncForEach(inputs.buildArgs, async buildArg => { | ||||
|   await Util.asyncForEach(inputs['build-args'], async buildArg => { | ||||
|     args.push('--build-arg', buildArg); | ||||
|   }); | ||||
|   if (await toolkit.buildx.versionSatisfies('>=0.8.0')) { | ||||
|     await Util.asyncForEach(inputs.buildContexts, async buildContext => { | ||||
|       args.push('--build-context', buildContext); | ||||
|     await Util.asyncForEach(inputs['build-contexts'], async buildContext => { | ||||
|       args.push( | ||||
|         '--build-context', | ||||
|         handlebars.compile(buildContext)({ | ||||
|           defaultContext: Context.gitContext() | ||||
|         }) | ||||
|       ); | ||||
|     }); | ||||
|   } else if (inputs['build-contexts'].length > 0) { | ||||
|     core.warning("Build contexts are only supported by buildx >= 0.8.0; the input 'build-contexts' is ignored."); | ||||
|   } | ||||
|   await Util.asyncForEach(inputs.cacheFrom, async cacheFrom => { | ||||
|   await Util.asyncForEach(inputs['cache-from'], async cacheFrom => { | ||||
|     args.push('--cache-from', cacheFrom); | ||||
|   }); | ||||
|   await Util.asyncForEach(inputs.cacheTo, async cacheTo => { | ||||
|   await Util.asyncForEach(inputs['cache-to'], async cacheTo => { | ||||
|     args.push('--cache-to', cacheTo); | ||||
|   }); | ||||
|   if (inputs.cgroupParent) { | ||||
|     args.push('--cgroup-parent', inputs.cgroupParent); | ||||
|   if (inputs.call) { | ||||
|     if (!(await toolkit.buildx.versionSatisfies('>=0.15.0'))) { | ||||
|       throw new Error(`Buildx >= 0.15.0 is required to use the call flag.`); | ||||
|     } | ||||
|     args.push('--call', inputs.call); | ||||
|   } | ||||
|   if (inputs['cgroup-parent']) { | ||||
|     args.push('--cgroup-parent', inputs['cgroup-parent']); | ||||
|   } | ||||
|   await Util.asyncForEach(inputs['secret-envs'], async secretEnv => { | ||||
|     try { | ||||
|       args.push('--secret', Build.resolveSecretEnv(secretEnv)); | ||||
|     } catch (err) { | ||||
|       core.warning(err.message); | ||||
|     } | ||||
|   }); | ||||
|   if (inputs.file) { | ||||
|     args.push('--file', inputs.file); | ||||
|   } | ||||
|   if (!BuildxInputs.hasLocalExporter(inputs.outputs) && !BuildxInputs.hasTarExporter(inputs.outputs) && (inputs.platforms.length == 0 || (await toolkit.buildx.versionSatisfies('>=0.4.2')))) { | ||||
|     args.push('--iidfile', BuildxInputs.getBuildImageIDFilePath()); | ||||
|   if (!Build.hasLocalExporter(inputs.outputs) && !Build.hasTarExporter(inputs.outputs) && (inputs.platforms.length == 0 || (await toolkit.buildx.versionSatisfies('>=0.4.2')))) { | ||||
|     args.push('--iidfile', toolkit.buildxBuild.getImageIDFilePath()); | ||||
|   } | ||||
|   await Util.asyncForEach(inputs.labels, async label => { | ||||
|     args.push('--label', label); | ||||
|   }); | ||||
|   await Util.asyncForEach(inputs.noCacheFilters, async noCacheFilter => { | ||||
|   await Util.asyncForEach(inputs['no-cache-filters'], async noCacheFilter => { | ||||
|     args.push('--no-cache-filter', noCacheFilter); | ||||
|   }); | ||||
|   await Util.asyncForEach(inputs.outputs, async output => { | ||||
| @ -135,44 +164,29 @@ async function getBuildArgs(inputs: Inputs, context: string, toolkit: Toolkit): | ||||
|     args.push('--platform', inputs.platforms.join(',')); | ||||
|   } | ||||
|   if (await toolkit.buildx.versionSatisfies('>=0.10.0')) { | ||||
|     if (inputs.provenance) { | ||||
|       args.push('--provenance', inputs.provenance); | ||||
|     } else if ((await toolkit.buildkit.versionSatisfies(inputs.builder, '>=0.11.0')) && !BuildxInputs.hasDockerExporter(inputs.outputs, inputs.load)) { | ||||
|       // if provenance not specified and BuildKit version compatible for
 | ||||
|       // attestation, set default provenance. Also needs to make sure user
 | ||||
|       // doesn't want to explicitly load the image to docker.
 | ||||
|       if (GitHub.context.payload.repository?.private ?? false) { | ||||
|         // if this is a private repository, we set the default provenance
 | ||||
|         // attributes being set in buildx: https://github.com/docker/buildx/blob/fb27e3f919dcbf614d7126b10c2bc2d0b1927eb6/build/build.go#L603
 | ||||
|         args.push('--provenance', BuildxInputs.resolveProvenanceAttrs(`mode=min,inline-only=true`)); | ||||
|       } else { | ||||
|         // for a public repository, we set max provenance mode.
 | ||||
|         args.push('--provenance', BuildxInputs.resolveProvenanceAttrs(`mode=max`)); | ||||
|       } | ||||
|     } | ||||
|     if (inputs.sbom) { | ||||
|       args.push('--sbom', inputs.sbom); | ||||
|     } | ||||
|     args.push(...(await getAttestArgs(inputs, toolkit))); | ||||
|   } else { | ||||
|     core.warning("Attestations are only supported by buildx >= 0.10.0; the inputs 'attests', 'provenance' and 'sbom' are ignored."); | ||||
|   } | ||||
|   await Util.asyncForEach(inputs.secrets, async secret => { | ||||
|     try { | ||||
|       args.push('--secret', BuildxInputs.resolveBuildSecretString(secret)); | ||||
|       args.push('--secret', Build.resolveSecretString(secret)); | ||||
|     } catch (err) { | ||||
|       core.warning(err.message); | ||||
|     } | ||||
|   }); | ||||
|   await Util.asyncForEach(inputs.secretFiles, async secretFile => { | ||||
|   await Util.asyncForEach(inputs['secret-files'], async secretFile => { | ||||
|     try { | ||||
|       args.push('--secret', BuildxInputs.resolveBuildSecretFile(secretFile)); | ||||
|       args.push('--secret', Build.resolveSecretFile(secretFile)); | ||||
|     } catch (err) { | ||||
|       core.warning(err.message); | ||||
|     } | ||||
|   }); | ||||
|   if (inputs.githubToken && !BuildxInputs.hasGitAuthTokenSecret(inputs.secrets) && context.startsWith(Context.gitContext())) { | ||||
|     args.push('--secret', BuildxInputs.resolveBuildSecretString(`GIT_AUTH_TOKEN=${inputs.githubToken}`)); | ||||
|   if (inputs['github-token'] && !Build.hasGitAuthTokenSecret(inputs.secrets) && context.startsWith(Context.gitContext())) { | ||||
|     args.push('--secret', Build.resolveSecretString(`GIT_AUTH_TOKEN=${inputs['github-token']}`)); | ||||
|   } | ||||
|   if (inputs.shmSize) { | ||||
|     args.push('--shm-size', inputs.shmSize); | ||||
|   if (inputs['shm-size']) { | ||||
|     args.push('--shm-size', inputs['shm-size']); | ||||
|   } | ||||
|   await Util.asyncForEach(inputs.ssh, async ssh => { | ||||
|     args.push('--ssh', ssh); | ||||
| @ -198,12 +212,12 @@ async function getCommonArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<st | ||||
|     args.push('--load'); | ||||
|   } | ||||
|   if (await toolkit.buildx.versionSatisfies('>=0.6.0')) { | ||||
|     args.push('--metadata-file', BuildxInputs.getBuildMetadataFilePath()); | ||||
|     args.push('--metadata-file', toolkit.buildxBuild.getMetadataFilePath()); | ||||
|   } | ||||
|   if (inputs.network) { | ||||
|     args.push('--network', inputs.network); | ||||
|   } | ||||
|   if (inputs.noCache) { | ||||
|   if (inputs['no-cache']) { | ||||
|     args.push('--no-cache'); | ||||
|   } | ||||
|   if (inputs.pull) { | ||||
| @ -214,3 +228,59 @@ async function getCommonArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<st | ||||
|   } | ||||
|   return args; | ||||
| } | ||||
| 
 | ||||
| async function getAttestArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<string>> { | ||||
|   const args: Array<string> = []; | ||||
| 
 | ||||
|   // check if provenance attestation is set in attests input
 | ||||
|   let hasAttestProvenance = false; | ||||
|   await Util.asyncForEach(inputs.attests, async (attest: string) => { | ||||
|     if (Build.hasAttestationType('provenance', attest)) { | ||||
|       hasAttestProvenance = true; | ||||
|     } | ||||
|   }); | ||||
| 
 | ||||
|   let provenanceSet = false; | ||||
|   let sbomSet = false; | ||||
|   if (inputs.provenance) { | ||||
|     args.push('--attest', Build.resolveAttestationAttrs(`type=provenance,${inputs.provenance}`)); | ||||
|     provenanceSet = true; | ||||
|   } else if (!hasAttestProvenance && !noDefaultAttestations() && (await toolkit.buildkit.versionSatisfies(inputs.builder, '>=0.11.0')) && !Build.hasDockerExporter(inputs.outputs, inputs.load)) { | ||||
|     // if provenance not specified in provenance or attests inputs and BuildKit
 | ||||
|     // version compatible for attestation, set default provenance. Also needs
 | ||||
|     // to make sure user doesn't want to explicitly load the image to docker.
 | ||||
|     if (GitHub.context.payload.repository?.private ?? false) { | ||||
|       // if this is a private repository, we set the default provenance
 | ||||
|       // attributes being set in buildx: https://github.com/docker/buildx/blob/fb27e3f919dcbf614d7126b10c2bc2d0b1927eb6/build/build.go#L603
 | ||||
|       args.push('--attest', `type=provenance,${Build.resolveProvenanceAttrs(`mode=min,inline-only=true`)}`); | ||||
|     } else { | ||||
|       // for a public repository, we set max provenance mode.
 | ||||
|       args.push('--attest', `type=provenance,${Build.resolveProvenanceAttrs(`mode=max`)}`); | ||||
|     } | ||||
|   } | ||||
|   if (inputs.sbom) { | ||||
|     args.push('--attest', Build.resolveAttestationAttrs(`type=sbom,${inputs.sbom}`)); | ||||
|     sbomSet = true; | ||||
|   } | ||||
| 
 | ||||
|   // set attests but check if provenance or sbom types already set as
 | ||||
|   // provenance and sbom inputs take precedence over attests input.
 | ||||
|   await Util.asyncForEach(inputs.attests, async (attest: string) => { | ||||
|     if (!Build.hasAttestationType('provenance', attest) && !Build.hasAttestationType('sbom', attest)) { | ||||
|       args.push('--attest', Build.resolveAttestationAttrs(attest)); | ||||
|     } else if (!provenanceSet && Build.hasAttestationType('provenance', attest)) { | ||||
|       args.push('--attest', Build.resolveProvenanceAttrs(attest)); | ||||
|     } else if (!sbomSet && Build.hasAttestationType('sbom', attest)) { | ||||
|       args.push('--attest', attest); | ||||
|     } | ||||
|   }); | ||||
| 
 | ||||
|   return args; | ||||
| } | ||||
| 
 | ||||
| function noDefaultAttestations(): boolean { | ||||
|   if (process.env.BUILDX_NO_DEFAULT_ATTESTATIONS) { | ||||
|     return Util.parseBool(process.env.BUILDX_NO_DEFAULT_ATTESTATIONS); | ||||
|   } | ||||
|   return false; | ||||
| } | ||||
|  | ||||
							
								
								
									
										206
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										206
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -3,20 +3,30 @@ import * as path from 'path'; | ||||
| import * as stateHelper from './state-helper'; | ||||
| import * as core from '@actions/core'; | ||||
| import * as actionsToolkit from '@docker/actions-toolkit'; | ||||
| 
 | ||||
| import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx'; | ||||
| import {History as BuildxHistory} from '@docker/actions-toolkit/lib/buildx/history'; | ||||
| import {Context} from '@docker/actions-toolkit/lib/context'; | ||||
| import {Docker} from '@docker/actions-toolkit/lib/docker/docker'; | ||||
| import {Exec} from '@docker/actions-toolkit/lib/exec'; | ||||
| import {GitHub} from '@docker/actions-toolkit/lib/github'; | ||||
| import {Inputs as BuildxInputs} from '@docker/actions-toolkit/lib/buildx/inputs'; | ||||
| import {Toolkit} from '@docker/actions-toolkit/lib/toolkit'; | ||||
| import {ConfigFile} from '@docker/actions-toolkit/lib/types/docker'; | ||||
| import {Util} from '@docker/actions-toolkit/lib/util'; | ||||
| 
 | ||||
| import {BuilderInfo} from '@docker/actions-toolkit/lib/types/buildx/builder'; | ||||
| import {ConfigFile} from '@docker/actions-toolkit/lib/types/docker/docker'; | ||||
| import {UploadArtifactResponse} from '@docker/actions-toolkit/lib/types/github'; | ||||
| 
 | ||||
| import * as context from './context'; | ||||
| 
 | ||||
| actionsToolkit.run( | ||||
|   // main
 | ||||
|   async () => { | ||||
|     const startedTime = new Date(); | ||||
|     const inputs: context.Inputs = await context.getInputs(); | ||||
|     stateHelper.setSummaryInputs(inputs); | ||||
|     core.debug(`inputs: ${JSON.stringify(inputs)}`); | ||||
| 
 | ||||
|     const toolkit = new Toolkit(); | ||||
| 
 | ||||
|     await core.group(`GitHub Actions runtime token ACs`, async () => { | ||||
| @ -48,7 +58,7 @@ actionsToolkit.run( | ||||
|       if (dockerConfig && dockerConfig.proxies) { | ||||
|         for (const host in dockerConfig.proxies) { | ||||
|           let prefix = ''; | ||||
|           if (dockerConfig.proxies.length > 1) { | ||||
|           if (Object.keys(dockerConfig.proxies).length > 1) { | ||||
|             prefix = '  '; | ||||
|             core.info(host); | ||||
|           } | ||||
| @ -72,20 +82,42 @@ actionsToolkit.run( | ||||
|       await toolkit.buildx.printVersion(); | ||||
|     }); | ||||
| 
 | ||||
|     let builder: BuilderInfo; | ||||
|     await core.group(`Builder info`, async () => { | ||||
|       builder = await toolkit.builder.inspect(inputs.builder); | ||||
|       core.info(JSON.stringify(builder, null, 2)); | ||||
|     }); | ||||
| 
 | ||||
|     const args: string[] = await context.getArgs(inputs, toolkit); | ||||
|     core.debug(`context.getArgs: ${JSON.stringify(args)}`); | ||||
| 
 | ||||
|     const buildCmd = await toolkit.buildx.getCommand(args); | ||||
|     core.debug(`buildCmd.command: ${buildCmd.command}`); | ||||
|     core.debug(`buildCmd.args: ${JSON.stringify(buildCmd.args)}`); | ||||
| 
 | ||||
|     let err: Error | undefined; | ||||
|     await Exec.getExecOutput(buildCmd.command, buildCmd.args, { | ||||
|       ignoreReturnCode: true | ||||
|       ignoreReturnCode: true, | ||||
|       env: Object.assign({}, process.env, { | ||||
|         BUILDX_METADATA_WARNINGS: 'true' | ||||
|       }) as { | ||||
|         [key: string]: string; | ||||
|       } | ||||
|     }).then(res => { | ||||
|       if (res.stderr.length > 0 && res.exitCode != 0) { | ||||
|         throw new Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`); | ||||
|       if (res.exitCode != 0) { | ||||
|         if (inputs.call && inputs.call === 'check' && res.stdout.length > 0) { | ||||
|           // checks warnings are printed to stdout: https://github.com/docker/buildx/pull/2647
 | ||||
|           // take the first line with the message summaryzing the warnings
 | ||||
|           err = new Error(res.stdout.split('\n')[0]?.trim()); | ||||
|         } else if (res.stderr.length > 0) { | ||||
|           err = new Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`); | ||||
|         } | ||||
|       } | ||||
|     }); | ||||
| 
 | ||||
|     const imageID = BuildxInputs.resolveBuildImageID(); | ||||
|     const metadata = BuildxInputs.resolveBuildMetadata(); | ||||
|     const digest = BuildxInputs.resolveDigest(); | ||||
| 
 | ||||
|     const imageID = toolkit.buildxBuild.resolveImageID(); | ||||
|     const metadata = toolkit.buildxBuild.resolveMetadata(); | ||||
|     const digest = toolkit.buildxBuild.resolveDigest(metadata); | ||||
|     if (imageID) { | ||||
|       await core.group(`ImageID`, async () => { | ||||
|         core.info(imageID); | ||||
| @ -100,17 +132,165 @@ actionsToolkit.run( | ||||
|     } | ||||
|     if (metadata) { | ||||
|       await core.group(`Metadata`, async () => { | ||||
|         core.info(metadata); | ||||
|         core.setOutput('metadata', metadata); | ||||
|         const metadatadt = JSON.stringify(metadata, null, 2); | ||||
|         core.info(metadatadt); | ||||
|         core.setOutput('metadata', metadatadt); | ||||
|       }); | ||||
|     } | ||||
| 
 | ||||
|     let ref: string | undefined; | ||||
|     await core.group(`Reference`, async () => { | ||||
|       ref = await buildRef(toolkit, startedTime, inputs.builder); | ||||
|       if (ref) { | ||||
|         core.info(ref); | ||||
|         stateHelper.setBuildRef(ref); | ||||
|       } else { | ||||
|         core.info('No build reference found'); | ||||
|       } | ||||
|     }); | ||||
| 
 | ||||
|     if (buildChecksAnnotationsEnabled()) { | ||||
|       const warnings = toolkit.buildxBuild.resolveWarnings(metadata); | ||||
|       if (ref && warnings && warnings.length > 0) { | ||||
|         const annotations = await Buildx.convertWarningsToGitHubAnnotations(warnings, [ref]); | ||||
|         core.debug(`annotations: ${JSON.stringify(annotations, null, 2)}`); | ||||
|         if (annotations && annotations.length > 0) { | ||||
|           await core.group(`Generating GitHub annotations (${annotations.length} build checks found)`, async () => { | ||||
|             for (const annotation of annotations) { | ||||
|               core.warning(annotation.message, annotation); | ||||
|             } | ||||
|           }); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     await core.group(`Check build summary support`, async () => { | ||||
|       if (!buildSummaryEnabled()) { | ||||
|         core.info('Build summary disabled'); | ||||
|       } else if (inputs.call && inputs.call !== 'build') { | ||||
|         core.info(`Build summary skipped for ${inputs.call} subrequest`); | ||||
|       } else if (GitHub.isGHES) { | ||||
|         core.info('Build summary is not yet supported on GHES'); | ||||
|       } else if (!(await toolkit.buildx.versionSatisfies('>=0.13.0'))) { | ||||
|         core.info('Build summary requires Buildx >= 0.13.0'); | ||||
|       } else if (builder && builder.driver === 'cloud') { | ||||
|         core.info('Build summary is not yet supported with Docker Build Cloud'); | ||||
|       } else if (!ref) { | ||||
|         core.info('Build summary requires a build reference'); | ||||
|       } else { | ||||
|         core.info('Build summary supported!'); | ||||
|         stateHelper.setSummarySupported(); | ||||
|       } | ||||
|     }); | ||||
| 
 | ||||
|     if (err) { | ||||
|       throw err; | ||||
|     } | ||||
|   }, | ||||
|   // post
 | ||||
|   async () => { | ||||
|     if (stateHelper.isSummarySupported) { | ||||
|       await core.group(`Generating build summary`, async () => { | ||||
|         try { | ||||
|           const recordUploadEnabled = buildRecordUploadEnabled(); | ||||
|           let recordRetentionDays: number | undefined; | ||||
|           if (recordUploadEnabled) { | ||||
|             recordRetentionDays = buildRecordRetentionDays(); | ||||
|           } | ||||
| 
 | ||||
|           const buildxHistory = new BuildxHistory(); | ||||
|           const exportRes = await buildxHistory.export({ | ||||
|             refs: stateHelper.buildRef ? [stateHelper.buildRef] : [] | ||||
|           }); | ||||
|           core.info(`Build record written to ${exportRes.dockerbuildFilename} (${Util.formatFileSize(exportRes.dockerbuildSize)})`); | ||||
| 
 | ||||
|           let uploadRes: UploadArtifactResponse | undefined; | ||||
|           if (recordUploadEnabled) { | ||||
|             uploadRes = await GitHub.uploadArtifact({ | ||||
|               filename: exportRes.dockerbuildFilename, | ||||
|               mimeType: 'application/gzip', | ||||
|               retentionDays: recordRetentionDays | ||||
|             }); | ||||
|           } | ||||
| 
 | ||||
|           await GitHub.writeBuildSummary({ | ||||
|             exportRes: exportRes, | ||||
|             uploadRes: uploadRes, | ||||
|             inputs: stateHelper.summaryInputs | ||||
|           }); | ||||
|         } catch (e) { | ||||
|           core.warning(e.message); | ||||
|         } | ||||
|       }); | ||||
|     } | ||||
|     if (stateHelper.tmpDir.length > 0) { | ||||
|       await core.group(`Removing temp folder ${stateHelper.tmpDir}`, async () => { | ||||
|         fs.rmSync(stateHelper.tmpDir, {recursive: true}); | ||||
|         try { | ||||
|           fs.rmSync(stateHelper.tmpDir, {recursive: true}); | ||||
|         } catch (e) { | ||||
|           core.warning(`Failed to remove temp folder ${stateHelper.tmpDir}`); | ||||
|         } | ||||
|       }); | ||||
|     } | ||||
|   } | ||||
| ); | ||||
| 
 | ||||
| async function buildRef(toolkit: Toolkit, since: Date, builder?: string): Promise<string> { | ||||
|   // get ref from metadata file
 | ||||
|   const ref = toolkit.buildxBuild.resolveRef(); | ||||
|   if (ref) { | ||||
|     return ref; | ||||
|   } | ||||
|   // otherwise, look for the very first build ref since the build has started
 | ||||
|   if (!builder) { | ||||
|     const currentBuilder = await toolkit.builder.inspect(); | ||||
|     builder = currentBuilder.name; | ||||
|   } | ||||
|   const refs = Buildx.refs({ | ||||
|     dir: Buildx.refsDir, | ||||
|     builderName: builder, | ||||
|     since: since | ||||
|   }); | ||||
|   return Object.keys(refs).length > 0 ? Object.keys(refs)[0] : ''; | ||||
| } | ||||
| 
 | ||||
| function buildChecksAnnotationsEnabled(): boolean { | ||||
|   if (process.env.DOCKER_BUILD_CHECKS_ANNOTATIONS) { | ||||
|     return Util.parseBool(process.env.DOCKER_BUILD_CHECKS_ANNOTATIONS); | ||||
|   } | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| function buildSummaryEnabled(): boolean { | ||||
|   if (process.env.DOCKER_BUILD_NO_SUMMARY) { | ||||
|     core.warning('DOCKER_BUILD_NO_SUMMARY is deprecated. Set DOCKER_BUILD_SUMMARY to false instead.'); | ||||
|     return !Util.parseBool(process.env.DOCKER_BUILD_NO_SUMMARY); | ||||
|   } else if (process.env.DOCKER_BUILD_SUMMARY) { | ||||
|     return Util.parseBool(process.env.DOCKER_BUILD_SUMMARY); | ||||
|   } | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| function buildRecordUploadEnabled(): boolean { | ||||
|   if (process.env.DOCKER_BUILD_RECORD_UPLOAD) { | ||||
|     return Util.parseBool(process.env.DOCKER_BUILD_RECORD_UPLOAD); | ||||
|   } | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| function buildRecordRetentionDays(): number | undefined { | ||||
|   let val: string | undefined; | ||||
|   if (process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS) { | ||||
|     core.warning('DOCKER_BUILD_EXPORT_RETENTION_DAYS is deprecated. Use DOCKER_BUILD_RECORD_RETENTION_DAYS instead.'); | ||||
|     val = process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS; | ||||
|   } else if (process.env.DOCKER_BUILD_RECORD_RETENTION_DAYS) { | ||||
|     val = process.env.DOCKER_BUILD_RECORD_RETENTION_DAYS; | ||||
|   } | ||||
|   if (val) { | ||||
|     const res = parseInt(val); | ||||
|     if (isNaN(res)) { | ||||
|       throw new Error(`Invalid build record retention days: ${val}`); | ||||
|     } | ||||
|     return res; | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -1,7 +1,58 @@ | ||||
| import * as core from '@actions/core'; | ||||
| 
 | ||||
| import {Build} from '@docker/actions-toolkit/lib/buildx/build'; | ||||
| 
 | ||||
| import {Inputs} from './context'; | ||||
| 
 | ||||
| export const tmpDir = process.env['STATE_tmpDir'] || ''; | ||||
| export const buildRef = process.env['STATE_buildRef'] || ''; | ||||
| export const isSummarySupported = !!process.env['STATE_isSummarySupported']; | ||||
| export const summaryInputs = process.env['STATE_summaryInputs'] ? JSON.parse(process.env['STATE_summaryInputs']) : undefined; | ||||
| 
 | ||||
| export function setTmpDir(tmpDir: string) { | ||||
|   core.saveState('tmpDir', tmpDir); | ||||
| } | ||||
| 
 | ||||
| export function setBuildRef(buildRef: string) { | ||||
|   core.saveState('buildRef', buildRef); | ||||
| } | ||||
| 
 | ||||
| export function setSummarySupported() { | ||||
|   core.saveState('isSummarySupported', 'true'); | ||||
| } | ||||
| 
 | ||||
| export function setSummaryInputs(inputs: Inputs) { | ||||
|   const res = {}; | ||||
|   for (const key of Object.keys(inputs)) { | ||||
|     if (key === 'github-token') { | ||||
|       continue; | ||||
|     } | ||||
|     const value: string | string[] | boolean = inputs[key]; | ||||
|     if (typeof value === 'boolean' && !value) { | ||||
|       continue; | ||||
|     } else if (Array.isArray(value)) { | ||||
|       if (value.length === 0) { | ||||
|         continue; | ||||
|       } else if (key === 'secrets' && value.length > 0) { | ||||
|         const secretKeys: string[] = []; | ||||
|         for (const secret of value) { | ||||
|           try { | ||||
|             // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | ||||
|             const [skey, _] = Build.parseSecretKvp(secret, true); | ||||
|             secretKeys.push(skey); | ||||
|           } catch (err) { | ||||
|             // ignore invalid secret
 | ||||
|           } | ||||
|         } | ||||
|         if (secretKeys.length > 0) { | ||||
|           res[key] = secretKeys; | ||||
|         } | ||||
|         continue; | ||||
|       } | ||||
|     } else if (!value) { | ||||
|       continue; | ||||
|     } | ||||
|     res[key] = value; | ||||
|   } | ||||
|   core.saveState('summaryInputs', JSON.stringify(res)); | ||||
| } | ||||
|  | ||||
							
								
								
									
										12
									
								
								test/lint.Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								test/lint.Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| frOM busybox as base | ||||
| cOpy lint.Dockerfile . | ||||
| 
 | ||||
| from scratch | ||||
| MAINTAINER moby@example.com | ||||
| COPy --from=base \ | ||||
|   /lint.Dockerfile \ | ||||
|   / | ||||
| 
 | ||||
| CMD [ "echo", "Hello, Norway!" ] | ||||
| CMD [ "echo", "Hello, Sweden!" ] | ||||
| ENTRYPOINT my-program start | ||||
| @ -1,5 +1,6 @@ | ||||
| # syntax=docker/dockerfile:1 | ||||
| FROM --platform=$BUILDPLATFORM golang:alpine AS build | ||||
| 
 | ||||
| FROM --platform=$BUILDPLATFORM alpine AS build | ||||
| ARG TARGETPLATFORM | ||||
| ARG BUILDPLATFORM | ||||
| RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM" > /log | ||||
| @ -12,7 +13,7 @@ RUN apk --update --no-cache add \ | ||||
|   && rm -rf /tmp/* /var/cache/apk/* | ||||
| 
 | ||||
| USER buildx | ||||
| RUN sudo chown buildx. /log | ||||
| RUN sudo chown buildx: /log | ||||
| USER root | ||||
| 
 | ||||
| FROM alpine | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user