• DevOps已解决
  • ks3.2.1-devops的pipelinerun运行记录支持批量删除吗?

创建部署问题时,请参考下面模板,你提供的信息越多,越容易及时获得解答。如果未按模板创建问题,管理员有权关闭问题。
确保帖子格式清晰易读,用 markdown code block 语法格式化代码块。
你只花一分钟创建的问题,不能指望别人花上半个小时给你解答。

操作系统信息
例如:阿里云

Kubernetes版本信息
kubectl version 命令执行结果贴在下方

容器运行时
docker version / crictl version / nerdctl version 结果贴在下方

KubeSphere版本信息
例如:v2.1.1/v3.0.0。离线安装还是在线安装。在已有K8s上安装还是使用kk安装。

问题是什么
ks3.2.1-devops的pipelinerun运行记录支持批量删除吗?目前pipelinerun记录有好几万条希望删除一点,有什么好的方式参考吗?

有两种方法来批量删除流水线执行记录:

  1. 通过 kubectl 来批量删除,你可以按照自己的过滤条件来操作
  2. 通过 ks 来批量删除,支持时间、数量来整体批量删除。具体解释如下:
 ks pip gc -h
Clean all those old PipelineRuns by age or count

Usage:
  ks pipeline gc [flags]

Flags:
      --condition string         The condition between --max-count and --max-age, supported conditions: 'and', 'ignoreTime' (default "and")
  -h, --help                     help for gc
      --max-age duration         Maximum age to keep PipelineRuns (default 168h0m0s)
      --max-count int            Maximum number to keep PipelineRuns (default 30)
      --namespaces stringArray   Indicate namespaces do you want to clean. Clean all namespaces if it's empty

Global Flags:
      --context string   Sets a context entry in kubeconfig

https://github.com/kubesphere-sigs/ks

    3 个月 后

    Rick 通过 kubectl 怎么删除 devops 项目运行记录【冗余记录】

    kubectl get pipelinerun -A 可以看到每个项目下的 pipelinerun, 可以按照需要的过滤条件来批量 kubectl delete

    3 年 后

    Rick 多分支流水线无法删除构建记录

    [root@ksmaster01 home]# ks pipeline gc --namespaces hzzy5527h --max-count 10
    time="2025-05-13T16:54:19+08:00" level=info msg="### found pipeline: backend-adminserver in namespace: hzzy5527h"
    time="2025-05-13T16:54:19+08:00" level=info msg="clean pipelinerun of pipeline: backend-adminserver .."
    time="2025-05-13T16:54:19+08:00" level=warning msg="the type of pipeline is multi-branch-pipeline, ignore."
    time="2025-05-13T16:54:19+08:00" level=info msg="the abortPipelinerun flag is not enabled"
    time="2025-05-13T16:54:19+08:00" level=info msg="### found pipeline: frontend-adminfront in namespace: hzzy5527h"
    time="2025-05-13T16:54:19+08:00" level=info msg="clean pipelinerun of pipeline: frontend-adminfront .."
    time="2025-05-13T16:54:19+08:00" level=warning msg="the type of pipeline is multi-branch-pipeline, ignore."
    time="2025-05-13T16:54:19+08:00" level=info msg="the abortPipelinerun flag is not enabled"