-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_versions.sh
executable file
·74 lines (64 loc) · 2.76 KB
/
update_versions.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
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2021
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
set -o errexit
set -o pipefail
if [[ ${DEBUG:-false} == "true" ]]; then
set -o xtrace
fi
function _get_pip_version {
version=""
attempt_counter=0
max_attempts=5
until [ "$version" ]; do
metadata="$(curl -s "https://pypi.org/pypi/$1/json")"
if [ "$metadata" ]; then
version="$(echo "$metadata" | python -c 'import json,sys;print(json.load(sys.stdin)["info"]["version"])')"
break
elif [ ${attempt_counter} -eq ${max_attempts} ]; then
echo "Max attempts reached"
exit 1
fi
attempt_counter=$((attempt_counter + 1))
sleep $((attempt_counter * 2))
done
echo "${version#*v}"
}
function get_github_latest_release {
version=""
attempt_counter=0
max_attempts=5
until [ "$version" ]; do
url_effective=$(curl -sL -o /dev/null -w '%{url_effective}' "https://github.com/$1/releases/latest")
if [ "$url_effective" ]; then
version="${url_effective##*/}"
break
elif [ ${attempt_counter} -eq ${max_attempts} ]; then
echo "Max attempts reached"
exit 1
fi
attempt_counter=$((attempt_counter + 1))
sleep $((attempt_counter * 2))
done
echo "${version#v}"
}
if ! command -v pip-compile >/dev/null; then
pip install pip-tools
fi
eval "$(curl -fsSL https://raw.githubusercontent.com/electrocucaracha/pkg-mgr_scripts/master/ci/pinned_versions.env)"
sed -i "s/PKG_FLY_VERSION\".*/PKG_FLY_VERSION\"] || \"$PKG_FLY_VERSION\"/g" Vagrantfile
sed -i "s/PKG_FLY_VERSION:-.*/PKG_FLY_VERSION:-$PKG_FLY_VERSION}\" -f helm\/ci\.yml/g" ci/concourse/deploy.sh
sed -i "s|docker.io/concourse/concourse:.*|docker.io/concourse/concourse:$PKG_FLY_VERSION|g" mirror/kind_images.txt
sed -i "s|docker.io/concourse/concourse:.*|docker.io/concourse/concourse:$PKG_FLY_VERSION|g" mirror/krd_images.txt
sed -i "s/devpi-server==.*/devpi-server==$(_get_pip_version devpi-server)/g" mirror/devpi/Dockerfile
sed -i "s/RELENG_TKN_DASHBOARD_VERSION:.*/RELENG_TKN_DASHBOARD_VERSION:-$(get_github_latest_release tektoncd/dashboard)}\/tekton-dashboard-release.yaml\"/g" ci/tekton/deploy.sh
for req_dir in "mirror" "common" "mirror/devpi"; do
pip-compile "$req_dir/requirements.in" \
--output-file "$req_dir/requirements.txt" --upgrade
done