Skip to content

Commit

Permalink
hack/ci: remove scripts that are not ci specific
Browse files Browse the repository at this point in the history
some of the files we had under `hack/ci` were not really just CI
specific - they could be run locally, and have no dependency on a CI at
all, like `e2e.sh` which has been very useful for running the end to end
example that we have to completion even locally.

aside from the removals, this commit adds the `install-binaries` script
that allows us to, with a call to it, install binaries that are relavant
to CI, and assumes that it is running in a CI environment (e.g., see use
of `sudo`).

usage:
	./hack/ci/install-binaries.sh <dependency>

e.g., to install `ko` and `kuttl`:

	./hack/ci/install-binaries.sh ko kuttl

(if you're wondering why make it so that it takes args: this way we can
look at a github workflow and not exactly what is being installed, as
well as let us not install things we don't need in certain workflows,
like how a `validation` workflow would certainly not need the `gh` cli).

Signed-off-by: Ciro S. Costa <ciroscosta@vmware.com>
  • Loading branch information
Ciro S. Costa committed Sep 20, 2021
1 parent ecd66c5 commit c960a95
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 363 deletions.
40 changes: 0 additions & 40 deletions hack/ci/create-release.sh

This file was deleted.

45 changes: 0 additions & 45 deletions hack/ci/docker-login.sh

This file was deleted.

221 changes: 0 additions & 221 deletions hack/ci/e2e.sh

This file was deleted.

77 changes: 77 additions & 0 deletions hack/ci/install-binaries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
# Copyright 2021 VMware
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

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

readonly KO_VERSION=0.8.1
readonly KUBERNETES_VERSION=1.19.2
readonly KUTTL_VERSION=0.11.1
readonly GH_VERSION=2.0.0

main() {
cd $(mktemp -d)

for binary in $@; do
case $binary in
ko)
install_ko
;;
kubebuilder)
install_kubebuilder
;;
kuttl)
install_kuttl
;;
gh)
install_gh
;;
*) ;;
esac
done

}

install_ko() {
local url=https://github.com/google/ko/releases/download/v${KO_VERSION}/ko_${KO_VERSION}_Linux_x86_64.tar.gz

curl -sSL $url | tar -xzf -
sudo install -m 0755 ./ko /usr/local/bin
}

install_kubebuilder() {
local url=https://storage.googleapis.com/kubebuilder-tools/kubebuilder-tools-${KUBERNETES_VERSION}-linux-amd64.tar.gz

curl -sSL $url | tar xzf -
sudo mv ./kubebuilder /usr/local
sudo chown -R $(whoami) /usr/local/kubebuilder
}

install_kuttl() {
local url=https://github.com/kudobuilder/kuttl/releases/download/v${KUTTL_VERSION}/kubectl-kuttl_${KUTTL_VERSION}_linux_x86_64

curl -sSL -o kubectl-kuttl $url
sudo install -m 0755 ./kubectl-kuttl /usr/local/bin
}

install_gh() {
local url=https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz

curl -sSL $url | tar xzf - --strip-components=1
sudo mv ./bin/gh /usr/local/bin
}

main "$@"
Loading

0 comments on commit c960a95

Please sign in to comment.