Skip to content

Commit

Permalink
Merge pull request #153 from engelmi/update-envtest-setup-for-ci
Browse files Browse the repository at this point in the history
update envtest setup for CI
  • Loading branch information
eslutsky committed Jul 19, 2022
2 parents b1e43c7 + 87caa1f commit 4461df8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ Functional (or integration) tests for the `cluster-api-provider-ovirt` are based

The necessary tooling can be fetched and installed via
```bash
./hack/fetch-envtest-tools.sh
mv ./hack/kubebuilder /usr/local/
export PATH=$PATH:/usr/local/kubebuilder/bin
sh ./hack/envtest-tools.sh && fetch_tools && setup_env
```

Functional (or integration) tests are marked with the build tag
Expand Down
24 changes: 24 additions & 0 deletions hack/envtest-tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

function fetch_tools {
k8s_version="${ENVTEST_K8S_VERSION:-1.21.2}"
goarch="$(go env GOARCH)"
goos="$(go env GOOS)"

if [[ "$goos" != "linux" && "$goos" != "darwin" ]]; then
echo "OS '$goos' not supported. Aborting." >&2
return 1
fi

envtest_tools_archive_name="kubebuilder-tools-$k8s_version-$goos-$goarch.tar.gz"
envtest_tools_download_url="https://storage.googleapis.com/kubebuilder-tools/$envtest_tools_archive_name"

curl -L ${envtest_tools_download_url} -o ./hack/${envtest_tools_archive_name}
tar -C "./hack" -zxvf "./hack/$envtest_tools_archive_name"
rm "./hack/$envtest_tools_archive_name"
}

function setup_env {
mv ./hack/kubebuilder /usr/local/
export PATH=$PATH:/usr/local/kubebuilder/bin
}
17 changes: 0 additions & 17 deletions hack/fetch-envtest-tools.sh

This file was deleted.

7 changes: 7 additions & 0 deletions hack/setup-ci-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -o nounset
set -o errexit
set -o pipefail

source ./hack/envtest-tools.sh && fetch_tools && setup_env

0 comments on commit 4461df8

Please sign in to comment.