forked from netbootxyz/netboot.xyz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_release
executable file
·82 lines (76 loc) · 2.38 KB
/
build_release
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
set -e
TYPE=$1
HARD_RELEASE="2.x"
HARD_RC="2.x-RC"
DEV_URL="dev.boot.netboot.xyz"
STAGING_URL="staging.boot.netboot.xyz"
PROD_URL="boot.netboot.xyz"
NBXYZ_OVERRIDES=production
# Set boot domain
if [[ "${TYPE}" == "dev" ]]; then
BOOT_DOMAIN="s3.amazonaws.com/${DEV_URL}/${GITHUB_SHA}"
BOOT_VERSION="${GITHUB_SHA}"
elif [[ "${TYPE}" == "pr" ]]; then
BOOT_DOMAIN="test.com"
BOOT_VERSION="test"
NBXYZ_OVERRIDES=default
elif [[ "${TYPE}" == "rc" ]]; then
BOOT_VERSION=$(cat version.txt)-RC
BOOT_DOMAIN="${STAGING_URL}/${BOOT_VERSION}"
elif [[ "${TYPE}" == "release" ]]; then
BOOT_VERSION=$(cat version.txt)
BOOT_DOMAIN="${PROD_URL}/${BOOT_VERSION}"
elif [[ "${TYPE}" == "rolling" ]]; then
HARD_RELEASE="2.x"
PROD_URL="boot.netboot.xyz"
fi
# build release files
if ! [[ "${TYPE}" == "rolling" ]]; then
sed -i \
"/^# boot_version/c\boot_version: \"${BOOT_VERSION}\"" \
user_overrides.yml
sed -i \
"/^# boot_domain/c\boot_domain: ${BOOT_DOMAIN}" \
user_overrides.yml
# Build release
docker build -t localbuild --build-arg NBXYZ_OVERRIDES=${NBXYZ_OVERRIDES} .
docker run --rm -i -v $(pwd):/buildout localbuild
# Generate folder outputs
mkdir -p s3out
mkdir -p s3outver
cp -r buildout/* s3out/
cp buildout/version.ipxe s3outver/
mkdir -p githubout
mv buildout/ipxe/* githubout/
cd buildout
rm -Rf ipxe
tar -czf menus.tar.gz *
mv menus.tar.gz ../githubout
cd ..
if [[ "${TYPE}" == "dev" ]]; then
cp githubout/menus.tar.gz s3out/
fi
fi
# Latest style endpoints for RC and Live
if [[ "${TYPE}" == "release" ]] || [[ "${TYPE}" == "rolling" ]] || [[ "${TYPE}" == "rc" ]]; then
rm -Rf buildout/
if [[ "${TYPE}" == "release" ]] || [[ "${TYPE}" == "rolling" ]]; then
sed -i \
-e "/^boot_version/c\boot_version: \"${HARD_RELEASE}\"" \
-e "/^boot_domain/c\boot_domain: ${PROD_URL}" \
user_overrides.yml
docker build -t localbuild --build-arg NBXYZ_OVERRIDES=${NBXYZ_OVERRIDES} .
docker run --rm -i -v $(pwd):/buildout localbuild
fi
if [[ "${TYPE}" == "rc" ]]; then
sed -i \
-e "/^boot_version/c\boot_version: \"${HARD_RC}\"" \
-e "/^boot_domain/c\boot_domain: ${STAGING_URL}/rc" \
user_overrides.yml
docker build -t localbuild --build-arg NBXYZ_OVERRIDES=${NBXYZ_OVERRIDES} .
docker run --rm -i -v $(pwd):/buildout localbuild
fi
mkdir -p s3out-latest
cp -r buildout/* s3out-latest/
fi