@@ -18,6 +18,9 @@ inputs:
18
18
disk :
19
19
description : ' disk size consumed by crc instance'
20
20
required : false
21
+ cache :
22
+ description : ' enable cache to speed up cluster starts: true or false (default true). '
23
+ default : ' true'
21
24
runs :
22
25
using : ' composite'
23
26
steps :
27
30
run : |
28
31
echo "::error title=⛔ error hint::Support Linux Only"
29
32
exit 1
33
+
34
+ - name : Set CRC versions
35
+ if : ${{ inputs.cache == 'true' }}
36
+ shell : bash
37
+ run : |
38
+ curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/crc/latest/release-info.json
39
+ echo "crc_version=$(jq -r '.version.crcVersion' release-info.json)" >> "$GITHUB_ENV"
40
+
41
+ - name : Cache for crc binary
42
+ if : ${{ inputs.cache == 'true' }}
43
+ uses : actions/cache@v4
44
+ with :
45
+ path : installer
46
+ key : installer-${{ env.crc_version}}-${{ runner.arch }}
47
+
48
+ - name : Cache for bundle
49
+ if : ${{ inputs.cache == 'true' }}
50
+ uses : actions/cache@v4
51
+ with :
52
+ path : ~/.crc/cache
53
+ key : bundle-${{ inputs.preset}}-${{ env.crc_version }}-${{ runner.arch }}
54
+
30
55
- name : Download CRC
31
56
shell : bash
32
57
run : |
@@ -36,20 +61,26 @@ runs:
36
61
CRC_ARCH="amd64"
37
62
fi
38
63
URL="https://mirror.openshift.com/pub/openshift-v4/clients/crc/latest/crc-linux-${CRC_ARCH}.tar.xz"
39
- echo "Downloading $URL"
40
- curl -H user-agent:crc-github-action -L "$URL" -o crc-linux.tar.xz --max-time 300 --fail
41
- SHA256SUM=$(curl -H user-agent:crc-github-action -L "${URL}".sha256 --fail)
42
- echo "Expected sha256: $SHA256SUM"
43
- echo "Actual sha256: $(sha256sum crc-linux.tar.xz)"
44
- echo "$SHA256SUM crc-linux.tar.xz" | sha256sum -c
64
+ mkdir -p installer
65
+ pushd installer
66
+ if [ ! -f crc-linux.tar.xz ]; then
67
+ echo "Downloading $URL"
68
+ curl -H user-agent:crc-github-action -L "$URL" -o crc-linux.tar.xz --max-time 300 --fail
69
+ SHA256SUM=$(curl -H user-agent:crc-github-action -L "${URL}".sha256 --fail)
70
+ echo "Expected sha256: $SHA256SUM"
71
+ echo "Actual sha256: $(sha256sum crc-linux.tar.xz)"
72
+ echo "$SHA256SUM crc-linux.tar.xz" | sha256sum -c
73
+ fi
45
74
tar -C /tmp -xvf crc-linux.tar.xz
46
75
sudo mv /tmp/crc-linux-*-amd64/crc /usr/bin
76
+
47
77
- name : Install required virtualization software
48
78
shell : bash
49
79
run : |
50
80
sudo apt-get update
51
81
sudo apt install qemu-kvm libvirt-daemon libvirt-daemon-system
52
82
sudo usermod -a -G libvirt $USER
83
+
53
84
- name : Remove unwanted stuff to free up disk image
54
85
shell : bash
55
86
run : |
63
94
64
95
sudo swapoff -a
65
96
sudo rm -f /mnt/swapfile
97
+
66
98
- name : Set the crc config
67
99
shell : bash
68
100
env :
@@ -85,15 +117,18 @@ runs:
85
117
echo "Using disk: ${{ inputs['disk'] }}"
86
118
crc config set disk-size ${{ inputs['disk'] }}
87
119
fi
120
+
88
121
- name : Setup and Start the crc
89
122
shell : bash
90
123
run : |
91
124
sudo -su $USER crc setup
92
125
sudo -su $USER crc start
93
126
sleep 60
127
+
94
128
- name : Copy OpenShift client
95
129
shell : bash
96
130
run : sudo cp /home/$USER/.crc/bin/oc/oc /usr/bin/
131
+
97
132
- name : Copy the kubeconfig file to required location
98
133
shell : bash
99
134
run : |
0 commit comments