diff --git a/deploy/install.sh b/deploy/install.sh index bcce221b..dc70121d 100755 --- a/deploy/install.sh +++ b/deploy/install.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -ue -script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - verbose=false dry_run=false use_local_chart=false @@ -123,8 +121,6 @@ while [ "$#" -gt 0 ]; do *) echo "Unknown parameter passed: $1"; exit 1;; esac; shift; done -cd "${script_dir}" - values_fileS=$(echo "$values_file" | tr "," "\n") values_args=() for valueFile in ${values_fileS}; do diff --git a/docs/installation.adoc b/docs/installation.adoc index 26d48c95..959f1b1e 100644 --- a/docs/installation.adoc +++ b/docs/installation.adoc @@ -31,40 +31,27 @@ Download the template and fill in the values according to the comments in that f [source] ---- -curl -L https://raw.githubusercontent.com/opendevstack/ods-pipeline/master/deploy/values.yaml.tmpl -o values.yaml +curl -fsSL https://raw.githubusercontent.com/opendevstack/ods-pipeline/v0.14.0-preview.1/deploy/values.yaml.tmpl -o values.yaml ---- TIP: It is recommended to keep this file around after the installation so that it can be reused when updating ODS Pipeline to future versions. === Step 2: Running the install script -==== Option 1: With external API access - -If you have access to the OpenShift API from your local machine, simply login to the OpenShift cluster and install ODS Pipeline by running: +Login to the OpenShift cluster in your terminal, then run: [source] ---- -./install.sh -n +curl -fsSL https://raw.githubusercontent.com/opendevstack/ods-pipeline/v0.14.0-preview.1/deploy/install.sh | bash -s -- -n= ---- -The script will interactively ask for credentials (such as Bitbucket access token) and will create corresponding K8s secrets. If you prefer to pass these secrets via flags, see `./install.sh --help` for all options. - -IMPORTANT: If tasks need to trust a private certificate, pass `--private-cert `. This will create a K8s secret containing the certificate from the specified host, which will then be mounted in pods during task runs. +The script will interactively ask for credentials (such as Bitbucket access token) and will create corresponding K8s secrets. If you prefer to pass these secrets via flags, use `--help` to see all options. -TIP: You may pass `--dry-run` to review what `install.sh` will do before actually running the script. +IMPORTANT: If tasks need to trust a private certificate, pass `--private-cert=`. This will create a K8s secret containing the certificate from the specified host, which will then be mounted in pods during task runs. -==== Option 2: Without external API access +TIP: If you want to review the changes first before applying them, supply `--dry-run`. -If you do not have access to the OpenShift API from your local machine, you can use the https://docs.openshift.com/container-platform/latest/web_console/odc-about-web-terminal.html[OpenShift Web Terminal] to install ODS Pipeline. Open a web terminal in your `*-cd` namespace, then run: - -[source] ----- -curl -L https://raw.githubusercontent.com/opendevstack/ods-pipeline/master/scripts/web-terminal-install.sh | bash ----- - -This will install all prerequisites automatically. Then you can clone the repository and run `./install.sh -n `. - -`./install.sh` will interactively ask for credentials (such as Bitbucket access token) and will create corresponding K8s secrets. If you prefer to pass these secrets via flags, see `./install.sh --help` for all options. +TIP: If you do not have access to the OpenShift API from your local machine, you can use the https://docs.openshift.com/container-platform/latest/web_console/odc-about-web-terminal.html[OpenShift Web Terminal]. Open a web terminal in the target namespace and make sure the `values.yaml` file is present in the working directory there. Then run the installation script as described above. Note that you must either install the `helm-diff` plugin using `helm plugin install https://github.com/databus23/helm-diff --version "v3.3.2"` beforehand or supply `--no-diff` when running the install script. === Step 3: Exposing a route to the pipeline manager @@ -86,32 +73,21 @@ The update procedure consists of two quick steps: === Step 1: Updating the chart values -Check if any new values have been introduced in `values.yaml.tmpl` and update your `values.yaml` (which you hopefully retained from the installation) accordingly. +Ensure that the `values.yaml` file you used during installation is located in the working directory. Then check if any new values have been introduced in link:https://raw.githubusercontent.com/opendevstack/ods-pipeline/v0.14.0-preview.1/deploy/values.yaml.tmpl[`values.yaml.tmpl`] and update `values.yaml` accordingly. -=== Step 2: Running the install script +TIP: If you cannot find the `values.yaml` file from the installation, create it again using the values found in the current Helm installation. -==== Option 1: With external API access +=== Step 2: Running the install script -If you have access to the OpenShift API from your local machine, you can simply login to the OpenShift cluster in your terminal, then update the ODS Pipeline installation by running: +Login to the OpenShift cluster in your terminal, then run: [source] ---- -./install.sh -n +curl -fsSL https://raw.githubusercontent.com/opendevstack/ods-pipeline/v0.14.0-preview.1/deploy/install.sh | bash -s -- -n= ---- -TIP: You may also use `--dry-run` to see the changes first. - -TIP: By default, the credentials stored in the K8s secrets will not be updated. If you want to make a change, pass any new values as flags to `install.sh` (see `./install.sh --help` for all options) or update the secrets manually. - -==== Option 2: Without external API access - -If you do not have access to the OpenShift API from your local machine, you can use the https://docs.openshift.com/container-platform/latest/web_console/odc-about-web-terminal.html[OpenShift Web Terminal] to install ODS Pipeline. Open a web terminal in your `*-cd` namespace, then run: - -[source] ----- -curl -L https://raw.githubusercontent.com/opendevstack/ods-pipeline/master/scripts/web-terminal-install.sh | bash ----- +TIP: If you want to review the changes first before applying them, supply `--dry-run`. -This will install all prerequisites automatically and update your ODS Pipeline installation to the latest state of your Git repository. +TIP: By default, the credentials stored in the K8s secrets will not be updated. If you want to make a change, pass any new values as flags to the install script (supply `--help` to see all options) or update the secrets manually. -TIP: The credentials stored in the K8s secrets will not be updated. If you need to change those, update them manually. +TIP: If you do not have access to the OpenShift API from your local machine, you can use the https://docs.openshift.com/container-platform/latest/web_console/odc-about-web-terminal.html[OpenShift Web Terminal]. Open a web terminal in the target namespace and make sure the `values.yaml` file is present in the working directory there. Then run the installation script as described above. Note that you must either install the `helm-diff` plugin using `helm plugin install https://github.com/databus23/helm-diff --version "v3.3.2"` beforehand or supply `--no-diff` when running the install script. diff --git a/scripts/web-terminal-install.sh b/scripts/web-terminal-install.sh deleted file mode 100755 index dbd0bac5..00000000 --- a/scripts/web-terminal-install.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -set -eu - -HELM_PLUGIN_DIFF_VERSION=3.3.2 -REPOSITORY="" -NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace) - -while [ "$#" -gt 0 ]; do - # shellcheck disable=SC2034 - case $1 in - - -v|--verbose) VERBOSE="true";; - - -r|--repository) REPOSITORY="$2"; shift;; - -r=*|--repository=*) REPOSITORY="${1#*=}";; - - *) echo "Unknown parameter passed: $1"; exit 1;; -esac; shift; done - -echo "Extending PATH to user-writable location ..." -mkdir -p bin -export PATH=/home/user/bin:$PATH - -echo "Installing Helm plugins ..." -NO_DIFF_FLAG="" -if [ "$(helm plugin list | grep ^diff)" != "" ]; then - echo "Plugin helm-diff is already installed." -else - if command -v tar; then - helm plugin install https://github.com/databus23/helm-diff --version "v${HELM_PLUGIN_DIFF_VERSION}" - else - NO_DIFF_FLAG="--no-diff" - fi -fi - -echo "Cloning Git repository ..." -if oc -n "${NAMESPACE}" get secrets/ods-bitbucket-auth &> /dev/null; then - repoBase=$(oc -n "${NAMESPACE}" get configmaps/ods-bitbucket -o jsonpath='{.data.repoBase}') - authToken=$(oc -n "${NAMESPACE}" get secrets/ods-bitbucket-auth -o jsonpath='{.data.password}' | base64 --decode) - if [ -z "${REPOSITORY}" ]; then - REPOSITORY="${repoBase}/${NAMESPACE%-cd}/${NAMESPACE}.git" - fi - repoName="${REPOSITORY##*/}" - rm -rf "${repoName%.git}" || true - git clone -c http.extraHeader="Authorization: Bearer ${authToken}" "${REPOSITORY}" -else - echo 'No secret ods-bitbucket-auth found.' - echo 'Most likely, there is no ODS Pipeline installation yet.' - echo 'Clone the Git repository and run install.sh manually.' - exit 1 -fi - -echo "Installing ..." -repoName="${REPOSITORY##*/}" -cd "${repoName%.git}/deploy" -./install.sh -n "${NAMESPACE}" ${NO_DIFF_FLAG}