-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
725c473
commit 9e51d97
Showing
32 changed files
with
775 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: A Helm chart for Openshift pipelines using Jenkins | ||
name: ocp-pipeline | ||
version: 0.1.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# This directory was copied from https://github.com/bcgov/helm-charts. | ||
|
||
# ocp-pipeline Helm Chart | ||
|
||
Helm chart to create a pipeline on OCP to use jenkins to deploy another helm chart | ||
|
||
## Chart Details | ||
|
||
This chart will do the following: | ||
|
||
* Deploy A pipeline to deploy another helm chart with jenkins | ||
* Deploy Jenkins if it is not already deployed (OCP does this not this chart) | ||
|
||
## Installing the Chart | ||
|
||
To install the chart with the release name `my-release`: | ||
|
||
```bash | ||
$ helm repo add bcgov https://bcgov.github.io/helm-charts | ||
$ helm install my-release bcgov/ocp-pipeline | ||
``` | ||
|
||
## Configuration | ||
|
||
The following tables list the configurable parameters of the ocp-pipeline chart and their default values. | ||
|
||
|
||
|
||
| Parameter | Description | Default | | ||
| --------------------------------- | ------------------------------------ | ----------------------------------------- | | ||
| `chart.name ` | Name of the chart to deploy | metadata-curator | | ||
| `chart.repo ` | Repo where the chart can be found | http://bcgov.github.io/helm-charts | | ||
| `webhookKey ` | Key to add to the webhook to trigger pipeline | "12345678" | | ||
| `releaseName ` | Helm release name to create/use | mc | | ||
| `releaseNamespace ` | Helm namespace to release to | mc | | ||
| `deployValues ` | Object containing values the helm chart needs | {example: value} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Pipeline deployed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "ocp-pipeline.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "ocp-pipeline.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "ocp-pipeline.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} |
11 changes: 11 additions & 0 deletions
11
api/krusty/charts/ocp-pipeline/templates/deploymentValuesSecret.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ .Release.Name }}-config | ||
labels: | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
type: Opaque | ||
data: | ||
config: '{{ .Values.deployValues | toJson | b64enc }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
apiVersion: build.openshift.io/v1 | ||
kind: BuildConfig | ||
status: | ||
lastVersion: 0 | ||
metadata: | ||
name: {{ template "ocp-pipeline.fullname" . }}-deploy | ||
#have to set this | ||
namespace: {{ .Values.tillerNamespace }} | ||
labels: | ||
app: {{ template "ocp-pipeline.name" . }} | ||
chart: {{ template "ocp-pipeline.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
spec: | ||
nodeSelector: {} | ||
resources: | ||
requests: | ||
cpu: 2000m | ||
memory: 4G | ||
limits: | ||
cpu: 4000m | ||
memory: 8G | ||
triggers: | ||
- type: "generic" | ||
generic: | ||
allowEnv: true | ||
secretReference: | ||
name: "{{ .Release.Name }}-git-webhook-secret" | ||
strategy: | ||
type: JenkinsPipeline | ||
jenkinsPipelineStrategy: | ||
jenkinsfile: |- | ||
def helmName = "helm-v3.1.0-linux-amd64.tar.gz" | ||
def chartName = "{{ .Values.chart.name }}" | ||
def chartRepo = "{{ .Values.chart.repo }}" | ||
def releaseName = "{{ .Values.releaseName }}" | ||
def releaseNamespace = "{{ .Values.releaseNamespace }}" | ||
def forceRecreate = "{{ lower .Values.forceRecreate }}" | ||
def callAnotherPipe = "{{ lower .Values.callAnotherPipe.enabled }}" | ||
def useEnv = "{{ lower .Values.recreate.useEnv }}" | ||
def fromEnv = "{{ .Values.recreate.fromEnv }}" | ||
def setFlag = "{{ .Values.recreate.setFlag }}" | ||
node("nodejs") { | ||
stage("deploy (it's already built)") { | ||
sh """ | ||
curl -L -O https://get.helm.sh/${helmName} | ||
tar -zxvf ${helmName} | ||
cd linux-amd64 | ||
curl -L -O https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux32 | ||
chmod ugo+x ./jq-linux32 | ||
npm install -g json2yaml | ||
export CONF1=`oc get secret {{ .Release.Name }}-config -o json | ./jq-linux32 .data.config` | ||
export CONF2=`sed -e 's/^"//' -e 's/"\$//' <<<"\$CONF1"` | ||
export CONF3=`echo \$CONF2 | base64 -d -` | ||
export CONF=`echo \$CONF3 | json2yaml` | ||
echo "\$CONF" > ./config.yaml | ||
oc project ${releaseNamespace} | ||
./helm repo add chart ${chartRepo} | ||
./helm repo update | ||
if [ "${forceRecreate}" = "true" ]; then | ||
./helm upgrade ${releaseName} chart/${chartName} -f ./config.yaml --install --set hashLabel="${releaseName}\$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1)" | ||
elif [ "${useEnv}" = "true" ]; then | ||
./helm upgrade ${releaseName} chart/${chartName} -f ./config.yaml --install --set ${setFlag}=${env[fromEnv]} | ||
else | ||
./helm upgrade ${releaseName} chart/${chartName} -f ./config.yaml --install | ||
fi | ||
if [ "${callAnotherPipe}" = "true" ]; then | ||
curl -d '' {{ .Values.callAnotherPipe.url }} | ||
fi | ||
""" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
api/krusty/charts/ocp-pipeline/templates/oc-gitWebhookSecret.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ .Release.Name }}-git-webhook-secret | ||
labels: | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
type: Opaque | ||
data: | ||
WebHookSecretKey: {{ .Values.webhookKey | b64enc }} |
Oops, something went wrong.