Support gogs git server for oc pipeline
csantanapr opened this issue · 0 comments
csantanapr commented
We are planning on using gogs git server for Cloud Native Toolkit and we need to update the IGC cli to support gogs
There are two parts.
- Creating the git webhook programmatically into gogs server
- Creating Tekton Trigger Artifacts to handle the payload from gogs git webhook
Gogs webhook API
https://github.com/gogs/docs-api/blob/master/Repositories/Webhooks.md#create-a-hook
Tekton Trigger changes
oc edit triggerbindings.triggers.tekton.dev template-go-gin
To update both gitrevision
and gitrepositoryurl
apiVersion: triggers.tekton.dev/v1alpha1
kind: TriggerBinding
metadata:
labels:
app: template-go-gin
name: template-go-gin
spec:
params:
- name: gitrevision
value: $(body.after)
- name: gitrepositoryurl
value: $(body.repository.clone_url)
Edit Event listener
To update the header match filter: header.match('X-Gogs-Event', 'push') && body.ref == 'refs/heads/master'
apiVersion: triggers.tekton.dev/v1alpha1
kind: EventListener
metadata:
labels:
app: template-go-gin
name: template-go-gin
namespace: user1-dev
spec:
serviceAccountName: pipeline
triggers:
- name: template-go-gin
bindings:
- kind: TriggerBinding
name: template-go-gin
template:
name: template-go-gin
interceptors:
- cel:
filter: header.match('X-Gogs-Event', 'push') && body.ref == 'refs/heads/master'