forked from crc-org/snc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-metadata-generation.sh
51 lines (40 loc) · 1.59 KB
/
test-metadata-generation.sh
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
#!/bin/bash
set -exuo pipefail
source tools.sh
source createdisk-library.sh
source snc-library.sh
MIRROR=${MIRROR:-https://mirror.openshift.com/pub/openshift-v4/$ARCH/clients/ocp}
OPENSHIFT_RELEASE_VERSION="${OPENSHIFT_VERSION-4.7.0}"
CRC_VM_NAME=${CRC_VM_NAME:-crc}
BASE_DOMAIN=${CRC_BASE_DOMAIN:-testing}
VM_PREFIX=${CRC_VM_NAME}-abcde
INTERNAL_IP=192.168.126.11
CRC_ZSTD_EXTRA_FLAGS="--fast"
# Prepare fake directory structure matching create_disk expectations
baseDir="test-metadata-generation"
mkdir $baseDir
cd $baseDir
srcDir=src
destDir=dest
mkdir -p "$srcDir"
mkdir -p "$srcDir/auth"
touch "$srcDir"/auth/kubeconfig
touch id_ecdsa_crc
touch "$srcDir"/vmlinuz-0.0.0
touch "$srcDir"/initramfs-0.0.0.img
echo {} | ${JQ} '.version = "1.2"' \
| ${JQ} '.type = "snc"' \
| ${JQ} ".buildInfo.buildTime = \"$(date -u --iso-8601=seconds)\"" \
| ${JQ} ".buildInfo.openshiftInstallerVersion = \"0.0.0\"" \
| ${JQ} ".buildInfo.sncVersion = \"xxx\"" \
| ${JQ} ".clusterInfo.openshiftVersion = \"${OPENSHIFT_RELEASE_VERSION}\"" \
| ${JQ} ".clusterInfo.clusterName = \"${CRC_VM_NAME}\"" \
| ${JQ} ".clusterInfo.baseDomain = \"${BASE_DOMAIN}\"" \
| ${JQ} ".clusterInfo.appsDomain = \"apps-${CRC_VM_NAME}.${BASE_DOMAIN}\"" >${srcDir}/crc-bundle-info.json
download_oc
mkdir -p "$destDir/linux"
${QEMU_IMG} create -f qcow2 "$destDir/linux/${CRC_VM_NAME}.qcow2" 64M
copy_additional_files "$srcDir" "$destDir/linux"
create_tarball "$destDir/linux"
generate_hyperv_bundle "$destDir/linux" "$destDir/windows"
generate_hyperkit_bundle "$destDir/linux" "$destDir/macos" "$srcDir" "0.0.0" "init=/init/sh"