Skip to content

Commit a13695f

Browse files
committed
Unbreak the minikube mode of build_local.sh.
Fix the ordering of eval "$(minikube docker-env)" relative to local image builds, which was broken in the process of fixing this script for kind users.
1 parent e7b6616 commit a13695f

File tree

4 files changed

+41
-10
lines changed

4 files changed

+41
-10
lines changed

.github/workflows/test-scripts.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: test-scripts
2+
on:
3+
pull_request:
4+
paths:
5+
- 'scripts/**'
6+
- 'Makefile'
7+
schedule:
8+
- cron: '0 0 * * *' # daily to pick up releases
9+
jobs:
10+
run-local-minikube:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- run: |
15+
curl -sLo minikube "$(curl -sL https://api.github.com/repos/kubernetes/minikube/releases/latest | jq -r '[.assets[] | select(.name == "minikube-linux-amd64")] | first | .browser_download_url')"
16+
chmod +x minikube
17+
sudo mv minikube /bin/
18+
minikube config set vm-driver none
19+
sudo make run-local # vm-driver=none requires root
20+
run-local-kind:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
- run: |
25+
curl -sLo kind "$(curl -sL https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | jq -r '[.assets[] | select(.name == "kind-linux-amd64")] | first | .browser_download_url')"
26+
chmod +x kind
27+
sudo mv kind /bin/
28+
kind create cluster
29+
kind export kubeconfig
30+
make run-local

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ tramp
3232

3333
# cask packages
3434
.cask/
35-
dist/
35+
/dist/
3636

3737
# Flycheck
3838
flycheck_*.el

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ build-linux: clean $(CMDS)
7373
build-wait: clean bin/wait
7474

7575
bin/wait:
76-
GOOS=linux GOARCH=386 go build -o $@ $(PKG)/test/e2e/wait
76+
GOOS=linux GOARCH=386 go build $(MOD_FLAGS) -o $@ $(PKG)/test/e2e/wait
7777

7878
build-util-linux: arch_flags=GOOS=linux GOARCH=386
7979
build-util-linux: build-util

scripts/build_local.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55

66
set -e
77

8+
[ -x "$(command -v kind)" ] && [[ "$(kubectl config current-context)" =~ ^kind-? ]] && KIND=1 NO_MINIKUBE=1
9+
10+
if [ -z "$NO_MINIKUBE" ]; then
11+
pgrep -f "[m]inikube" >/dev/null || minikube start --kubernetes-version="v1.16.2" --extra-config=apiserver.v=4 || { echo 'Cannot start minikube.'; exit 1; }
12+
eval "$(minikube docker-env)" || { echo 'Cannot switch to minikube docker'; exit 1; }
13+
kubectl config use-context minikube
14+
fi
15+
816
docker build -f local.Dockerfile -t quay.io/operator-framework/olm:local -t quay.io/operator-framework/olm-e2e:local ./bin
917
docker build -f test/e2e/hang.Dockerfile -t hang:10 ./bin
1018

11-
if [ -x "$(command -v kind)" ] && [[ "$(kubectl config current-context)" =~ ^kind-? ]]; then
19+
if [ -n "$KIND" ]; then
1220
kind load docker-image quay.io/operator-framework/olm:local
1321
kind load docker-image quay.io/operator-framework/olm-e2e:local
1422
kind load docker-image hang:10
15-
exit 0 # don't bother with minikube if kind is active
16-
fi
17-
18-
if [ -z "$NO_MINIKUBE" ]; then
19-
pgrep -f "[m]inikube" >/dev/null || minikube start --kubernetes-version="v1.16.2" --extra-config=apiserver.v=4 || { echo 'Cannot start minikube.'; exit 1; }
20-
eval "$(minikube docker-env)" || { echo 'Cannot switch to minikube docker'; exit 1; }
21-
kubectl config use-context minikube
2223
fi

0 commit comments

Comments
 (0)