mirror of
https://github.com/tektoncd/catalog.git
synced 2024-11-25 06:17:50 +00:00
Github Enterprise support for github tasks
(cherry picked from commit 5e71cc4e71
)
This commit is contained in:
parent
f7e9510582
commit
61bd4641ab
@ -5,7 +5,7 @@ API](https://developer.github.com/v3/).
|
||||
|
||||
## GitHub token
|
||||
|
||||
Most tasks would expect to have a secret set in the kubernetes secret `github-secret`
|
||||
Most tasks would expect to have a secret set in the kubernetes secret `github`
|
||||
with a GitHub token in the key `token`, you can easily create it on the
|
||||
command line with `kubectl` like this :
|
||||
|
||||
@ -32,6 +32,7 @@ kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/githu
|
||||
|
||||
* **REPO_FULL_NAME:**: The GitHub repository full name, _e.g:_ `tektoncd/catalog`
|
||||
* **GITHUB_HOST_URL:**: The GitHub host domain _default:_ `api.github.com`
|
||||
* **API_PATH_PREFIX:**: The GitHub Enterprise has a prefix for the API path. _e.g:_ `/api/v3`
|
||||
* **SHA:**: The commit SHA to set the status for _e.g_: `tektoncd/catalog`
|
||||
* **TARGET_URL:**: The target URL to associate with this status. This URL will
|
||||
be linked from the GitHub UI to allow users to easily see the source of the
|
||||
@ -87,6 +88,7 @@ kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/githu
|
||||
### Parameters
|
||||
|
||||
* **GITHUB_HOST_URL:**: The GitHub host domain (_default:_ `api.github.com`)
|
||||
* **API_PATH_PREFIX:**: The GitHub Enterprise has a prefix for the API path. _e.g:_ `/api/v3`
|
||||
* **REQUEST_URL:**: The GitHub pull request or issue url, _e.g:_
|
||||
`https://github.com/tektoncd/catalog/issues/46`
|
||||
* **COMMENT:**: The actual comment to add _e.g:_ `don't forget to eat your vegetables before commiting.`.
|
||||
@ -136,6 +138,7 @@ kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/githu
|
||||
### Parameters
|
||||
|
||||
* **GITHUB_HOST_URL:**: The GitHub host domain (_default:_ `api.github.com`)
|
||||
* **API_PATH_PREFIX:**: The GitHub Enterprise has a prefix for the API path. _e.g:_ `/api/v3`
|
||||
* **REQUEST_URL:**: The GitHub pull request or issue url, (_e.g:_
|
||||
`https://github.com/tektoncd/catalog/issues/46`)
|
||||
|
||||
|
@ -11,13 +11,24 @@ spec:
|
||||
description: |
|
||||
The GitHub host, adjust this if you run a GitHub enteprise.
|
||||
default: "api.github.com"
|
||||
type: string
|
||||
|
||||
- name: API_PATH_PREFIX
|
||||
description: |
|
||||
The API path prefix, GitHub Enterprise has a prefix e.g. /api/v3
|
||||
default: ""
|
||||
type: string
|
||||
|
||||
- name: REQUEST_URL
|
||||
description: |
|
||||
The GitHub issue or pull request URL where we want to add a new
|
||||
comment.
|
||||
type: string
|
||||
|
||||
- name: COMMENT
|
||||
description: |
|
||||
The actual comment to add.
|
||||
type: string
|
||||
steps:
|
||||
- name: add-comment
|
||||
env:
|
||||
@ -40,7 +51,7 @@ spec:
|
||||
|
||||
# This will convert https://github.com/foo/bar/pull/202 to
|
||||
# api url path /repos/foo/issues/202
|
||||
api_url = "/repos/" + "/".join(split_url[1:3]) + \
|
||||
api_url = "$(params.API_PATH_PREFIX)" + "/repos/" + "/".join(split_url[1:3]) + \
|
||||
"/issues/" + split_url[-1]
|
||||
|
||||
# Trying to avoid quotes issue as much as possible by using triple
|
||||
|
@ -11,10 +11,19 @@ spec:
|
||||
description: |
|
||||
The GitHub host, adjust this if you run a GitHub enteprise.
|
||||
default: "api.github.com"
|
||||
type: string
|
||||
|
||||
- name: API_PATH_PREFIX
|
||||
description: |
|
||||
The API path prefix, GitHub Enterprise has a prefix e.g. /api/v3
|
||||
default: ""
|
||||
type: string
|
||||
|
||||
- name: REQUEST_URL
|
||||
description: |
|
||||
The GitHub issue or pull request URL where we want to add a new
|
||||
comment.
|
||||
type: string
|
||||
steps:
|
||||
- name: close-issue
|
||||
env:
|
||||
@ -37,7 +46,7 @@ spec:
|
||||
|
||||
# This will convert https://github.com/foo/bar/pull/202 to
|
||||
# api url path /repos/foo/issues/202
|
||||
api_url = "/repos/" + "/".join(split_url[1:3]) + \
|
||||
api_url = "$(params.API_PATH_PREFIX)" + "/repos/" + "/".join(split_url[1:3]) + \
|
||||
"/issues/" + split_url[-1]
|
||||
|
||||
# Trying to avoid quotes issue as much as possible by using triple
|
||||
|
@ -12,29 +12,48 @@ spec:
|
||||
description: |
|
||||
The GitHub host, adjust this if you run a GitHub enteprise.
|
||||
default: "api.github.com"
|
||||
type: string
|
||||
|
||||
- name: API_PATH_PREFIX
|
||||
description: |
|
||||
The API path prefix, GitHub Enterprise has a prefix e.g. /api/v3
|
||||
default: ""
|
||||
type: string
|
||||
|
||||
- name: REPO_FULL_NAME
|
||||
description: |
|
||||
The GitHub repository full name, i.e: tektoncd/catalog
|
||||
type: string
|
||||
|
||||
- name: SHA
|
||||
description: |
|
||||
Commit SHA to set the status for.
|
||||
type: string
|
||||
|
||||
- name: TARGET_URL
|
||||
description: |
|
||||
The target URL to associate with this status. This URL will be linked
|
||||
from the GitHub UI to allow users to easily see the source of the
|
||||
status.
|
||||
type: string
|
||||
|
||||
- name: DESCRIPTION
|
||||
description: |
|
||||
A short description of the status.
|
||||
type: string
|
||||
|
||||
- name: CONTEXT
|
||||
description: |
|
||||
The GitHub context, A string label to differentiate this status from
|
||||
the status of other systems. ie: "continuous-integration/tekton"
|
||||
default: "continuous-integration/tekton"
|
||||
type: string
|
||||
|
||||
- name: STATE
|
||||
description: |
|
||||
The state of the status. Can be one of the following `error`,
|
||||
`failure`, `pending`, or `success`.
|
||||
type: string
|
||||
steps:
|
||||
- name: set-status
|
||||
env:
|
||||
@ -51,7 +70,7 @@ spec:
|
||||
import os
|
||||
import http.client
|
||||
|
||||
status_url = "/repos/$(params.REPO_FULL_NAME)/" + \
|
||||
status_url = "$(params.API_PATH_PREFIX)" + "/repos/$(params.REPO_FULL_NAME)/" + \
|
||||
"statuses/$(params.SHA)"
|
||||
|
||||
data = {
|
||||
|
Loading…
Reference in New Issue
Block a user