Skip to content

Commit 455de4c

Browse files
committed
add script to create dummy data for tests
1 parent 5d9cc10 commit 455de4c

File tree

1 file changed

+77
-17
lines changed

1 file changed

+77
-17
lines changed

test-data/build-test-data.sh

Lines changed: 77 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,86 @@
11
#!/bin/bash
2-
3-
2+
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
43
echo "This will take a while. Building for the following targets:"
54

6-
test_targets=("aws-gardener_prod" "azure-gardener_prod" "gcp-gardener_prod" "openstack-gardener_prod" "openstackbaremetal-gardener_prod" "metal-kvm_dev")
7-
#test_arch=("arm64", "amd64")
5+
test_targets=(
6+
"aws-gardener_prod"
7+
"azure-gardener_prod"
8+
"gcp-gardener_prod"
9+
"openstack-gardener_prod"
10+
"openstackbaremetal-gardener_prod"
11+
"metal-kvm_dev"
12+
)
813
test_arch=("amd64")
14+
pushd $script_dir/gardenlinux
15+
commit=$(git rev-parse --short=8 HEAD)
16+
popd
17+
fake_artifacts=(
18+
"aws-gardener_prod-today-amd64-$commit.raw"
19+
"aws-gardener_prod-today-arm64-$commit.raw"
20+
"aws-gardener_prod-today-amd64-$commit.tar"
21+
"aws-gardener_prod-today-arm64-$commit.tar"
22+
"gcp-gardener_prod-today-amd64-$commit.tar.gz"
23+
"gcp-gardener_prod-today-arm64-$commit.tar.gz"
24+
"gcp-gardener_prod-today-amd64-$commit.gcpimage.tar.gz"
25+
"gcp-gardener_prod-today-arm64-$commit.gcpimage.tar.gz"
26+
"azure-gardener_prod-today-amd64-$commit.vhd"
27+
"azure-gardener_prod-today-arm64-$commit.vhd"
28+
"azure-gardener_prod-today-amd64-$commit.tar"
29+
"azure-gardener_prod-today-arm64-$commit.tar"
30+
"openstack-gardener_prod-today-amd64-$commit.qcow2"
31+
"openstack-gardener_prod-today-arm64-$commit.qcow2"
32+
"openstack-gardener_prod-today-amd64-$commit.vmdk"
33+
"openstack-gardener_prod-today-arm64-$commit.vmdk"
34+
"openstack-gardener_prod-today-amd64-$commit.tar"
35+
"openstack-gardener_prod-today-arm64-$commit.tar"
36+
"openstackbaremetal-gardener_prod-today-amd64-$commit.raw"
37+
"openstackbaremetal-gardener_prod-today-arm64-$commit.raw"
38+
"openstackbaremetal-gardener_prod-today-amd64-$commit.tar"
39+
"openstackbaremetal-gardener_prod-today-arm64-$commit.tar"
40+
"openstackbaremetal-gardener_prod-today-amd64-$commit.qcow2"
41+
"openstackbaremetal-gardener_prod-today-arm64-$commit.qcow2"
42+
"openstackbaremetal-gardener_prod-today-amd64-$commit.vmdk"
43+
"openstackbaremetal-gardener_prod-today-arm64-$commit.vmdk"
44+
"metal-kvm_dev-today-amd64-$commit.raw"
45+
"metal-kvm_dev-today-arm64-$commit.raw"
46+
"metal-kvm_dev-today-amd64-$commit.tar"
47+
"metal-kvm_dev-today-arm64-$commit.tar"
48+
)
949

10-
for target in "${test_targets[@]}"; do
11-
echo "$target (amd64 and arm64)"
12-
done
1350

14-
read -p "Build targets listed above? (y/n): " confirm
15-
if [[ "$confirm" != [yY] ]]; then
16-
exit 1
51+
# Check if the --dummy flag is set
52+
dummy_mode=false
53+
if [[ "$1" == "--dummy" ]]; then
54+
dummy_mode=true
55+
echo "Dummy mode enabled. No actual builds will be performed."
56+
for target in "${test_targets[@]}"; do
57+
echo "$target (amd64 and arm64)"
58+
done
59+
else
60+
read -p "Build targets listed above? (y/n): " confirm
61+
if [[ "$confirm" != [yY] ]]; then
62+
exit 1
63+
fi
1764
fi
1865

19-
pushd gardenlinux
20-
for target in "${test_targets[@]}"; do
21-
for arch in "${test_arch[@]}"; do
22-
./build "$target-$arch"
23-
done
24-
done
25-
popd
66+
67+
68+
if [ "$dummy_mode" = true ]; then
69+
echo "Creating fake artifacts..."
70+
mkdir -p $script_dir/gardenlinux/.build
71+
for artifact in "${fake_artifacts[@]}"; do
72+
echo "Creating fake artifact: $artifact"
73+
touch "$script_dir/gardenlinux/.build/$artifact" # This simulates creating a fake artifact file
74+
done
75+
echo "Fake artifacts created."
76+
else
77+
pushd $script_dir/gardenlinux
78+
for target in "${test_targets[@]}"; do
79+
for arch in "${test_arch[@]}"; do
80+
echo "Building $target-$arch..."
81+
./build "$target-$arch"
82+
done
83+
done
84+
popd
85+
fi
2686

0 commit comments

Comments
 (0)