kubesphere / ks-devops

This is a cloud-native application that focuses on the DevOps area.
https://kubesphere.io/devops/
Apache License 2.0
157 stars 89 forks source link

Request to support customize UI Pipeline steps #602

Closed LinuxSuRen closed 1 year ago

LinuxSuRen commented 2 years ago

Background

Currently(before v3.3.0), all Pipeline step UI components belong to .jsx source file. So, it's not easy to add a new Pipeline step UI component if a contributor is not familiar with the relevant information.

A second big problem with the current pattern is that some steps (or commands) might be difficult for some newcomers. In some cases, some steps need a nested step. For example:

container('base'){
  sh 'kubectl get ns'
}

or

withCredentials([usernamePassword(credentialsId : "$DOCKER_CREDENTIAL_ID" ,passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,)]) {
  sh 'echo "$DOCKER_PASSWORD" | docker login $REGISTRY -u "$DOCKER_USERNAME" --password-stdin'
  sh 'docker build -f Dockerfile -t $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$BUILD_NUMBER .'
  sh 'docker push $REGISTRY/$DOCKERHUB_NAMESPACE/$APP_NAME:$BUILD_NUMBER'
}

Proposal

Design a CRD that represents a Pipeline step. Provide an API that can list all the steps CR. Then the front-end could list all the cutomized steps.

Actions

Firstly, we can provide some common steps. For example:

Examples

Send message to Feishu

name: "Send Message to Feishu"
displayName: "Send Message to Feishu"
description: "Send Message to Feishu"
runtime: 'shell'
secret:
  required: true
  type: xxx
  wrap: true
container: 'base'
shell: |
  curl -X POST -H "Content-Type: application/json" \
    -d '{"msg_type":"text","content":{"text":".param.message"}}' \
    https://open.feishu.cn/open-apis/bot/v2/hook/$ID
parameters:
- name: message
  required: true
  display: Message to send

References

chilianyi commented 1 year ago

https://github.com/kubesphere-sigs/ks-devops-helm-chart/pull/94

yudong2015 commented 1 year ago

replace all the existing steps with the templates: kubesphere-sigs/ks-devops-helm-chart#100

chilianyi commented 1 year ago

/close

ks-ci-bot commented 1 year ago

@chilianyi: Closing this issue.

In response to [this](https://github.com/kubesphere/ks-devops/issues/602#issuecomment-1506694397): >/close > Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
VioZhang commented 1 year ago

@Bettygogo2021 need-doc