ci: cleanup ci workflow
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									a5024d816a
								
							
						
					
					
						commit
						8b56e74b48
					
				
							
								
								
									
										135
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										135
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @ -694,141 +694,6 @@ jobs: | ||||
|             exit 1 | ||||
|           fi | ||||
| 
 | ||||
|   local-cache-first: | ||||
|     runs-on: ubuntu-latest | ||||
|     outputs: | ||||
|       digest: ${{ steps.docker_build.outputs.digest }} | ||||
|     services: | ||||
|       registry: | ||||
|         image: registry:2 | ||||
|         ports: | ||||
|           - 5000:5000 | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v3 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         id: buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         with: | ||||
|           version: ${{ matrix.buildx-version }} | ||||
|           driver-opts: | | ||||
|             network=host | ||||
|             ${{ matrix.buildkit-image }} | ||||
|       - | ||||
|         name: Cache Docker layers | ||||
|         uses: actions/cache@v3 | ||||
|         with: | ||||
|           path: /tmp/.buildx-cache | ||||
|           key: ${{ runner.os }}-buildx-local-${{ github.sha }} | ||||
|           restore-keys: | | ||||
|             ${{ runner.os }}-buildx-ghcache- | ||||
|       - | ||||
|         name: Erase cache | ||||
|         run: | | ||||
|           rm -rf /tmp/.buildx-cache/* | ||||
|       - | ||||
|         name: Build and push | ||||
|         id: docker_build | ||||
|         uses: ./ | ||||
|         with: | ||||
|           context: ./test | ||||
|           file: ./test/multi.Dockerfile | ||||
|           builder: ${{ steps.buildx.outputs.name }} | ||||
|           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 | ||||
|       - | ||||
|         name: Inspect | ||||
|         run: | | ||||
|           docker buildx imagetools inspect localhost:5000/name/app:1.0.0 | ||||
|       - | ||||
|         name: Check digest | ||||
|         run: | | ||||
|           if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then | ||||
|             echo "::error::Digest should not be empty" | ||||
|             exit 1 | ||||
|           fi | ||||
| 
 | ||||
|   local-cache-hit: | ||||
|     runs-on: ubuntu-latest | ||||
|     needs: local-cache-first | ||||
|     services: | ||||
|       registry: | ||||
|         image: registry:2 | ||||
|         ports: | ||||
|           - 5000:5000 | ||||
|     steps: | ||||
|       - | ||||
|         name: Checkout | ||||
|         uses: actions/checkout@v3 | ||||
|       - | ||||
|         name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v2 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|         id: buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         with: | ||||
|           version: ${{ matrix.buildx-version }} | ||||
|           driver-opts: | | ||||
|             network=host | ||||
|             ${{ matrix.buildkit-image }} | ||||
|       - | ||||
|         name: Cache Docker layers | ||||
|         uses: actions/cache@v3 | ||||
|         id: cache | ||||
|         with: | ||||
|           path: /tmp/.buildx-cache | ||||
|           key: ${{ runner.os }}-buildx-local-${{ github.sha }} | ||||
|           restore-keys: | | ||||
|             ${{ runner.os }}-buildx-ghcache- | ||||
|       - | ||||
|         name: Build and push | ||||
|         id: docker_build | ||||
|         uses: ./ | ||||
|         with: | ||||
|           context: ./test | ||||
|           file: ./test/multi.Dockerfile | ||||
|           builder: ${{ steps.buildx.outputs.name }} | ||||
|           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 | ||||
|       - | ||||
|         name: Inspect | ||||
|         run: | | ||||
|           docker buildx imagetools inspect localhost:5000/name/app:1.0.0 | ||||
|       - | ||||
|         name: Check digest | ||||
|         run: | | ||||
|           if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then | ||||
|             echo "::error::Digest should not be empty" | ||||
|             exit 1 | ||||
|           fi | ||||
|       - | ||||
|         name: Compare digests | ||||
|         run: | | ||||
|           echo Compare "${{ needs.local-cache-first.outputs.digest }}" with "${{ steps.docker_build.outputs.digest }}" | ||||
|           if [ "${{ needs.local-cache-first.outputs.digest }}" != "${{ steps.docker_build.outputs.digest }}" ]; then | ||||
|             echo "::error::Digests should be identical" | ||||
|             exit 1 | ||||
|           fi | ||||
|       - | ||||
|         name: Cache hit | ||||
|         run: echo ${{ steps.cache.outputs.cache-hit }} | ||||
| 
 | ||||
|   github-cache: | ||||
|     runs-on: ubuntu-latest | ||||
|     services: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user