-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_shared-prepare-docker-cache.yaml
More file actions
67 lines (60 loc) · 2.44 KB
/
_shared-prepare-docker-cache.yaml
File metadata and controls
67 lines (60 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
on:
workflow_call:
inputs:
kurtosis_version:
type: string
description: "The kurtosis version to use."
default: ""
jobs:
run_prepare:
name: "Prepare Docker cache (${{ inputs.kurtosis_version }})"
runs-on: ubuntu-latest
steps:
- name: Check if cache key exists
id: check_cache
env:
GH_TOKEN: ${{ github.token }}
run: |
KEY="kurtosis-docker-${{ runner.os }}-${{ inputs.kurtosis_version }}"
CACHE_HIT=$(gh cache list --repo ${{ github.repository }} --json "key" --key "$KEY" | jq -c ".[]" | wc -l)
if [ $CACHE_HIT -gt 0 ]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Cache Docker images.
id: cache
if: ${{ steps.check_cache.outputs.exists == 'false' }}
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # 5.0.1
with:
path: ./docker-cache
key: kurtosis-docker-${{ runner.os }}-${{ inputs.kurtosis_version }}
- name: "Generate dummy kurtosis config"
if: ${{ steps.check_cache.outputs.exists == 'false' }}
shell: bash
run: |
mkdir -p ./temp
echo "{\"participants\": []}" > ./temp/test-network.yaml
- name: Run kurtosis testnet for cache warmup
if: ${{ steps.check_cache.outputs.exists == 'false' }}
continue-on-error: true
id: testnet
uses: ethpandaops/kurtosis-assertoor-github-action@f64942cbc780df731a731ea9f45765b161d2c8df # v1.0.1
with:
kurtosis_extra_args: "--image-download always --non-blocking-tasks --verbosity DETAILED"
kurtosis_backend: docker
kurtosis_version: ${{ inputs.kurtosis_version }}
ethereum_package_url: github.com/pk910/kurtosis-dummy-pkg
ethereum_package_branch: main
ethereum_package_args: "./temp/test-network.yaml"
enclave_name: "assertoor-warmup"
await_assertoor_tests: "false"
enclave_dump: "false"
- name: "Cache docker images"
if: ${{ steps.check_cache.outputs.exists == 'false' }}
run: |
if [ ! -d ./docker-cache ]; then
mkdir -p ./docker-cache
fi
docker_images=$(docker image list --format '{{ if ne .Repository "<none>" }}{{ .Repository }}{{ if ne .Tag "<none>" }}:{{ .Tag }}{{ end }}{{ else }}{{ .ID }}{{ end }}' | tr '\n' ' ')
docker save --output ./docker-cache/docker-images.tar $docker_images