Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit 65a1332

Browse files
author
Michael Sauter
committed
Publish Helm chart to GitHub Pages
Closes #728.
1 parent 06e06c4 commit 65a1332

File tree

3 files changed

+35
-58
lines changed

3 files changed

+35
-58
lines changed

.github/workflows/chart.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release Charts
33
on:
44
push:
55
branches:
6-
- featre/easy-install
6+
- feature/easy-install
77

88
jobs:
99
release:
@@ -21,5 +21,7 @@ jobs:
2121
2222
- name: Run chart-releaser
2323
uses: helm/chart-releaser-action@v1.5.0
24+
with:
25+
charts_dir: deploy
2426
env:
2527
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

deploy/install.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,18 @@ else
257257
installTLSSecret "ods-private-cert" "${private_cert}"
258258
fi
259259

260+
echo "Discovering Helm repository ..."
261+
helm_repo_alias="ods-pipeline"
262+
chart_name="ods-pipeline"
263+
"${helm_bin}" repo add "${helm_repo_alias}" https://opendevstack.github.io/ods-pipeline
264+
"${helm_bin}" repo update "${helm_repo_alias}"
265+
260266
echo "Installing Helm release ${release_name} ..."
261267
if [ "${diff}" == "true" ]; then
262268
if "${helm_bin}" -n "${namespace}" \
263269
diff upgrade --install --detailed-exitcode --three-way-merge --normalize-manifests \
264270
"${values_args[@]}" \
265-
${release_name} ${chart_dir}; then
271+
"${release_name}" "${helm_repo_alias}/${chart_name}"; then
266272
echo "Helm release already up-to-date."
267273
else
268274
if [ "${dry_run}" == "true" ]; then
@@ -281,7 +287,7 @@ else
281287
"${helm_bin}" -n "${namespace}" \
282288
upgrade --install \
283289
"${values_args[@]}" \
284-
${release_name} ${chart_dir}
290+
"${release_name}" "${helm_repo_alias}/${chart_name}"
285291
fi
286292
fi
287293

docs/installation.adoc

Lines changed: 24 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,42 @@ This guide will show how to install ODS Pipeline in an existing ODS project. It
55

66
An ODS Pipeline installation consists of the following resources:
77

8-
* `Task` resources
9-
* `ConfigMap` and `Secret` resources, e.g. holding credentials of centrally installed tools such as Nexus and SonarQube
108
* A pipeline manager, which is creating pipeline runs in response to Bitbucket webhook requests
9+
* A start and finish task which will get injected into every pipeline run
10+
* `ConfigMap` and `Secret` resources, e.g. holding credentials of centrally installed tools such as Nexus and Bitbucket
11+
1112
1213
== Prerequisites
1314

1415
You'll need:
1516

16-
* A namespace in an OpenShift cluster (such as `foo-cd` from an existing ODS project) and a project in Bitbucket (such as `FOO`).
17+
* A namespace in an OpenShift/Kubernetes cluster (such as `foo-cd` from an existing ODS project) and a project in Bitbucket (such as `FOO`).
1718
* `git`, link:https://docs.openshift.com/container-platform/latest/cli_reference/openshift_cli/getting-started-cli.html[`oc`] (or link:https://kubernetes.io/docs/reference/kubectl/[`kubectl`]) and link:https://helm.sh[`helm`] installed locally. The plugin link:https://github.com/databus23/helm-diff[`helm-diff`] is optional but recommended.
1819

1920
== Installation Instructions
2021

21-
The installation procedure consists of two steps:
22-
23-
1. Creating a Git repository defining the configuration of the ODS Pipeline installation
24-
2. Using Helm to install from this Git repository
22+
ODS Pipeline is packaged as a Helm chart. The installation procedure consists of three quick steps:
2523

26-
=== Creating a Git repository
24+
1. Configuring the chart values
25+
2. Running the install script (which will deploy the Helm chart)
26+
3. Exposing a route to the pipeline manager
2727

28-
Create a new repository in Bitbucket, e.g. `foo-cd`. The name can be anything, but since the repository will define the K8s resources of namespace `foo-cd` in code, it makes sense to mirror the namespace name. Clone the repository locally and make an initial commit, e.g. by adding a readme file.
28+
=== Step 1: Configuring the chart values
2929

30-
IMPORTANT: The following commands will fail in an empty Git repository, so make sure you have made at least one commit in this repository.
31-
32-
Now use `git subtree` to get the required source files. The following commands may look a bit complicated, but in a nutshell, they are simply adding one folder (`deploy/`) from the `opendevstack/ods-pipeline` repository at the given revision (e.g. `master`) into your new local repository at the path `deploy`. The benefit of this approach is that it'll make updating ODS Pipeline simple.
30+
Download the template and fill in the values according to the comments in that file.
3331

3432
[source]
3533
----
36-
pipelineGitRef=v0.13.2 # Pick the version you want to install
37-
38-
git fetch --depth=1 https://github.com/opendevstack/ods-pipeline.git $pipelineGitRef:ods-pipeline-$pipelineGitRef && \
39-
git checkout ods-pipeline-$pipelineGitRef && \
40-
git subtree split --prefix=deploy -b subtree-split-branch-$pipelineGitRef && \
41-
git checkout - && \
42-
git subtree add --squash --prefix=deploy subtree-split-branch-$pipelineGitRef
34+
curl -L https://raw.githubusercontent.com/opendevstack/ods-pipeline/master/deploy/values.yaml.tmpl -o values.yaml
4335
----
4436

45-
Once this is done, change to the new folder `deploy` to configure the values of the Helm Chart. Run `cp values.yaml.tmpl values.yaml`, then edit `values.yaml` as described in the comments in that file. Commit and push before proceeding to the next step.
37+
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.
4638

47-
=== Using Helm to install from the Git repository
39+
=== Step 2: Running the install script
4840

4941
==== Option 1: With external API access
5042

51-
If you have access to the OpenShift API from your local machine, you can simply login to the OpenShift cluster, then install ODS Pipeline by running:
43+
If you have access to the OpenShift API from your local machine, simply login to the OpenShift cluster and install ODS Pipeline by running:
5244

5345
[source]
5446
----
@@ -61,8 +53,6 @@ IMPORTANT: If tasks need to trust a private certificate, pass `--private-cert <h
6153

6254
TIP: You may pass `--dry-run` to review what `install.sh` will do before actually running the script.
6355

64-
After you ran the install script, continue with the <<finishing-the-installation,Finishing the installation>> section.
65-
6656
==== Option 2: Without external API access
6757

6858
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:
@@ -72,48 +62,33 @@ If you do not have access to the OpenShift API from your local machine, you can
7262
curl -L https://raw.githubusercontent.com/opendevstack/ods-pipeline/master/scripts/web-terminal-install.sh | bash
7363
----
7464

75-
This will install all prerequisites automatically. Then you can clone the repository and run `./install.sh -n <your_cd_namespace>` in the terminal.
65+
This will install all prerequisites automatically. Then you can clone the repository and run `./install.sh -n <your_cd_namespace>`.
7666

7767
`./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.
7868

79-
After you ran the install script, continue with the <<finishing-the-installation,Finishing the installation>> section.
80-
81-
==== Finishing the installation
69+
=== Step 3: Exposing a route to the pipeline manager
8270

8371
Create an HTTPS route to expose the `ods-pipeline` service. You'll need the exposed URL (together with the webhook secret that is stored in the `ods-bitbucket-webhook` K8s secret) when you create webhooks in Bitbucket repositories later.
8472

73+
Done, now you are ready to link:add-to-repository.adoc[enable your repositories to use ODS pipeline]!
74+
8575
IMPORTANT: The `pipeline` serviceaccount needs `admin` permissions in the Kubernetes namespaces it deploys to (e.g. `foo-dev` and `foo-test`). You must create rolebindings for this manually.
8676

8777
CAUTION: An important feature of ODS Pipeline is to retain pipeline run artifacts in Nexus and re-use them future pipeline runs (e.g. to promote built container images to another environment). For this purpose, you should create a few `raw` repositories in Nexus. These repositories should not allow re-deployment of artifacts. For example, you might want to have `ods-pipeline-dev`, `ods-pipeline-qa` and `ods-pipeline-prod` repositories, each with a different cleanup policy as fitting your needs. You can then use these repositories from your pipeline to store artifacts and enforce a progression of artifacts from DEV > QA > PROD.
8878

89-
Now you are ready to link:add-to-repository.adoc[enable your repositories to use ODS pipeline]!
9079

9180
== Update Instructions
9281

93-
The update procedure consists of two steps:
82+
The update procedure consists of two quick steps:
9483

95-
1. Updating the Git repository defining the configuration of the ODS Pipeline installation
96-
2. Using Helm to install from the Git repository
84+
1. Updating the chart values if required
85+
2. Running the install script (which will deploy the Helm chart)
9786

98-
=== Updating the Git repository
87+
=== Step 1: Updating the chart values
9988

100-
You may fetch updates (e.g. new versions) of `ods-pipeline` like this:
89+
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.
10190

102-
[source]
103-
----
104-
pipelineGitRef=v0.13.2 # Pick the version you want to update to
105-
106-
git branch -D ods-pipeline-$pipelineGitRef subtree-split-branch-$pipelineGitRef || true && \
107-
git fetch --depth=1 https://github.com/opendevstack/ods-pipeline.git $pipelineGitRef:ods-pipeline-$pipelineGitRef && \
108-
git checkout ods-pipeline-$pipelineGitRef && \
109-
git subtree split --prefix=deploy -b subtree-split-branch-$pipelineGitRef && \
110-
git checkout - && \
111-
git subtree merge --prefix=deploy subtree-split-branch-$pipelineGitRef --squash
112-
----
113-
114-
Afterwards, check if any new values have been introduced in `values.yaml.tmpl` and update `values.yaml` accordingly. Commit and push the result.
115-
116-
=== Using Helm to install from the Git repository
91+
=== Step 2: Running the install script
11792

11893
==== Option 1: With external API access
11994

@@ -126,8 +101,6 @@ If you have access to the OpenShift API from your local machine, you can simply
126101

127102
TIP: You may also use `--dry-run` to see the changes first.
128103

129-
After you ran the script, continue with the <<finishing-the-update,Finishing the update>> section.
130-
131104
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.
132105

133106
==== Option 2: Without external API access
@@ -142,7 +115,3 @@ curl -L https://raw.githubusercontent.com/opendevstack/ods-pipeline/master/scrip
142115
This will install all prerequisites automatically and update your ODS Pipeline installation to the latest state of your Git repository.
143116

144117
TIP: The credentials stored in the K8s secrets will not be updated. If you need to change those, update them manually.
145-
146-
==== Finishing the update
147-
148-
Once the resources in your namespace are updated, you likely have to update the `ods.yaml` files in your repository to point to the new tasks, e.g. changing `ods-build-go-v0-12-0` to `ods-build-go-v0-13-2`.

0 commit comments

Comments
 (0)