Knative - GitLab Source 【九】
GitLab Source

一、示例说明
#示例环境说明
◼ 一个部署可用的GitLab服务
◼ GitLab服务上隶于某个用户(例如root)的代码仓库(例如myproject)
◼ 负责接收CloudEvents的kservice/event-display
#测试步骤
◼ 部署GitLab
◼ GitLab上的操作
◆为GitLab用户设置Personal Access Token
◆准备示例仓库myproject
◼ 在Knative上部署GitLabSource
◼ 在Knative上部署KService/event-display
◼ 创建Secret资源,包含两个数据项
◆GitLab上的Personal Access Token
◆GitLab调用GitLabSource与Webhook Secret
◼ 创建GitLabSource资源
◆从GitLab仓库加载事件
◆将事件转为CloudEvents,并发往Sink
#部署GitLab,并完成如下几项管理设定
◼ 通用→可见性:设定“自定义HTTP(S)协议Git克隆URL”
◼ 网络→外发请求:设定“Allow requests to the local network from web hooks and services”
◼ 创建示例仓库,以myproject为例
创建Personal Access Token(简单起见,直接以root为例)
◼ 个人设定 → 偏好设置 → 访问令牌(必须是api scope)
二、部署K8S GitLab 服务 及 配置GitLab基本配置
2.1 部署K8S GitLab 服务
# 部署的文件 https://github.com/iKubernetes/k8s-gitlab.git
#下载镜像
[root@xianchaonode1 ~]# crictl pull redis:6.2.6
[root@xianchaonode1 ~]# crictl pull sameersbn/postgresql:12-20200524
[root@xianchaonode1 ~]# crictl pull sameersbn/gitlab:15.6.0
[root@xianchaonode1 ~]# crictl images list
docker.io/library/redis 6.2.6 3c3da61c4be0f 41.1MB
docker.io/sameersbn/gitlab 15.6.0 5e7277e67488e 1.34GB
docker.io/sameersbn/postgresql 12-20200524 d08b64823adb0 105MB
[root@xianchaomaster1 deploy-gitlab]# ll
total 24
-rw-r--r-- 1 root root 56 Nov 25 2022 01-namespace.yaml
-rw-r--r-- 1 root root 1037 Nov 25 2022 02-redis.yaml
-rw-r--r-- 1 root root 481 Nov 25 2022 03-secret.yaml
-rw-r--r-- 1 root root 1628 Nov 25 2022 04-postgresql.yaml
-rw-r--r-- 1 root root 4371 Nov 25 2022 05-gitlab.yaml
#1.创建 Namespace
[root@xianchaomaster1 deploy-gitlab]# cat 01-namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
name: gitlab
#2.创建redis
[root@xianchaomaster1 deploy-gitlab]# cat 02-redis.yaml
---
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: gitlab
labels:
app: redis
spec:
ports:
- name: redis
port: 6379
targetPort: redis
selector:
app: redis
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
namespace: gitlab
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
name: redis
labels:
app: redis
spec:
containers:
- name: redis
image: redis:6.2.6
ports:
- name: redis
containerPort: 6379
volumeMounts:
- mountPath: /var/lib/redis
name: data
livenessProbe:
exec:
command:
- redis-cli
- ping
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
exec:
command:
- redis-cli
- ping
initialDelaySeconds: 5
timeoutSeconds: 1
volumes:
- name: data
emptyDir: {}
#创建Secret
#db_pass:magedu.com
#db_user:gitlab
#gitlab_root_pass:magedu.com
#gitlab_secrets_db_key_base:lOvSSSps0H2USkAM/Uj8YUFLF8OKnqPhpLnhpn57GkM
#gitlab_secrets_otp_key_base:iVzgMNPZ2n1JFMTKYmQETKyX/uimjJh0LyXEzifNhU4
#gitlab_secrets_secret_key_base:TUE5i7ImpOIPK3zrvBNqTSOTZ27f4dNnzqSWz1zynAY
[root@xianchaomaster1 deploy-gitlab]# cat 03-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: gitlab
namespace: gitlab
data:
db_pass: bWFnZWR1LmNvbQ==
db_user: Z2l0bGFi
gitlab_root_pass: bWFnZWR1LmNvbQ==
# root pass: magedu.com
gitlab_secrets_db_key_base: bE92U1NTcHMwSDJVU2tBTS9VajhZVUZMRjhPS25xUGhwTG5ocG41N0drTQ==
gitlab_secrets_otp_key_base: aVZ6Z01OUFoybjFKRk1US1ltUUVUS3lYL3VpbWpKaDBMeVhFemlmTmhVNA==
gitlab_secrets_secret_key_base: VFVFNWk3SW1wT0lQSzN6cnZCTnFUU09UWjI3ZjRkTm56cVNXejF6eW5BWQ==
type: Opaque
#创建Postgresql
[root@xianchaomaster1 deploy-gitlab]# cat 04-postgresql.yaml
---
apiVersion: v1
kind: Service
metadata:
name: postgresql
namespace: gitlab
labels:
name: postgresql
spec:
ports:
- name: postgres
port: 5432
targetPort: postgres
selector:
app: postgresql
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgresql
namespace: gitlab
spec:
replicas: 1
selector:
matchLabels:
app: postgresql
template:
metadata:
name: postgresql
labels:
app: postgresql
spec:
containers:
- name: postgresql
image: sameersbn/postgresql:12-20200524
env:
- name: DB_USER
valueFrom:
secretKeyRef:
name: gitlab
key: db_user
- name: DB_PASS
valueFrom:
secretKeyRef:
name: gitlab
key: db_pass
- name: DB_NAME
value: gitlab_production
- name: DB_EXTENSION
value: 'pg_trgm,btree_gist'
ports:
- name: postgres
containerPort: 5432
volumeMounts:
- mountPath: /var/lib/postgresql
name: data
livenessProbe:
exec:
command:
- pg_isready
- -h
- localhost
- -U
- postgres
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
exec:
command:
- pg_isready
- -h
- localhost
- -U
- postgres
initialDelaySeconds: 5
timeoutSeconds: 1
volumes:
- name: data
emptyDir: {}
#创建Gitlab
[root@xianchaomaster1 deploy-gitlab]# cat 05-gitlab.yaml
---
## Service
kind: Service
apiVersion: v1
metadata:
name: code
namespace: gitlab
spec:
type: LoadBalancer
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
- name: ssh
protocol: TCP
port: 22
targetPort: 22
selector:
app: gitlab
---
apiVersion: v1
kind: Service
metadata:
name: gitlab
namespace: gitlab
labels:
name: gitlab
spec:
ports:
- name: http
port: 80
targetPort: http
- name: ssh
port: 22
targetPort: ssh
selector:
app: gitlab
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitlab
namespace: gitlab
spec:
replicas: 1
selector:
matchLabels:
app: gitlab
template:
metadata:
name: gitlab
labels:
app: gitlab
spec:
containers:
- name: gitlab
image: sameersbn/gitlab:15.6.0
env:
- name: TZ
value: Asia/Shanghai
- name: GITLAB_TIMEZONE
value: Asia/Shanghai
- name: GITLAB_SECRETS_DB_KEY_BASE
# Be used to encrypt CI secret variables, as well as import credentials, in the database.
valueFrom:
secretKeyRef:
name: gitlab
key: gitlab_secrets_db_key_base
- name: GITLAB_SECRETS_SECRET_KEY_BASE
# Be used for password reset links, and other 'standard' auth features.
valueFrom:
secretKeyRef:
name: gitlab
key: gitlab_secrets_secret_key_base
- name: GITLAB_SECRETS_OTP_KEY_BASE
# Be used to encrypt 2FA secrets in the database. "long-and-random-alpha-numeric-string"
valueFrom:
secretKeyRef:
name: gitlab
key: gitlab_secrets_otp_key_base
- name: GITLAB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: gitlab
key: gitlab_root_pass
- name: GITLAB_ROOT_EMAIL
value: mage@magedu.com
- name: GITLAB_HOST
value: gitlab.gitlab.svc.cluster.local
- name: GITLAB_PORT
value: "80"
- name: GITLAB_SSH_PORT
value: "22"
- name: GITLAB_NOTIFY_ON_BROKEN_BUILDS
value: "true"
- name: GITLAB_NOTIFY_PUSHER
value: "false"
- name: GITLAB_BACKUP_SCHEDULE
value: daily
- name: GITLAB_BACKUP_TIME
value: 01:00
- name: DB_TYPE
value: postgres
- name: DB_HOST
value: postgresql
- name: DB_PORT
value: "5432"
- name: DB_USER
valueFrom:
secretKeyRef:
name: gitlab
key: db_user
- name: DB_PASS
valueFrom:
secretKeyRef:
name: gitlab
key: db_pass
- name: DB_NAME
value: gitlab_production
- name: REDIS_HOST
value: redis
- name: REDIS_PORT
value: "6379"
- name: SMTP_ENABLED
value: "false"
- name: SMTP_DOMAIN
value: magedu.com
- name: SMTP_HOST
value: smtp.gmail.com
- name: SMTP_PORT
value: "587"
- name: SMTP_USER
value: mailer@magedu.com
- name: SMTP_PASS
value: password
- name: SMTP_STARTTLS
value: "true"
- name: SMTP_AUTHENTICATION
value: login
- name: IMAP_ENABLED
value: "false"
- name: IMAP_HOST
value: imap.gmail.com
- name: IMAP_PORT
value: "993"
- name: IMAP_USER
value: mailer@magedu.com
- name: IMAP_PASS
value: password
- name: IMAP_SSL
value: "true"
- name: IMAP_STARTTLS
value: "false"
ports:
- name: http
containerPort: 80
- name: ssh
containerPort: 22
volumeMounts:
- mountPath: /home/git/data
name: data
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 180
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
timeoutSeconds: 1
volumes:
- name: data
emptyDir: {}
[root@xianchaomaster1 deploy-gitlab]# kubectl apply -f ./
namespace/gitlab created
service/redis created
deployment.apps/redis created
secret/gitlab created
service/postgresql created
deployment.apps/postgresql created
service/code created
service/gitlab created
deployment.apps/gitlab created
[root@xianchaomaster1 deploy-gitlab]# kubectl get ns
NAME STATUS AGE
default Active 11d
event-demo Active 78m
gitlab Active 9s
istio-system Active 35h
knative-eventing Active 6h50m
knative-serving Active 36h
kube-node-lease Active 11d
kube-public Active 11d
kube-system Active 11d
[root@xianchaomaster1 deploy-gitlab]# kubectl get pods -n gitlab
NAME READY STATUS RESTARTS AGE
gitlab-77f96766bb-dvnmt 1/1 Running 0 18s
postgresql-5bcbbc99b7-zq6jf 1/1 Running 0 18s
redis-7f8d87b86c-vfwgz 1/1 Running 0 18s
#查看日志
[root@ca-k8s-master01 deploy-gitlab]# kubectl logs -f gitlab-77f96766bb-dvnmt -n gitlab
2024-01-16 12:05:44,352 INFO success: gitaly entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-01-16 12:05:44,352 INFO success: puma entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-01-16 12:05:44,352 INFO success: gitlab-workhorse entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-01-16 12:05:44,352 INFO success: sidekiq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-01-16 12:05:44,352 INFO success: sshd entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-01-16 12:05:44,352 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-01-16 12:05:44,352 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
[root@xianchaomaster1 deploy-gitlab]# kubectl get svc -n gitlab
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
code LoadBalancer 10.96.189.195 <pending> 80:30480/TCP,22:30735/TCP 26s
gitlab ClusterIP 10.96.244.253 <none> 80/TCP,22/TCP 26s
postgresql ClusterIP 10.96.73.133 <none> 5432/TCP 26s
redis ClusterIP 10.96.121.163 <none> 6379/TCP 26s
#使用Istio 开放
[root@xianchaomaster1 istio]# ll
total 12
-rw-r--r-- 1 root root 182 Nov 25 2022 destinationrule-gitlab.yaml
-rw-r--r-- 1 root root 306 Nov 25 2022 gateway-gitlab.yaml
-rw-r--r-- 1 root root 366 Jul 6 23:44 virtualservice-gitlab.yaml
[root@xianchaomaster1 istio]# cat gateway-gitlab.yaml
---
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: gitlab-gateway
namespace: istio-system
spec:
selector:
app: istio-ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "gitlab.magedu.com"
- "code.magedu.com"
- "gitlab.sheca.cn"
---
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# kubectl get gw -n istio-system
NAME AGE
gitlab-gateway 70m
[root@xianchaomaster1 istio]# cat virtualservice-gitlab.yaml
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: gitlab-virtualservice
namespace: gitlab
spec:
hosts:
- "gitlab.magedu.com"
- "code.magedu.com"
- "gitlab.sheca.cn"
gateways:
- istio-system/gitlab-gateway
http:
- match:
- uri:
prefix: /
route:
- destination:
host: code
port:
number: 80
---
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# kubectl get vs -n gitlab
NAME GATEWAYS HOSTS AGE
gitlab-virtualservice ["istio-system/gitlab-gateway"] ["gitlab.magedu.com","code.magedu.com"] 70m
[root@xianchaomaster1 istio]# cat destinationrule-gitlab.yaml
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: gitlab
namespace: gitlab
spec:
host: gitlab
trafficPolicy:
tls:
mode: DISABLE
---
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# kubectl get destinationrule -n gitlab
NAME HOST AGE
gitlab gitlab 71m
[root@xianchaomaster1 istio]# kubectl apply -f ./
destinationrule.networking.istio.io/gitlab created
gateway.networking.istio.io/gitlab-gateway created
virtualservice.networking.istio.io/gitlab-virtualservice created
[root@xianchaomaster1 istio]# kubectl get svc -n istio-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
istio-ingressgateway LoadBalancer 10.96.196.211 192.168.40.190 15021:30508/TCP,80:30590/TCP,443:30796/TCP 35h
istiod ClusterIP 10.96.53.240 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP 35h
knative-local-gateway ClusterIP 10.96.27.221 <none> 80/TCP 35h
#Windoes服务器 配置hosts文件
#C:\Windows\System32\drivers\etc\hosts
#code.magedu.com gitlab.magedu.com 解析为 192.168.40.190
192.168.40.190 code.magedu.com gitlab.magedu.com gitlab.sheca.cn
#浏览器访问
http://gitlab.sheca.cn/
账户密码:root/magedu.com
#注意
#实验过程中 有时候可以访问到 但有时访问不到 2024-01-16 发现问题 由于域名设置名字问题 可以改为 gitlab.sheca.cn 其他的作为测试
#[其他办法]
#通过 修改svc 改为Nodeport 进行访问
[root@xianchaomaster1 02-s2i-push-to-dockerhub]# kubectl edit svc code -n gitlab
type: NodePort
[root@xianchaomaster1 02-s2i-push-to-dockerhub]# kubectl get svc -n gitlab |grep code
code NodePort 10.110.158.21 <none> 80:30503/TCP,22:31734/TCP 9h
192.168.40.180:30503 可以访问到Gitlab服务
2.2 登陆GitLab root/magedu.com

2.3 配置网络


2.4 勾选 出站请求 允许来自webhooks的服务对本地网络的请求

2.5 自定义HTTP(S)协议Git克隆URL


2.6 创建空白项目

2.7 创建Personal Access Token 设置令牌
个人设定-偏好设置-访问令牌(必须十api scope)


#root user access token : glpat-FKCbkdDn5F62Qs1nysA_
三、部署GitLabSource
#部署GitLabSource
◼ 在knative-sandbox/eventing-gitlab仓库中定位到合适的版本,而后利用其release的配置文件即可完成部署
◆kubectl apply -f https://github.com/knative-sandbox/eventing-gitlab/releases/download/knative-v1.2.0/gitlab.yaml
◼ 相关资源部署于knative-sources名称空间,主要生成两个Deployment
◆gitlab-controller-manager
◆gitlab-webhook
#部署KService/event-display作为Sink
◼ kn service apply event-display --image ikubernetes/event_display --port 8080 -n event-demo
创建Secret资源
#查看官方文档 - Knative Evening支持的 其他 事件源
https://knative.dev/docs/eventing/sources/#knative-sources
#GitLab GitHub地址
https://github.com/knative-sandbox/eventing-gitlab/releases
【Knative Eventing Gitlab release v1.7.0】
https://github.com/knative-sandbox/eventing-gitlab/releases/download/knative-v1.7.0/gitlab.yaml
#下载gitlab.yaml
#修改镜像名称
gcr.io/knative-releases/knative.dev/eventing-gitlab/cmd/controller@sha256:ba76d0666a4ead7d51812bc2e7d229402b0300c618586812cded7a07809dffe4
gcr.io/knative-releases/knative.dev/eventing-gitlab/cmd/webhook@sha256:da454c6e1630ce94324edef6f69398769233032bfd50c6a02c14b5d1ccc706f6
gcr.io/knative-releases/knative.dev/eventing-gitlab/cmd/receive_adapter@sha256:fa79df20fefe51e9752a4a9587c8e58a400511925489813cdb7ea55c090d4fec
改为
gcr.lank8s.cn/knative-releases/knative.dev/eventing-gitlab/cmd/controller@sha256:ba76d0666a4ead7d51812bc2e7d229402b0300c618586812cded7a07809dffe4
gcr.lank8s.cn/knative-releases/knative.dev/eventing-gitlab/cmd/webhook@sha256:da454c6e1630ce94324edef6f69398769233032bfd50c6a02c14b5d1ccc706f6
gcr.lank8s.cn/knative-releases/knative.dev/eventing-gitlab/cmd/receive_adapter@sha256:fa79df20fefe51e9752a4a9587c8e58a400511925489813cdb7ea55c090d4fec
[root@xianchaonode1 ~]# crictl pull gcr.lank8s.cn/knative-releases/knative.dev/eventing-gitlab/cmd/controller@sha256:ba76d0666a4ead7d51812bc2e7d229402b0300c618586812cded7a07809dffe4
[root@xianchaonode1 ~]# crictl pull gcr.lank8s.cn/knative-releases/knative.dev/eventing-gitlab/cmd/webhook@sha256:da454c6e1630ce94324edef6f69398769233032bfd50c6a02c14b5d1ccc706f6
[root@xianchaonode1 ~]# crictl pull gcr.lank8s.cn/knative-releases/knative.dev/eventing-gitlab/cmd/receive_adapter@sha256:fa79df20fefe51e9752a4a9587c8e58a400511925489813cdb7ea55c090d4fec
[root@xianchaonode1 ~]# crictl images list | grep gitlab
W0706 23:28:35.179224 111695 util_unix.go:103] Using "/run/containerd/containerd.sock" as endpoint is deprecated, please consider using full url format "unix:///run/containerd/containerd.sock".
gcr.lank8s.cn/knative-releases/knative.dev/eventing-gitlab/cmd/controller <none> 0239a63dab3b0 16.2MB
gcr.lank8s.cn/knative-releases/knative.dev/eventing-gitlab/cmd/receive_adapter <none> c77f72fa08bae 15.4MB
gcr.lank8s.cn/knative-releases/knative.dev/eventing-gitlab/cmd/webhook <none> 198fc34bde77d 15.5MB
[root@xianchaomaster1 KnativeSrc]# kubectl apply -f gitlab.yaml
namespace/knative-sources created
serviceaccount/gitlab-controller-manager created
serviceaccount/gitlab-webhook created
clusterrole.rbac.authorization.k8s.io/gitlabsource-manager-role created
clusterrole.rbac.authorization.k8s.io/eventing-contrib-gitlab-source-observer created
clusterrolebinding.rbac.authorization.k8s.io/gitlabsource-manager-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/eventing-sources-gitlab-addressable-resolver created
clusterrolebinding.rbac.authorization.k8s.io/eventing-sources-gitlab-webhook created
clusterrole.rbac.authorization.k8s.io/gitlab-webhook created
customresourcedefinition.apiextensions.k8s.io/gitlabbindings.bindings.knative.dev created
customresourcedefinition.apiextensions.k8s.io/gitlabsources.sources.knative.dev created
service/gitlab-controller-manager-service created
deployment.apps/gitlab-controller-manager created
mutatingwebhookconfiguration.admissionregistration.k8s.io/defaulting.webhook.gitlab.sources.knative.dev created
validatingwebhookconfiguration.admissionregistration.k8s.io/validation.webhook.gitlab.sources.knative.dev created
mutatingwebhookconfiguration.admissionregistration.k8s.io/gitlabbindings.webhook.gitlab.sources.knative.dev created
secret/gitlab-webhook-certs created
service/gitlab-webhook created
deployment.apps/gitlab-webhook created
#新创建一个命名空间knative-sources
[root@xianchaomaster1 KnativeSrc]# kubectl get ns
NAME STATUS AGE
default Active 11d
event-demo Active 113m
gitlab Active 35m
istio-system Active 36h
knative-eventing Active 7h26m
knative-serving Active 36h
knative-sources Active 36s
kube-node-lease Active 11d
kube-public Active 11d
kube-system Active 11d
#查看knative-sources pods
[root@xianchaomaster1 KnativeSrc]# kubectl get pods -n knative-sources
NAME READY STATUS RESTARTS AGE
gitlab-controller-manager-859d8dbb79-mbk96 1/1 Running 0 49s
gitlab-webhook-65fff9bd4d-lbvqr 1/1 Running 0 49s
#此时多了一个gitlabsources
[root@xianchaomaster1 KnativeSrc]# kubectl api-resources --api-group=sources.knative.dev
NAME SHORTNAMES APIVERSION NAMESPACED KIND
apiserversources sources.knative.dev/v1 true ApiServerSource
containersources sources.knative.dev/v1 true ContainerSource
gitlabsources sources.knative.dev/v1alpha1 true GitLabSource
pingsources sources.knative.dev/v1 true PingSource
sinkbindings sources.knative.dev/v1 true SinkBinding
3.1 部署GitLabsource资源
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# ll
total 16
-rw-r--r-- 1 root root 64 Oct 22 2022 01-namespace.yaml
-rw-r--r-- 1 root root 329 Oct 22 2022 02-kservice-event-display.yaml
-rw-r--r-- 1 root root 188 Oct 22 2022 03-secret-token.yaml
-rw-r--r-- 1 root root 579 Oct 22 2022 04-GitLabSource-to-knative-service.yaml
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# cat 01-namespace.yaml
kind: Namespace
apiVersion: v1
metadata:
name: event-demo
---
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# cat 02-kservice-event-display.yaml
---
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: event-display
namespace: event-demo
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/min-scale: "1"
spec:
containers:
- image: ikubernetes/event_display
ports:
- containerPort: 8080
#accessToken 为上面保存下来的
root user access token : glpat-U5DjrRPmP6Q-Jg6ruAAN
#secretToken
[root@xianchaonode1 ~]# openssl rand -base64 16
nhcESQKZ9cJg7Q454m1VKw==
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# cat 03-secret-token.yaml
apiVersion: v1
kind: Secret
metadata:
name: gitlabsecret
namespace: event-demo
type: Opaque
stringData:
accessToken: glpat-pvfcCeHySvQJR-cBssSx
secretToken: nhcESQKZ9cJg7Q454m1VKw
#Gitlab 发生事件 push_events、 issues_events、merge_requests_events、tag_push_events 读出来由当前资源出发借助于我们的controller创建的POD转换成
#CE格式 然后注入到并且推送相关事件到Kservice:event-display中
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# cat 04-GitLabSource-to-knative-service.yaml
apiVersion: sources.knative.dev/v1alpha1
kind: GitLabSource
metadata:
name: gitlabsource-demo
namespace: event-demo
spec:
eventTypes:
- push_events
- issues_events
- merge_requests_events
- tag_push_events
projectUrl: http://code.gitlab.svc.cluster.local/root/myproject
sslverify: false
accessToken:
secretKeyRef:
name: gitlabsecret
key: accessToken
secretToken:
secretKeyRef:
name: gitlabsecret
key: secretToken
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: event-display
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# kubectl apply -f ./
namespace/event-demo unchanged
service.serving.knative.dev/event-display configured
secret/gitlabsecret created
gitlabsource.sources.knative.dev/gitlabsource-demo created
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# kn service list -n event-demo
NAME URL LATEST AGE CONDITIONS READY REASON
event-display-gitlab http://event-display-gitlab.event-demo.xks.com event-display-gitlab-00001 13s 3 OK / 3 True
[root@xianchaomaster1 istio]# kubectl get pods -n event-demo
NAME READY STATUS RESTARTS AGE
event-display-00001-deployment-6d9b9f645c-dhwqv 2/2 Running 0 13m
gitlabsource-demo-vh99x-00001-deployment-5dc84fbc86-g5zvn 2/2 Running 0 19s
#查看浏览器中添加了 webjhooks
#将管理端的 webhooks的 名称编辑替换 为 gitlabsource-demo-vh99x.event-demo.svc.cluster.local
[root@xianchaomaster1 istio]# kubectl get vs -n event-demo
NAME GATEWAYS HOSTS AGE
event-display-ingress ["knative-serving/knative-ingress-gateway","knative-serving/knative-local-gateway"] ["event-display.event-demo","event-display.event-demo.svc","event-display.event-demo.svc.cluster.local","event-display.event-demo.xks.com"] 19m
event-display-mesh ["mesh"] ["event-display.event-demo","event-display.event-demo.svc","event-display.event-demo.svc.cluster.local"] 19m
gitlabsource-demo-vh99x-ingress ["knative-serving/knative-ingress-gateway","knative-serving/knative-local-gateway"] ["gitlabsource-demo-vh99x.event-demo","gitlabsource-demo-vh99x.event-demo.svc","gitlabsource-demo-vh99x.event-demo.svc.cluster.local","gitlabsource-demo-vh99x.event-demo.xks.com"] 5m45s
gitlabsource-demo-vh99x-mesh ["mesh"] ["gitlabsource-demo-vh99x.event-demo","gitlabsource-demo-vh99x.event-demo.svc","gitlabsource-demo-vh99x.event-demo.svc.cluster.local"] 5m45s
3.2 修改Webhooks 地址名称 为集群内部地址

#gitlabsource-demo-j8vmf.event-demo.svc.cluster.local
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# kubectl get vs -n event-demo
NAME GATEWAYS HOSTS AGE
event-display-ingress ["knative-serving/knative-ingress-gateway","knative-serving/knative-local-gateway"] ["event-display.event-demo","event-display.event-demo.example.com","event-display.event-demo.svc","event-display.event-demo.svc.cluster.local"] 11m
event-display-mesh ["mesh"] ["event-display.event-demo","event-display.event-demo.svc","event-display.event-demo.svc.cluster.local"] 11m
gitlabsource-demo-j8vmf-ingress ["knative-serving/knative-ingress-gateway","knative-serving/knative-local-gateway"] ["gitlabsource-demo-j8vmf.event-demo","gitlabsource-demo-j8vmf.event-demo.example.com","gitlabsource-demo-j8vmf.event-demo.svc","gitlabsource-demo-j8vmf.event-demo.svc.cluster.local"] 2m28s
gitlabsource-demo-j8vmf-mesh ["mesh"] ["gitlabsource-demo-j8vmf.event-demo","gitlabsource-demo-j8vmf.event-demo.svc","gitlabsource-demo-j8vmf.event-demo.svc.cluster.local"] 2m28s


3.3 测试Push Events、Tag Events 事件




#查看日志 是否收到
[root@xianchaomaster1 istio]# kubectl logs -f event-display-00001-deployment-6d9b9f645c-dhwqv -n event-demo
#Push Hook
Defaulted container "user-container" out of: user-container, queue-proxy
☁️ cloudevents.Event
Context Attributes,
specversion: 1.0
type: dev.knative.sources.gitlab.push
source: http://gitlab.gitlab.svc.cluster.local/root/myproject
id: ee1add4e-6568-4d31-a77a-337ec2d35303
time: 2023-07-06T17:09:25.652293289Z
datacontenttype: application/json
Extensions,
comgitlabevent: Push Hook
Data,
{
"object_kind": "push",
"before": "6cca2e9cc8e52ea30280a9bbf7e04948d894e192",
"after": "6cca2e9cc8e52ea30280a9bbf7e04948d894e192",
"ref": "refs/heads/main",
"checkout_sha": "6cca2e9cc8e52ea30280a9bbf7e04948d894e192",
"user_id": 1,
"user_name": "Administrator",
"user_username": "root",
"user_email": "",
"user_avatar": "https://www.gravatar.com/avatar/dafa3f209d417114218e7c150f7f4215?s=80\u0026d=identicon",
"project_id": 2,
"Project": {
"id": 2,
"name": "myproject",
"description": "",
"web_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"avatar_url": "",
"git_ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"git_http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git",
"namespace": "Administrator",
"visibility_level": 20,
"path_with_namespace": "root/myproject",
"default_branch": "main",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git"
},
"repository": {
"name": "myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"description": "",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject"
},
"commits": [
{
"id": "6cca2e9cc8e52ea30280a9bbf7e04948d894e192",
"message": "Initial commit",
"timestamp": "2023-07-07T00:06:28+08:00",
"url": "http://gitlab.gitlab.svc.cluster.local/root/myproject/-/commit/6cca2e9cc8e52ea30280a9bbf7e04948d894e192",
"author": {
"name": "Administrator",
"email": "mage@magedu.com"
},
"added": [
"README.md"
],
"modified": [],
"removed": []
}
],
"total_commits_count": 1
}
#tag_push 日志
☁️ cloudevents.Event
Context Attributes,
specversion: 1.0
type: dev.knative.sources.gitlab.tag_push
source: http://gitlab.gitlab.svc.cluster.local/root/myproject
id: 1a30408b-ece0-4f55-9fe5-2d445be80374
time: 2023-07-06T17:11:44.003110617Z
datacontenttype: application/json
Extensions,
comgitlabevent: Tag Push Hook
Data,
{
"object_kind": "push",
"before": "6cca2e9cc8e52ea30280a9bbf7e04948d894e192",
"after": "6cca2e9cc8e52ea30280a9bbf7e04948d894e192",
"ref": "refs/heads/main",
"checkout_sha": "6cca2e9cc8e52ea30280a9bbf7e04948d894e192",
"user_id": 1,
"user_name": "Administrator",
"user_username": "root",
"user_avatar": "https://www.gravatar.com/avatar/dafa3f209d417114218e7c150f7f4215?s=80\u0026d=identicon",
"project_id": 2,
"Project": {
"id": 2,
"name": "myproject",
"description": "",
"web_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"avatar_url": "",
"git_ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"git_http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git",
"namespace": "Administrator",
"visibility_level": 20,
"path_with_namespace": "root/myproject",
"default_branch": "main",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git"
},
"repository": {
"name": "myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"description": "",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject"
},
"commits": [
{
"id": "6cca2e9cc8e52ea30280a9bbf7e04948d894e192",
"message": "Initial commit",
"timestamp": "2023-07-07T00:06:28+08:00",
"url": "http://gitlab.gitlab.svc.cluster.local/root/myproject/-/commit/6cca2e9cc8e52ea30280a9bbf7e04948d894e192",
"author": {
"name": "Administrator",
"email": "mage@magedu.com"
},
"added": [
"README.md"
],
"modified": [],
"removed": []
}
],
"total_commits_count": 1
}
3.4 测试客户端开发者提交代码是否接收到Push事件
#找一台服务器 进行域名解析 到code.magedu.com
[root@sonarqube ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.40.145 jenkinsnew
192.168.40.146 jenkinsagent
192.168.40.147 sonarqube
192.168.40.190 event.xks.com code.magedu.com gitlab.magedu.com
#clone代码
[root@sonarqube ~]# git clone http://code.magedu.com/root/myproject.git
Cloning into 'myproject'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
[root@sonarqube ~]# ll
total 8
-rw-------. 1 root root 1400 Jul 1 13:29 anaconda-ks.cfg
drwxr-xr-x. 2 root root 4096 Jul 1 16:12 Java
drwxr-xr-x. 3 root root 35 Jul 9 13:42 myproject
drwxr-xr-x. 2 root root 94 Jul 4 19:55 rabbitmq
[root@sonarqube ~]# cd myproject/
[root@sonarqube myproject]# ll
total 8
-rw-r--r--. 1 root root 6230 Jul 9 13:42 README.md
[root@sonarqube myproject]# vim a.py
#配置
[root@sonarqube myproject]# git config --global user.name root
[root@sonarqube myproject]# git config --global user.email 807722920@qq.com
#添加文件
[root@sonarqube myproject]# git add ./
[root@sonarqube myproject]# git commit -m "v1"
[main b76d167] v1
1 file changed, 2 insertions(+)
create mode 100644 a.py
#push 到 main分支
[root@sonarqube myproject]# git push origin
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Username for 'http://code.magedu.com': root
Password for 'http://root@code.magedu.com':
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 279 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://code.magedu.com/root/myproject.git
b9a5558..b76d167 main -> main
#查看日志是否 收到事件
[root@xianchaomaster1 05-gitlabsource-to-knative-service]# kubectl get pods -n event-demo
NAME READY STATUS RESTARTS AGE
event-display-00001-deployment-57c56789bb-6q2pw 2/2 Running 0 22m
kubectl logs -f event-display-00001-deployment-57c56789bb-6q2pw -n event-demo
☁️ cloudevents.Event
Context Attributes,
specversion: 1.0
type: dev.knative.sources.gitlab.push
source: http://gitlab.gitlab.svc.cluster.local/root/myproject
id: 83072099-54b6-48af-b680-66c37151c2f7
time: 2023-07-09T05:45:21.41445716Z
datacontenttype: application/json
Extensions,
comgitlabevent: Push Hook
Data,
{
"object_kind": "push",
"before": "b9a55582be395e602efad5ccd9b07482ab2aa489",
"after": "b76d167d09b31df917259fa1abdd01f7d59153a6",
"ref": "refs/heads/main",
"checkout_sha": "b76d167d09b31df917259fa1abdd01f7d59153a6",
"user_id": 1,
"user_name": "Administrator",
"user_username": "root",
"user_email": "",
"user_avatar": "https://www.gravatar.com/avatar/dafa3f209d417114218e7c150f7f4215?s=80\u0026d=identicon",
"project_id": 2,
"Project": {
"id": 2,
"name": "myproject",
"description": "",
"web_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"avatar_url": "",
"git_ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"git_http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git",
"namespace": "Administrator",
"visibility_level": 20,
"path_with_namespace": "root/myproject",
"default_branch": "main",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git"
},
"repository": {
"name": "myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"description": "",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject"
},
"commits": [
{
"id": "b76d167d09b31df917259fa1abdd01f7d59153a6",
"message": "v1\n",
"timestamp": "2023-07-09T13:44:59+08:00",
"url": "http://gitlab.gitlab.svc.cluster.local/root/myproject/-/commit/b76d167d09b31df917259fa1abdd01f7d59153a6",
"author": {
"name": "root",
"email": "807722920@qq.com"
},
"added": [
"a.py"
],
"modified": [],
"removed": []
}
],
"total_commits_count": 1
}
3.5 测试开发者 提交merge操作 是否接收到事件
[root@ca-k8s-node01 myproject]# git branch developer
[root@ca-k8s-node01 myproject]# git checkout developer
Switched to branch 'developer'
[root@ca-k8s-node01 myproject]# vim testing-branch.py
#/usr/bin/python
developer branch
[root@ca-k8s-node01 myproject]# git add .
[root@ca-k8s-node01 myproject]# git commit -m "branch-v2"
[developer ab40d46] branch-v2
1 file changed, 3 insertions(+)
create mode 100644 testing-branch.py
[root@ca-k8s-node01 myproject]# git push --all origin
Username for 'http://gitlab.sheca.cn': root
Password for 'http://root@gitlab.sheca.cn':
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 344 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote:
remote: To create a merge request for developer, visit:
remote: http://gitlab.gitlab.svc.cluster.local/root/myproject/-/merge_requests/new?merge_request%5Bsource_branch%5D=developer
remote:
To http://gitlab.sheca.cn/root/myproject.git
* [new branch] developer -> developer
#收到 Push 事件
☁️ cloudevents.Event
Context Attributes,
specversion: 1.0
type: dev.knative.sources.gitlab.push
source: http://code.gitlab.svc.cluster.local/root/myproject
id: 2774e307-7cf8-45ba-a429-99ce3a0d9f71
time: 2024-01-16T06:47:38.902860412Z
datacontenttype: application/json
Extensions,
comgitlabevent: Push Hook
Data,
{
"object_kind": "push",
"before": "0000000000000000000000000000000000000000",
"after": "ab40d4624dfe44e345bea89bc68f31820876f0d3",
"ref": "refs/heads/developer",
"checkout_sha": "ab40d4624dfe44e345bea89bc68f31820876f0d3",
"user_id": 1,
"user_name": "Administrator",
"user_username": "root",
"user_email": "",
"user_avatar": "https://www.gravatar.com/avatar/dafa3f209d417114218e7c150f7f4215?s=80\u0026d=identicon",
"project_id": 2,
"Project": {
"id": 2,
"name": "myproject",
"description": "",
"web_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"avatar_url": "",
"git_ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"git_http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git",
"namespace": "Administrator",
"visibility_level": 20,
"path_with_namespace": "root/myproject",
"default_branch": "main",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git"
},
"repository": {
"name": "myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"description": "",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject"
},
"commits": [
{
"id": "ab40d4624dfe44e345bea89bc68f31820876f0d3",
"message": "branch-v2\n",
"timestamp": "2024-01-16T14:47:02+08:00",
"url": "http://gitlab.gitlab.svc.cluster.local/root/myproject/-/commit/ab40d4624dfe44e345bea89bc68f31820876f0d3",
"author": {
"name": "root",
"email": "807722920@qq.com"
},
"added": [
"testing-branch.py"
],
"modified": [],
"removed": []
}
],
"total_commits_count": 1
}


#触发了 merge 事件
☁️ cloudevents.Event
Context Attributes,
specversion: 1.0
type: dev.knative.sources.gitlab.merge_request
source: http://code.gitlab.svc.cluster.local/root/myproject
id: 1a09bba2-9c5e-4488-af0d-12b9b51b3a25
time: 2024-01-16T06:51:05.323624995Z
datacontenttype: application/json
Extensions,
comgitlabevent: Merge Request Hook
Data,
{
"object_kind": "merge_request",
"user": {
"name": "Administrator",
"username": "root",
"avatar_url": "https://www.gravatar.com/avatar/dafa3f209d417114218e7c150f7f4215?s=80\u0026d=identicon"
},
"object_attributes": {
"id": 1,
"title": "branch-v2",
"assignee_id": 0,
"author_id": 1,
"project_id": 0,
"created_at": "2024-01-16T14:51:03+08:00",
"updated_at": "2024-01-16T14:51:03+08:00",
"change_position": {
"base_sha": "",
"start_sha": "",
"head_sha": "",
"old_path": "",
"new_path": "",
"position_type": "",
"old_line": 0,
"new_line": 0,
"width": 0,
"height": 0,
"x": 0,
"y": 0
},
"original_position": {
"base_sha": "",
"start_sha": "",
"head_sha": "",
"old_path": "",
"new_path": "",
"position_type": "",
"old_line": 0,
"new_line": 0,
"width": 0,
"height": 0,
"x": 0,
"y": 0
},
"position": {
"base_sha": "",
"start_sha": "",
"head_sha": "",
"old_path": "",
"new_path": "",
"position_type": "",
"old_line": 0,
"new_line": 0,
"width": 0,
"height": 0,
"x": 0,
"y": 0
},
"branch_name": "",
"description": "",
"milestone_id": 0,
"state": "opened",
"iid": 1,
"url": "http://gitlab.gitlab.svc.cluster.local/root/myproject/-/merge_requests/1",
"action": "open",
"target_branch": "main",
"source_branch": "developer",
"source_project_id": 2,
"target_project_id": 2,
"st_commits": "",
"merge_status": "preparing",
"content": "",
"format": "",
"message": "",
"slug": "",
"ref": "",
"tag": false,
"sha": "",
"before_sha": "",
"status": "",
"stages": null,
"duration": 0,
"note": "",
"noteable_type": "",
"attachment": "0001-01-01T00:00:00Z",
"line_code": "",
"commit_id": "",
"noteable_id": 0,
"system": false,
"work_in_progress": false,
"st_diffs": null,
"source": {
"name": "myproject",
"description": "",
"web_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"avatar_url": "",
"git_ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"git_http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git",
"namespace": "Administrator",
"visibility_level": 20,
"path_with_namespace": "root/myproject",
"default_branch": "main",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git"
},
"target": {
"name": "myproject",
"description": "",
"web_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"avatar_url": "",
"git_ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"git_http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git",
"namespace": "Administrator",
"visibility_level": 20,
"path_with_namespace": "root/myproject",
"default_branch": "main",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git"
},
"last_commit": {
"id": "ab40d4624dfe44e345bea89bc68f31820876f0d3",
"message": "branch-v2\n",
"timestamp": "2024-01-16T14:47:02+08:00",
"url": "http://gitlab.gitlab.svc.cluster.local/root/myproject/-/commit/ab40d4624dfe44e345bea89bc68f31820876f0d3",
"author": {
"name": "root",
"email": "807722920@qq.com"
}
},
"assignee": {
"name": "",
"username": "",
"avatar_url": ""
}
},
"changes": {
"labels": {
"previous": null,
"current": null
}
},
"project": {
"id": 2,
"name": "myproject",
"description": "",
"web_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"avatar_url": "",
"git_ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"git_http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git",
"namespace": "Administrator",
"visibility_level": 20,
"path_with_namespace": "root/myproject",
"default_branch": "main",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"ssh_url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"http_url": "http://gitlab.gitlab.svc.cluster.local/root/myproject.git"
},
"repository": {
"name": "myproject",
"url": "git@gitlab.gitlab.svc.cluster.local:root/myproject.git",
"description": "",
"homepage": "http://gitlab.gitlab.svc.cluster.local/root/myproject"
}
}






浙公网安备 33010602011771号