Skip to content

Commit

Permalink
Merge pull request #223 from chmouel/release-openshift-yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
chmouel authored Sep 16, 2021
2 parents c857af1 + 8ac06fa commit a1c1f04
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .tekton/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ spec:
#!/usr/bin/env bash
set -eu
set +x # Do not show TOKEN in logs
hack/upload-file-to-github.py --message "Release yaml generated from {{repo_url}}/commit/{{revision}}" --branch-ref refs/heads/nightly --owner-repository openshift-pipelines/pipelines-as-code --token ${HUB_TOKEN} -d release.yaml -f <(./hack/generate-releaseyaml.sh)
hack/upload-file-to-github.py --message "Release yaml generated from {{repo_url}}/commit/{{revision}}" --branch-ref refs/heads/nightly --owner-repository openshift-pipelines/pipelines-as-code --token ${HUB_TOKEN} -d release.k8s.yaml -f <(./hack/generate-releaseyaml.sh)
hack/upload-file-to-github.py --message "OpenShift release yaml generated from {{repo_url}}/commit/{{revision}}" --branch-ref refs/heads/nightly --owner-repository openshift-pipelines/pipelines-as-code --token ${HUB_TOKEN} -d release.yaml -f <(env TARGET_OPENSHIFT=true ./hack/generate-releaseyaml.sh)
workingDir: $(workspaces.source.path)
workspaces:
- name: source
Expand Down
9 changes: 8 additions & 1 deletion .tekton/release-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ spec:
--owner-repository openshift-pipelines/pipelines-as-code \
--token ${HUB_TOKEN} \
--from-tag=refs/tags/${TARGET_BRANCH} \
-d release-${TARGET_BRANCH}.yaml -f <(./hack/generate-releaseyaml.sh)
-d release-${TARGET_BRANCH}.k8s.yaml -f <(./hack/generate-releaseyaml.sh)
hack/upload-file-to-github.py \
--message "OpenShift release.yaml generated for Release ${TARGET_BRANCH}" \
--owner-repository openshift-pipelines/pipelines-as-code \
--token ${HUB_TOKEN} \
--from-tag=refs/tags/${TARGET_BRANCH} \
-d release-${TARGET_BRANCH}.yaml -f <(env TARGET_OPENSHIFT=true ./hack/generate-releaseyaml.sh)
exit 0
- name: gorelease
runAfter:
Expand Down
33 changes: 20 additions & 13 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,10 @@ admin namespace `pipelines-as-code`, the roles and all other bits needed.

The `pipelines-as-code` namespace is where the Pipelines-as-Code infrastructure runs and is supposed to be accessible only by the admin.

The Pipelines-as-Code EventListener requires an OpenShift route to be accessible from GitHub. Run the following to create a route:
The Route for the EventListener URL is automatically created when you apply the release.yaml.
You will need to grab the url for the next section when creating the GitHub App. You can run this command to get the route created on your cluster:

```
oc expose service el-pipelines-as-code-interceptor -n pipelines-as-code
```

Enable TLS on the Pipelines-as-Code EventListener:

```
oc apply -n pipelines-as-code -f <(oc get -n pipelines-as-code route el-pipelines-as-code-interceptor -o json |jq -r '.spec |= . + {tls: {"insecureEdgeTerminationPolicy": "Redirect", "termination": "edge"}}')
```

Retrieve the EventListener URL which you will need in the next section when creating the GitHub App:
```
```shell
echo https://$(oc get route -n pipelines-as-code el-pipelines-as-code-interceptor -o jsonpath='{.spec.host}')
```

Expand Down Expand Up @@ -106,3 +96,20 @@ Pipelines as Code supports Github Enterprise.

You don't need to do anything special to get Pipelines as code working with GHE.
Pipelines as code will automatically detects the header as set from GHE and use it the GHE API auth url instead of the public github.

## Kubernetes

Pipelines as Code should work directly on kubernetes/minikube/kind. You just need to install the release.yaml for [pipeline](https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml), [triggers](https://storage.googleapis.com/tekton-releases/triggers/latest/release.yaml) and its [interceptors](https://storage.googleapis.com/tekton-releases/triggers/latest/interceptors.yaml) on your cluster. The release yaml to install pipelines are for the relesaed version :

```shell
VERSION=0.2
kubectl apply -f https://raw.githubusercontent.com/openshift-pipelines/pipelines-as-code/release-$VERSION/release-$VERSION.k8s.yaml
```

and for the nightly :

```shell
kubectl apply -f https://raw.githubusercontent.com/openshift-pipelines/pipelines-as-code/release-$VERSION/release.k8s.yaml
```

Kubernetes Dashboard is not yet supported for logs links but help is always welcome ;)
21 changes: 21 additions & 0 deletions config/openshift/10-routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
labels:
app.kubernetes.io/managed-by: EventListener
app.kubernetes.io/part-of: Triggers
eventlistener: pipelines-as-code-interceptor
name: el-pipelines-as-code-interceptor
namespace: pipelines-as-code
spec:
port:
targetPort: http-listener
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
to:
kind: Service
name: el-pipelines-as-code-interceptor
weight: 100
wildcardPolicy: None
11 changes: 11 additions & 0 deletions hack/generate-releaseyaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -euf
export TARGET_REPO=${TARGET_REPO:-quay.io/openshift-pipeline/pipelines-as-code}
export TARGET_BRANCH=${TARGET_BRANCH:-main}
export TARGET_NAMESPACE=${TARGET_NAMESPACE:-pipelines-as-code}
export TARGET_OPENSHIFT=${TARGET_OPENSHIFT:-""}

MODE=${1:-""}

Expand All @@ -12,11 +13,21 @@ if [[ -n ${MODE} && ${MODE} == ko ]];then
clean() { rm -f ${tmpfile}; }
trap clean EXIT
ko resolve -f config/ > ${tmpfile}

if [[ ${TARGET_OPENSHIFT} != "" ]];then
ko resolve -f config/openshift >> ${tmpfile}
fi

files="${tmpfile}"
else
files=$(find config -maxdepth 1 -name '*.yaml'|sort -n)

if [[ ${TARGET_OPENSHIFT} != "" ]];then
files="${files} $(find config/openshift -maxdepth 1 -name '*.yaml'|sort -n)"
fi
fi


for file in ${files};do
head -1 ${file} | grep -q -- "---" || echo "---"
sed -r -e "s,(.*image:.*)ko://github.com/openshift-pipelines/pipelines-as-code/cmd/.*,\1${TARGET_REPO}:${TARGET_BRANCH}\"," \
Expand Down

0 comments on commit a1c1f04

Please sign in to comment.