Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)17k · #10771

kubesphere-devops-pipeline

Skill này làm gì

Skill này giúp agent AI quản lý pipeline trong KubeSphere DevOps thông qua các đối tượng Kubernetes đứng sau chúng. Skill dành cho lập trình viên và người vận hành xây dựng và chạy pipeline.

Khi nào nên dùng

  • ✓Khi bạn muốn tạo hoặc cập nhật một pipeline CI/CD cho dự án.
  • ✓Khi bạn cần khởi động một lần chạy pipeline và kiểm tra xem nó đã hoàn tất chưa.
  • ✓Khi một lần chạy pipeline thất bại và bạn muốn xem lại log và artifact của nó.

Liên kết skill

https://github.com/kubesphere/kubesphere/blob/master/skills/kubesphere-devops-pipeline/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/kubesphere/kubesphere/blob/master/skills/kubesphere-devops-pipeline/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể khởi động pipeline build cho dự án API của chúng tôi và cho tôi biết lần chạy có thành công không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent kiểm tra xem pipeline có cần tham số trước khi khởi động một lần chạy không. Sau đó nó tạo hoặc cập nhật đối tượng pipeline, theo dõi lần chạy và đọc log cùng artifact khi cần.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

KubeSphere DevOps Pipeline Management

Overview

Pipelines in KubeSphere DevOps are Kubernetes custom resources that integrate with Jenkins. KubeSphere uses a cloud-native, object-reconcile approach where Kubernetes resources are the source of truth.

When to Use

  • Creating or updating CI/CD pipelines
  • Triggering pipeline runs
  • Monitoring pipeline execution
  • Retrieving pipeline logs and artifacts
  • Troubleshooting failed pipeline runs

Architecture Mapping

KubeSphere DevOps maps Kubernetes resources to Jenkins objects:

KubeSphere Resource K8s Resource Jenkins Resource
DevOpsProject DevOpsProject CR + Namespace Folder
Pipeline Pipeline CR WorkflowJob
PipelineRun PipelineRun CR Build Run
Workspace Workspace CR (authorization context)
KubeSphere          Kubernetes                Jenkins
─────────────────────────────────────────────────────────────
Workspace demo
└── DevOpsProject   → demo-project NS          → Folder demo-project
    └── Pipeline    → Pipeline CR              → WorkflowJob
        └── Run     → PipelineRun CR           → Build #1

Triggering Pipeline Runs (Recommended: Object-Reconcile)

CRITICAL: ALWAYS Check for Parameters First!

Before triggering ANY pipeline (regular or multi-branch), you MUST check if the pipeline has parameters defined. Triggering a pipeline without required parameters will cause the build to fail or use incorrect defaults.

For Multi-Branch Pipelines: Query /branches/{branch} endpoint to get .parameters array For Regular Pipelines: Query the Pipeline CR and check .spec.pipeline.jenkinsfile for parameters {} directive

Preferred Approach: Create a PipelineRun custom resource. KubeSphere watches for these resources and triggers the corresponding Jenkins build.

Create a PipelineRun

apiVersion: devops.kubesphere.io/v1alpha3
kind: PipelineRun
metadata:
  name: my-pipeline-run-001
  namespace: demo-project
spec:
  pipelineRef:
    name: my-pipeline
  parameters:
    - name: BRANCH
      value: "main"

Apply with kubectl:

kubectl apply -f pipelinerun.yaml

Check PipelineRun Status

# List all runs
kubectl get pipelineruns -n demo-project

# Get specific run status
kubectl get pipelinerun my-pipeline-run-001 -n demo-project -o yaml

# Watch run progress
kubectl get pipelineruns -n demo-project -w

PipelineRun Status Fields

Field Description
status.phase Current state (Pending, Running, Succeeded, Failed, Unknown)
status.conditions Detailed conditions (Succeeded, Ready)
status.completionTime When run finished
status.startTime When run started

Delete a PipelineRun

kubectl delete pipelinerun my-pipeline-run-001 -n demo-project

Working Pipeline Example

Here's a complete, working pipeline that builds a Go application:

apiVersion: devops.kubesphere.io/v1alpha3
kind: Pipeline
metadata:
  name: go-demo-pipeline
  namespace: demo-project
spec:
  type: pipeline
  pipeline:
    name: go-demo-pipeline
    description: "Build and test Go application"
    jenkinsfile: |
      pipeline {
        agent any

        stages {
          stage('Build, Test and Archive') {
            agent {
              kubernetes {
                yaml '''
                  apiVersion: v1
                  kind: Pod
                  spec:
                    containers:
                    - name: golang
                      image: golang:1.21
                      command: ["sleep"]
                      args: ["99d"]
                '''
              }
            }
            steps {
              container('golang') {
                sh '''
                  export GO111MODULE=on
                  git clone https://github.com/kubesphere-sigs/demo-go-http.git .
                  go mod download
                  go test ./... -v
                  go build -o service main.go
                '''
              }
              archiveArtifacts artifacts: 'service', followSymlinks: false
            }
          }
        }
      }

Key Points:

  • Uses agent { kubernetes { yaml ... } } to define a custom pod with Go container
  • The archiveArtifacts step must be in the same stage as the build (same workspace)
  • Container name in container('golang') must match the container name in the YAML

Pipelin

Câu hỏi thường gặp

Agent có kiểm tra tham số của pipeline trước không?

Có. Skill nói phải kiểm tra tham số trước khi kích hoạt bất kỳ pipeline nào.

Agent đọc trạng thái pipeline ở đâu?

Nó đọc các đối tượng pipeline và run trong Kubernetes, tương ứng với các job Jenkins đứng sau chúng.

Nó có giúp được khi một lần chạy thất bại không?

Có. Skill bao gồm việc đọc log pipeline và xử lý sự cố các lần chạy thất bại.

Chi tiết

Mô tả gốc của tác giả

Use when creating, running, or managing CI/CD pipelines in KubeSphere DevOps, including pipeline API operations and run monitoring

repo: kubesphere/kubesphere

Độ phổ biến

Sao GitHub
17k
Vị trí xếp hạng
#10771
Giấy phép
—
Cập nhật
14/7/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự