-
Notifications
You must be signed in to change notification settings - Fork 129
Expand file tree
/
Copy pathfetch-provisioning-tests
More file actions
executable file
·49 lines (34 loc) · 1.42 KB
/
fetch-provisioning-tests
File metadata and controls
executable file
·49 lines (34 loc) · 1.42 KB
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
#!/bin/bash
set -ex
cd $(dirname $0)/..
# Create binary directory for running provisioning tests
mkdir -p "./bin"
BIN_DIR="$(realpath ./bin)"
TMP_DIR=$(mktemp -d)
pushd "$TMP_DIR"
IMAGE_REPO=${IMAGE_REPO:-rancher/rancher}
IMAGE_TAG=${IMAGE_TAG:-v2.12-head}
IMAGE=${IMAGE:-$IMAGE_REPO:$IMAGE_TAG}
# Inspect image, get server version and extract rancher commit
# if [ -n "$RANCHER_COMMIT" ]; then
# RANCHER_COMMIT=$(awk -F '=' '{print $2}' <<< "$CATTLE_SERVER_VERSION")
# case $RANCHER_COMMIT in *-head)
# # If the rancher commit ends with '-head', it is usually of the form 'v2.x-<COMMIT>-head', so extract everything between dashes
# RANCHER_COMMIT=$(awk -F '[-]' '{print $2}' <<< "$RANCHER_COMMIT");;
# esac
# fi
mkdir -p rancher
# Although using the commit so the image matches the source code, use the default branch associated with that release line
# Git clones must have a branch, and the release branch is likely to contain the commit anyway
# GIT_URL=${GIT_URL:-https://github.com/rancher/rancher.git}
# GIT_BRANCH=${GIT_BRANCH:-release/v2.12}
GIT_URL=${GIT_URL:-https://github.com/tashima42/rancher.git}
GIT_BRANCH=${GIT_BRANCH:-remove-unused-build-scripts}
git clone --depth 1 -b $GIT_BRANCH $GIT_URL ./rancher
export RANCHER_DIR=$TMP_DIR/rancher
# Checkout commit image was built on
pushd ./rancher
# git checkout $RANCHER_COMMIT
mkdir -p "$RANCHER_DIR/bin"
cp /usr/bin/rancher "$RANCHER_DIR/bin/rancher"
popd