This commit is contained in:
2024-04-21 14:41:42 +02:00
parent 820eb1d5ae
commit c2c610cf66
2 changed files with 63 additions and 0 deletions

View File

@@ -14,4 +14,47 @@ data "kustomization_overlay" "data" {
namespace = var.namespace namespace = var.namespace
common_labels = local.common-labels common_labels = local.common-labels
resources = [for file in fileset(path.module, "*.yaml"): file if file != "index.yaml"] resources = [for file in fileset(path.module, "*.yaml"): file if file != "index.yaml"]
patches {
target {
kind = "Task"
name = "gitea-set-status"
}
patch = <<-EOF
- op: add
path: /spec/params/0/default
value: gitea-http.${var.domain}-ci.svc:3000
- op: replace
path: /spec/params/1/default
value: http
EOF
}
} }
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: gitea-set-status
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/categories: Git
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: gitea
tekton.dev/displayName: "set gitea status"
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le"
spec:
description: >-
This task will set the status of the CI job to the specified value along
with a link to the specified target URL where developers can follow the
progress of the CI job.
The `gitea-set-status` task allows external services to mark Gitea commits
with an `error`, `failure`, `pending`, or `success` state, which is then
reflected in pull requests involving those commits. Statuses include as well a
`description` and a `target_url`, to give the user informations about the CI
statuses or a direct link to the full log.
params:
- name: GITEA_HOST_URL
description: |
The Gitea host, e.g: git.yourcompany.com. Can include port.
type: string

View File

@@ -67,3 +67,23 @@ resource "gitea_public_key" "ci-user-keys" {
username = gitea_user.user-ci[0].username username = gitea_user.user-ci[0].username
key = data.kubernetes_secret_v1.ci-ssh-creds-read[count.index].data["ssh-publickey"] key = data.kubernetes_secret_v1.ci-ssh-creds-read[count.index].data["ssh-publickey"]
} }
resource "gitea_token" "ci-user-token" {
count = var.haveGitea && var.haveTekton?1:0
username = gitea_user.user-ci[0].username
name = "tekton"
}
resource "kubernetes_secret_v1" "ci-user-token-secret" {
count = var.haveGitea && var.haveTekton?1:0
metadata {
name = "gitea"
namespace = "${var.domain}-ci-${var.instance}"
}
data = {
url = "gitea-http.${var.domain}-ci.svc:3000"
username = gitea_user.user-ci[0].username
token = resource.gitea_token.ci-user-token.token
}
}