@@ -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
+ with :
46
+ path : installer
47
+ key : installer-${{ env.crc_version}}-${{ runner.arch }}
48
+
49
+ - name : Cache for bundle
50
+ if : ${{ inputs.cache == 'true' }}
51
+ uses : actions/cache@v4
52
+ with :
53
+ with :
54
+ path : ~/.crc/cache
55
+ key : bundle-${{ inputs.preset}}-${{ env.crc_version }}-${{ runner.arch }}
56
+
30
57
- name : Download CRC
31
58
shell : bash
32
59
run : |
@@ -36,20 +63,26 @@ runs:
36
63
CRC_ARCH="amd64"
37
64
fi
38
65
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
66
+ mkdir -p installer
67
+ pushd installer
68
+ if [ ! -f crc-linux.tar.xz ]; then
69
+ echo "Downloading $URL"
70
+ curl -H user-agent:crc-github-action -L "$URL" -o crc-linux.tar.xz --max-time 300 --fail
71
+ SHA256SUM=$(curl -H user-agent:crc-github-action -L "${URL}".sha256 --fail)
72
+ echo "Expected sha256: $SHA256SUM"
73
+ echo "Actual sha256: $(sha256sum crc-linux.tar.xz)"
74
+ echo "$SHA256SUM crc-linux.tar.xz" | sha256sum -c
75
+ fi
45
76
tar -C /tmp -xvf crc-linux.tar.xz
46
77
sudo mv /tmp/crc-linux-*-amd64/crc /usr/bin
78
+
47
79
- name : Install required virtualization software
48
80
shell : bash
49
81
run : |
50
82
sudo apt-get update
51
83
sudo apt install qemu-kvm libvirt-daemon libvirt-daemon-system
52
84
sudo usermod -a -G libvirt $USER
85
+
53
86
- name : Remove unwanted stuff to free up disk image
54
87
shell : bash
55
88
run : |
63
96
64
97
sudo swapoff -a
65
98
sudo rm -f /mnt/swapfile
99
+
66
100
- name : Set the crc config
67
101
shell : bash
68
102
env :
@@ -85,15 +119,18 @@ runs:
85
119
echo "Using disk: ${{ inputs['disk'] }}"
86
120
crc config set disk-size ${{ inputs['disk'] }}
87
121
fi
122
+
88
123
- name : Setup and Start the crc
89
124
shell : bash
90
125
run : |
91
126
sudo -su $USER crc setup
92
127
sudo -su $USER crc start
93
128
sleep 60
129
+
94
130
- name : Copy OpenShift client
95
131
shell : bash
96
132
run : sudo cp /home/$USER/.crc/bin/oc/oc /usr/bin/
133
+
97
134
- name : Copy the kubeconfig file to required location
98
135
shell : bash
99
136
run : |
0 commit comments