forked from openshift-knative/serverless-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-deps.sh
executable file
·74 lines (61 loc) · 1.9 KB
/
update-deps.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
#!/usr/bin/env bash
ROOT_DIR=$(dirname "$0")/..
readonly ROOT_DIR
# shellcheck disable=SC1091,SC1090
source "${ROOT_DIR}/vendor/knative.dev/hack/library.sh"
set -o errexit
set -o nounset
set -o pipefail
cd "${ROOT_DIR}"
# This controls the knative release version we track.
KN_VERSION="release-0.26"
EVENTING_VERSION="release-v0.26"
EVENTING_KAFKA_VERSION="release-v0.26"
SERVING_VERSION="release-v0.26.0"
# The list of dependencies that we track at HEAD and periodically
# float forward in this repository.
FLOATING_DEPS=(
"knative.dev/hack@${KN_VERSION}"
"knative.dev/networking@${KN_VERSION}"
"knative.dev/operator@${KN_VERSION}"
"knative.dev/pkg@${KN_VERSION}"
)
FLOATING_FORK_DEPS=(
"knative.dev/eventing-kafka=github.com/openshift-knative/eventing-kafka@${EVENTING_KAFKA_VERSION}"
"knative.dev/eventing=github.com/openshift/knative-eventing@${EVENTING_VERSION}"
"knative.dev/serving=github.com/openshift/knative-serving@${SERVING_VERSION}"
)
# Parse flags to determine if we need to update our floating deps.
GO_GET=0
while [[ $# -ne 0 ]]; do
parameter=$1
case ${parameter} in
--upgrade) GO_GET=1 ;;
*) abort "unknown option ${parameter}" ;;
esac
shift
done
readonly GO_GET
if (( GO_GET )); then
export GOPROXY="https://proxy.golang.org,direct"
# Treat forks specifically due to https://github.com/golang/go/issues/32721
for dep in "${FLOATING_FORK_DEPS[@]}"; do
go mod edit -replace "${dep}"
# Let the dependency update the magic SHA otherwise the
# following "go mod edit" will fail.
go mod vendor
done
go get -d "${FLOATING_DEPS[@]}"
fi
# Prune modules.
go mod tidy
go mod vendor
# Remove unnecessary files.
find vendor/ \( -name "OWNERS" \
-o -name "OWNERS_ALIASES" \
-o -name "BUILD" \
-o -name "BUILD.bazel" \
-o -name "*_test.go" \) -exec rm -fv {} +
find vendor -type f -name '*.sh' -exec chmod +x {} +
# Apply patches
git apply "${ROOT_DIR}"/hack/patches/*