From 8d9ab47681fdcc9306ad4fec9733637bf581a1a4 Mon Sep 17 00:00:00 2001 From: Ashok Pon Kumar Date: Fri, 29 Oct 2021 20:07:17 +0530 Subject: [PATCH] docs: Remove operator-sdk dependencies and installdeps script (#613) Signed-off-by: Ashok Pon Kumar --- Dockerfile | 2 - Makefile | 6 +- README.md | 1 - USAGE.md | 1 - scripts/installdeps.sh | 173 ----------------------------------------- 5 files changed, 1 insertion(+), 182 deletions(-) delete mode 100755 scripts/installdeps.sh diff --git a/Dockerfile b/Dockerfile index 08d83d9d2..33c039321 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,8 +45,6 @@ RUN cp bin/move2kube /bin/move2kube ### Run image ### FROM registry.access.redhat.com/ubi8/ubi-minimal:latest -RUN curl -o /usr/local/bin/operator-sdk -LJO 'https://github.com/operator-framework/operator-sdk/releases/download/v1.9.0/operator-sdk_linux_amd64' \ - && chmod +x /usr/local/bin/operator-sdk COPY --from=builder /bin/move2kube /bin/move2kube VOLUME ["/workspace"] #"/var/run/docker.sock" needs to be mounted for CNB containerization to use docker diff --git a/Makefile b/Makefile index 362bfd7b7..8542c68f2 100644 --- a/Makefile +++ b/Makefile @@ -103,10 +103,6 @@ get: go.mod generate: go generate ${PKG} -.PHONY: deps -deps: - source scripts/installdeps.sh - # -- Test -- .PHONY: test @@ -166,7 +162,7 @@ else @echo 'Linux: sudo apt-get install upx' endif mkdir -p $(DISTDIR)/files - cp -r ./LICENSE ./scripts/installdeps.sh ./USAGE.md ./samples $(DISTDIR)/files/ + cp -r ./LICENSE ./USAGE.md ./samples $(DISTDIR)/files/ cd $(DISTDIR) && go run ../scripts/dist/builddist.go -b $(BINNAME) -v $(VERSION) .PHONY: clean diff --git a/README.md b/README.md index 0312dfb52..8830aa788 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,6 @@ To browse code [![Open in VSCode](https://open.vscode.dev/badges/open-in-vscode. * Helm charts * Kustomize * OpenShift Templates - * Operator * Docker compose ## Discussion diff --git a/USAGE.md b/USAGE.md index 98268d556..a84d10486 100644 --- a/USAGE.md +++ b/USAGE.md @@ -5,7 +5,6 @@ Move2Kube is a command-line tool that accelerates the process of re-platforming ## Setup 1. Ensure that the move2kube executable is in path. `export PATH=$PATH:$PWD` -1. (Optional) To install dependencies such as `pack`, `kubectl` and `operator-sdk`, invoke `source installdeps.sh`. ## Usage diff --git a/scripts/installdeps.sh b/scripts/installdeps.sh deleted file mode 100755 index 40a7996ac..000000000 --- a/scripts/installdeps.sh +++ /dev/null @@ -1,173 +0,0 @@ -#!/usr/bin/env bash - -# Copyright IBM Corporation 2020 -# -# 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. - -# initOS discovers the operating system for this system. - -[[ $DEBUG ]] || DEBUG='false' - -print_usage() { - echo "Invalid args: $*" - echo 'Usage: installdeps.sh [-y]' - echo 'Use sudo when running in -y quiet mode.' -} - -QUIET=false -if [ "$#" -gt 0 ]; then - if [ "$#" -gt 1 ] || [ "$1" != '-y' ]; then - print_usage "$@" - exit 1 - fi - echo 'Installing without prompting. Script should be run with sudo in order to install docker.' - QUIET=true -fi - -MOVE2KUBE_DEP_INSTALL_PATH="$PWD/bin" - -HAS_DOCKER="$(type docker &>/dev/null && echo true || echo false)" -HAS_PACK="$(type pack &>/dev/null && echo true || echo false)" -HAS_KUBECTL="$(type kubectl &>/dev/null && echo true || echo false)" -HAS_OPERATOR_SDK="$(type operator-sdk &>/dev/null && echo true || echo false)" -if [ "$HAS_OPERATOR_SDK" = 'true' ]; then - if operator-sdk version | cut -d, -f1 | grep 'operator-sdk version: "v1' -q; then - OPERATOR_SDK_V1='true' - else - OPERATOR_SDK_V1='false' - fi -fi - -initOS() { - OS="$(uname | tr '[:upper:]' '[:lower:]')" - - case "$OS" in - # Minimalist GNU for Windows - mingw*) OS='windows' ;; - esac -} - -askBeforeProceeding() { - if [ "${QUIET}" = "true" ]; then - oktoproceed='y' - return 0 - fi - echo 'Move2Kube dependency installation script.' - echo 'The following dependencies will be installed to '"$MOVE2KUBE_DEP_INSTALL_PATH"':' - echo 'docker (only on Linux), pack, kubectl, operator-sdk' - read -r -p 'Proceed? [y/N]:' oktoproceed -} - -askIfWeShouldModifyBashProfile() { - if [ "${QUIET}" = "true" ]; then - oktoaddtobashprofile='y' - return 0 - fi - read -r -p 'Should we add a line to your ~/.bash_profile that will append '"$MOVE2KUBE_DEP_INSTALL_PATH"' to the $PATH? [y/N]:' oktoaddtobashprofile -} - -# fail_trap is executed if an error occurs. -fail_trap() { - result=$? - if [ "$result" != "0" ]; then - echo "Failed to install the dependencies." - echo -e "\tFor support, go to https://github.com/konveyor/move2kube" - fi - exit $result -} - -# MAIN - -#Stop execution on any error -trap "fail_trap" EXIT -set -e -set -u - -# Set debug if desired -if [ "${DEBUG}" = "true" ]; then - set -x -fi - -initOS - -if [ "$OS" = 'darwin' ]; then - PACKPLATFORM='macos' - KUBECTLPLATFORM='darwin' - OPERATORSDKPLATFORM='apple-darwin' - echo 'Once this installation finishes, please do install docker from https://docs.docker.com/docker-for-mac/install/' -elif [ "$OS" = 'linux' ]; then - PACKPLATFORM='linux' - KUBECTLPLATFORM='linux' - OPERATORSDKPLATFORM='linux-gnu' -else - echo 'Unsupported platform:'"$OS"' . Exiting.' - exit 1 -fi - -askBeforeProceeding - -if [ "$oktoproceed" != 'y' ]; then - echo 'Failed to get confirmation. Exiting.' - exit 1 -fi - -mkdir -p "$MOVE2KUBE_DEP_INSTALL_PATH" - -if [ "${HAS_DOCKER}" != 'true' ] && [ "$OS" = 'linux' ]; then - if ! grep -q container_t '/proc/1/attr/current'; then - echo 'Installing docker...' - if [ "${QUIET}" = "true" ]; then - curl -fsSL 'https://get.docker.com' -o 'get-docker.sh' && sh 'get-docker.sh' && rm 'get-docker.sh' - else - curl -fsSL 'https://get.docker.com' -o 'get-docker.sh' && sudo sh 'get-docker.sh' && rm 'get-docker.sh' - fi - echo 'Done.' - fi -fi - -if [ "${HAS_PACK}" != 'true' ]; then - echo 'Installing pack...' - curl -o pack.tgz -LJO 'https://github.com/buildpacks/pack/releases/download/v0.12.0/pack-v0.12.0-'"$PACKPLATFORM"'.tgz' && tar -xzf pack.tgz && mv pack "$MOVE2KUBE_DEP_INSTALL_PATH" && rm pack.tgz - echo 'Done.' -fi - -if [ "${HAS_KUBECTL}" != 'true' ]; then - echo 'Installing kubectl...' - curl -o kubectl -LJO 'https://storage.googleapis.com/kubernetes-release/release/'"$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)"'/bin/'"$KUBECTLPLATFORM"'/amd64/kubectl' && mv kubectl "$MOVE2KUBE_DEP_INSTALL_PATH" - chmod +x "$MOVE2KUBE_DEP_INSTALL_PATH"/kubectl - echo 'Done.' -fi - -if [ "${HAS_OPERATOR_SDK}" != 'true' ] || [ "$OPERATOR_SDK_V1" != 'true' ]; then - echo 'Installing operator-sdk...' - curl -o $MOVE2KUBE_DEP_INSTALL_PATH/operator-sdk -LJO 'https://github.com/operator-framework/operator-sdk/releases/download/v1.3.0/operator-sdk_'"$OPERATORSDKPLATFORM"'_amd64' - chmod +x "$MOVE2KUBE_DEP_INSTALL_PATH"/operator-sdk - echo 'Done.' -fi - -echo 'Installed the dependencies to '"$MOVE2KUBE_DEP_INSTALL_PATH" - -# Check if $MOVE2KUBE_DEP_INSTALL_PATH is already in the $PATH -if [[ :"$PATH": == *:"$MOVE2KUBE_DEP_INSTALL_PATH":* ]]; then - echo "$MOVE2KUBE_DEP_INSTALL_PATH"' is already in $PATH' -else - askIfWeShouldModifyBashProfile - if [ "$oktoaddtobashprofile" != 'y' ]; then - echo 'Failed to get confirmation. Not modifying ~/.bash_profile' - else - echo 'PATH="$PATH:'"$MOVE2KUBE_DEP_INSTALL_PATH"'"' >>~/.bash_profile - echo 'We have added a line to your ~/.bash_profile to put '"$MOVE2KUBE_DEP_INSTALL_PATH"' on your $PATH. Either restart the shell or source ~/.bash_profile to see the changes.' - fi -fi - -echo 'Finished!!'