Skip to content

Commit

Permalink
Improve reliability of some scripts to download third party tools (ja…
Browse files Browse the repository at this point in the history
…egertracing#1779)

* Improve reliability of some scripts to download third party tools jaegertracing#1778 jaegertracing#1750

Signed-off-by: Israel Blancas <[email protected]>

* Fix finx kind binary

Signed-off-by: Israel Blancas <[email protected]>
  • Loading branch information
Israel Blancas authored Mar 21, 2022
1 parent 61c23d2 commit 6901a72
Show file tree
Hide file tree
Showing 22 changed files with 240 additions and 124 deletions.
21 changes: 0 additions & 21 deletions .ci/install-gomplate.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .ci/install-kind.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .ci/install-kuttl.sh

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/base-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
jobs:
basic-checks:
runs-on: ubuntu-20.04
env:
USER: jaegertracing
steps:
- name: Set up Go
uses: actions/[email protected]
Expand All @@ -23,10 +25,10 @@ jobs:
uses: actions/checkout@v3

- name: "install kubebuilder"
run: ./hack/install-kubebuilder.sh
run: ./hack/install/install-kubebuilder.sh

- name: "install kustomize"
run: ./hack/install-kustomize.sh
run: ./hack/install/install-kustomize.sh

- name: "basic checks"
run: make install-tools ci
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
env:
USER: jaegertracing
steps:
- uses: actions/checkout@v3
- uses: docker/[email protected]
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
unit-tests:
runs-on: ubuntu-20.04
env:
USER: jaegertracing
steps:
- name: Set up Go
uses: actions/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sdk-scorecard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
- name: "Check out code"
uses: actions/checkout@v3
- name: "Install KIND"
run: ./.ci/install-kind.sh
run: ./hack/install/install-kind.sh
- name: "Install KUTTL"
run: ./.ci/install-kuttl.sh
run: ./hack/install/install-kuttl.sh
- name: "Run Operator-SDK scorecard test"
env:
DOCKER_BUILD_OPTIONS: "--cache-from type=local,src=/tmp/.buildx-cache --cache-to type=local,dest=/tmp/.buildx-cache-new,mode=max --load"
Expand Down
57 changes: 16 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ check:
$(VECHO)[ ! -s "$(FMT_LOG)" ] || (echo "Go fmt, license check, or import ordering failures, run 'make format'" | cat - $(FMT_LOG) && false)

ensure-generate-is-noop: VERSION=$(OPERATOR_VERSION)
ensure-generate-is-noop: USER=jaegertracing
ensure-generate-is-noop: set-image-controller generate bundle
$(VECHO)# on make bundle config/manager/kustomization.yaml includes changes, which should be ignored for the below check
$(VECHO)git restore config/manager/kustomization.yaml
Expand Down Expand Up @@ -332,10 +331,6 @@ CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])

KUSTOMIZE = $(shell pwd)/bin/kustomize
kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])

ENVTEST = $(shell pwd)/bin/setup-envtest
envtest: ## Download envtest-setup locally if necessary.
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
Expand Down Expand Up @@ -442,45 +437,11 @@ release-artifacts: set-image-controller
mkdir -p dist
$(KUSTOMIZE) build config/default -o dist/jaeger-operator.yaml


kuttl:
ifeq (, $(shell which kubectl-kuttl))
echo ${PATH}
ls -l /usr/local/bin
which kubectl-kuttl

@{ \
set -e ;\
echo "" ;\
echo "ERROR: kuttl not found." ;\
echo "Please check https://kuttl.dev/docs/cli.html for installation instructions and try again." ;\
echo "" ;\
exit 1 ;\
}
else
KUTTL=$(shell which kubectl-kuttl)
endif

# Set the controller image parameters
set-image-controller: manifests kustomize
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}

kind:
ifeq ($(USE_KIND_CLUSTER),true)
ifeq (, $(shell which kind))
@{ \
set -e ;\
echo "" ;\
echo "ERROR: KIND not found." ;\
echo "Please check https://kind.sigs.k8s.io/docs/user/quick-start/#installation for installation instructions and try again." ;\
echo "" ;\
exit 1 ;\
}
else
KIND=$(shell which kind)
endif
endif

.PHONY: tools
tools: kustomize controller-gen operator-sdk

.PHONY: install-tools
Expand All @@ -489,7 +450,21 @@ install-tools: operator-sdk
golang.org/x/lint/golint \
golang.org/x/tools/cmd/goimports \
github.com/securego/gosec/cmd/[email protected]
$(VECHO)./.ci/install-gomplate.sh

.PHONY: kustomize
kustomize:
./hack/install/install-kustomize.sh
$(eval KUSTOMIZE=$(shell echo ${PWD}/bin/kustomize))

.PHONY: kuttl
kuttl:
./hack/install/install-kuttl.sh
$(eval KUTTL=$(shell echo ${PWD}/bin/kubectl-kuttl))

.PHONY: kind
kind:
./hack/install/install-kind.sh
$(eval KIND=$(shell echo ${PWD}/bin/kind))

.PHONY: prepare-release
prepare-release:
Expand Down
24 changes: 12 additions & 12 deletions bundle/manifests/jaeger-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -384,18 +384,6 @@ spec:
name: jaeger-operator
spec:
containers:
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8383/
- --logtostderr=true
- --v=10
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
resources: {}
- args:
- start
- --health-probe-bind-address=:8081
Expand Down Expand Up @@ -444,6 +432,18 @@ spec:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8383/
- --logtostderr=true
- --v=10
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
resources: {}
securityContext:
runAsNonRoot: true
serviceAccountName: jaeger-operator
Expand Down
6 changes: 3 additions & 3 deletions hack/actions/e2e/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ runs:
restore-keys: |
e2e-
- name: "Install KIND"
run: ./.ci/install-kind.sh
run: ./hack/install/install-kind.sh
shell: bash
- name: "Install KUTTL"
run: ./.ci/install-kuttl.sh
run: ./hack/install/install-kuttl.sh
shell: bash
- name: "Install gomplate"
run: ./.ci/install-gomplate.sh
run: ./hack/install/install-gomplate.sh
shell: bash
- name: "Install dependencies"
run: make install-tools
Expand Down
7 changes: 0 additions & 7 deletions hack/install-kubebuilder.sh

This file was deleted.

4 changes: 0 additions & 4 deletions hack/install-kustomize.sh

This file was deleted.

11 changes: 11 additions & 0 deletions hack/install/install-gomplate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
VERSION="3.10.0"

current_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $current_dir/install-utils.sh

PROGRAM="gomplate"

url="https://github.com/hairyhenderson/gomplate/releases/download/v${VERSION}/gomplate_$(go env GOOS)-amd64-slim"

download $PROGRAM $VERSION $url
11 changes: 11 additions & 0 deletions hack/install/install-kind.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
VERSION="0.11.1"

current_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $current_dir/install-utils.sh

PROGRAM="kind"

url="https://kind.sigs.k8s.io/dl/v$VERSION/kind-$(go env GOOS)-amd64"

download $PROGRAM $VERSION $url
21 changes: 21 additions & 0 deletions hack/install/install-kubebuilder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
VERSION="2.3.1"

current_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $current_dir/install-utils.sh

PROGRAM="kubebuilder"

create_bin

check_tool "$BIN/$PROGRAM" $VERSION "version"

url="https://github.com/kubernetes-sigs/kubebuilder/releases/download/v$VERSION/kubebuilder_${VERSION}_$(go env GOOS)_amd64.tar.gz"

tar_file="/tmp/kubebuilder.tar.gz"
retry "curl -sLo $tar_file $url"
tar -xzf $tar_file -C /tmp/

cp /tmp/kubebuilder_${VERSION}_$(go env GOOS)_amd64/bin/* $BIN/

export PATH=$PATH:$BIN
19 changes: 19 additions & 0 deletions hack/install/install-kustomize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
VERSION="4.2.0"

current_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $current_dir/install-utils.sh

PROGRAM="kustomize"

create_bin

check_tool "$BIN/$PROGRAM" $VERSION "version"

url="https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${VERSION}/kustomize_v${VERSION}_$(go env GOOS)_amd64.tar.gz"

tar_file="/tmp/kustomize.tar.gz"
retry "curl -sLo $tar_file $url"
tar -xzf $tar_file -C $BIN

export PATH=$PATH:$BIN
11 changes: 11 additions & 0 deletions hack/install/install-kuttl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
VERSION="0.11.1"

current_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $current_dir/install-utils.sh

PROGRAM="kubectl-kuttl"

url="https://github.com/kudobuilder/kuttl/releases/download/v$VERSION/kubectl-kuttl_${VERSION}_$(go env GOOS)_x86_64"

download $PROGRAM $VERSION $url
Loading

0 comments on commit 6901a72

Please sign in to comment.