-
Notifications
You must be signed in to change notification settings - Fork 2
/
update-only.sh
executable file
·64 lines (56 loc) · 3.41 KB
/
update-only.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
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -eu
export TIMEOUT=${TIMEOUT:-3600}
export POLLING=${POLLING:-5}
[[ -n "${ROUTER_IP_ENVVAR:-}" && -n "${CF_SYSTEM_DOMAIN:-}" ]] && {
echo "Setting up /etc/hosts to *.${CF_SYSTEM_DOMAIN}..."
eval "export router_ip=\"\$$ROUTER_IP_ENVVAR\"" # works on alpine
{
echo "${router_ip} login.${CF_SYSTEM_DOMAIN}"
echo "${router_ip} api.${CF_SYSTEM_DOMAIN}"
echo "${router_ip} uaa.${CF_SYSTEM_DOMAIN}"
} >> /etc/hosts
}
cf target
# cf update-buildpack -s cflinuxfs3 --enable go_buildpack -p https://github.com/cloudfoundry/go-buildpack/releases/download/v1.9.0/go-buildpack-cflinuxfs3-v1.9.0.zip
# cf update-buildpack -s cflinuxfs3 --enable ruby_buildpack -p https://github.com/cloudfoundry/ruby-buildpack/releases/download/v1.7.43/ruby-buildpack-cflinuxfs3-v1.7.43.zip
# cf update-buildpack -s cflinuxfs3 --enable java_buildpack -p https://github.com/cloudfoundry/java-buildpack/releases/download/v4.21/java-buildpack-v4.21.zip
cflinuxfs3_buildpacks=$(cat <<-JSON
{
"binary_buildpack": "https://github.com/cloudfoundry/binary-buildpack/releases/download/v1.1.0/binary-buildpack-cflinuxfs3-v1.1.0.zip",
"dotnet_core_buildpack": "https://github.com/cloudfoundry/dotnet-core-buildpack/releases/download/v2.4.6/dotnet-core-buildpack-cflinuxfs3-v2.4.6.zip",
"go_buildpack": "https://github.com/cloudfoundry/go-buildpack/releases/download/v1.10.3/go-buildpack-cflinuxfs3-v1.10.3.zip",
"java_buildpack": "https://github.com/cloudfoundry/java-buildpack/releases/download/v4.54/java-buildpack-v4.54.zip",
"nginx_buildpack": "https://github.com/cloudfoundry/nginx-buildpack/releases/download/v1.1.46/nginx-buildpack-cflinuxfs3-v1.1.46.zip",
"nodejs_buildpack": "https://github.com/cloudfoundry/nodejs-buildpack/releases/download/v1.8.5/nodejs-buildpack-cflinuxfs3-v1.8.5.zip",
"php_buildpack": "https://github.com/cloudfoundry/php-buildpack/releases/download/v4.5.1/php-buildpack-cflinuxfs3-v4.5.1.zip",
"python_buildpack": "https://github.com/cloudfoundry/python-buildpack/releases/download/v1.8.4/python-buildpack-cflinuxfs3-v1.8.4.zip",
"r_buildpack": "https://github.com/cloudfoundry/r-buildpack/releases/download/v1.1.37/r-buildpack-cflinuxfs3-v1.1.37.zip",
"ruby_buildpack": "https://github.com/cloudfoundry/ruby-buildpack/releases/download/v1.9.1/ruby-buildpack-cflinuxfs3-v1.9.1.zip",
"staticfile_buildpack": "https://github.com/cloudfoundry/staticfile-buildpack/releases/download/v1.5.37/staticfile-buildpack-cflinuxfs3-v1.5.37.zip",
"ignore_me": "so all other items can end with comma"
}
JSON
)
function cfbuildpacks() {
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ -f $DIR/fixtures/cf-buildpacks.out ]]; then
cat $DIR/fixtures/cf-buildpacks.out
else
cf buildpacks
fi
}
echo "Checking for cflinuxfs3 updates..."
buildpack_names=$(echo "${cflinuxfs3_buildpacks}" | jq -r "keys | .[]")
for buildpack_name in $buildpack_names; do
current_filename=$(cfbuildpacks | grep $buildpack_name | awk '{print $5}')
if [[ -n $current_filename ]]; then
new_buildpack_url=$(echo "$cflinuxfs3_buildpacks" | jq -r --arg buildpack_name $buildpack_name '.[$buildpack_name]')
new_buildpack_filename=$(basename $new_buildpack_url)
if [[ "$current_filename" != "$new_buildpack_filename" ]]; then
echo "Updating $buildpack_name $current_filename -> $new_buildpack_filename"
cf update-buildpack -s cflinuxfs3 --enable "$buildpack_name" -p "$new_buildpack_url"
fi
fi
done
echo "Success."