-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild_opal_bundle.sh
executable file
·44 lines (39 loc) · 1.47 KB
/
build_opal_bundle.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
#!/bin/bash
set -e
# Check if PDP_VANILLA is set to true from command line argument
if [ "$PDP_VANILLA" == "true" ]; then
echo "Building for pdp-vanilla environment."
fi
# Check if permit-opa directory already exists
if [ ! -d "../permit-opa" ]; then
# Clone the permit-opa repository into the parent directory if it doesn't exist
git clone [email protected]:permitio/permit-opa.git ../permit-opa
else
echo "permit-opa directory already exists. Skipping clone operation."
fi
# Check if factdb directory already exists
if [ ! -d "../factdb" ]; then
# Clone the permit-opa repository into the parent directory if it doesn't exist
git clone [email protected]:permitio/datasync.git ../factdb
else
echo "factdb directory already exists. Skipping clone operation."
fi
# Conditionally execute the custom OPA tarball creation section based on the value of PDP_VANILLA
if [ "$PDP_VANILLA" != "true" ]; then
# Custom OPA tarball creation section
rm -rf custom
mkdir custom
build_root="$PWD"
cd "../permit-opa"
find * \( -name '*go*' -o -name 'LICENSE.md' \) -print0 | xargs -0 tar -czf "$build_root"/custom/custom_opa.tar.gz --exclude '.*'
cd "$build_root"
# factdb tarball creation section
rm -rf factdb
mkdir factdb
build_root="$PWD"
cd "../factdb"
find * \( -name '*go*' -o -name 'LICENSE.md' \) -print0 | xargs -0 tar -czf "$build_root"/factdb/factdb.tar.gz --exclude '.*'
cd "$build_root"
else
echo "Skipping custom OPA tarball creation for pdp-vanilla environment."
fi