ks-devops
ks-devops copied to clipboard
自己通过ClusterTemplate添加的模板不是声明式时(脚本式)后创建流水线后返回did not contain the 'pipeline'
What is version of KubeSphere DevOps has the issue?
3.3.1
How did you install the Kubernetes? Or what is the Kubernetes distribution?
通过kk 安装
What happened?
自己通过ClusterTemplate添加的模板不是声明式时(脚本式)后创建流水线后返回did not contain the 'pipeline' step"错误,且流水线没有被创建。应该直接保存并返回到jenkinsfile即可

Relevant log output
No response
Additional information
No response
please upload your template.
please upload your template.
node{
stage('Build'){
checkout scm
echo 'start build'
}
stage('Test'){
echo 'start test'
}
stage('Deploy'){
echo 'start deploy'
}
}

please change the yaml like this:
template: |
pipeline {
agent any
stages {
stage('Build') {
steps {
checkout scm
echo 'start build'
}
}
stage('Test') {
steps {
echo 'start test'
}
}
stage('Deploy') {
steps {
echo 'start deploy'
}
}
}
}
please change the yaml like this:
template: | pipeline { agent any stages { stage('Build') { steps { checkout scm echo 'start build' } } stage('Test') { steps { echo 'start test' } } stage('Deploy') { steps { echo 'start deploy' } } } }
您好,我的目的不是需要将脚本式流水线转换成声明式流水线,而是需要支持直接使用脚本式流水线
可以试试这样通过图形化定义,定义后,也会转成声明式:
pipeline {
agent {
node {
label 'base'
}
}
stages {
stage('stage-8pr6w') {
agent none
steps {
script {
node{
stage('Build'){
checkout scm
echo 'start build'
}
stage('Test'){
echo 'start test'
}
stage('Deploy'){
echo 'start deploy'
}
}
}
}
}
}
}
的目的不是需要将脚本式流水线转换成声明式流水
您好,你可能理解错我的意思了,我知道可以通过图形来创建也是生产声明式流水。这不是我的目的。我的需要的是像直接编辑jenkinsfile一个直接使用脚本式流水线。
目的是通过ClusterTemplate添加的模板
是说 https://github.com/kubesphere-sigs/pipeline-templates/blob/main/CONTRIBUTION.md 这种方式吗,这种方式定义的,也是需要用声明式的方式书写模版。
可能还是没有完全理解你的意思,可否再详细的说明下整体场景。
是说 https://github.com/kubesphere-sigs/pipeline-templates/blob/main/CONTRIBUTION.md 这种方式吗,这种方式定义的,也是需要用声明式的方式书写模版。
可能还是没有完全理解你的意思,可否再详细的说明下整体场景。
是的就是通过这种模板的方式来创建流水线,现在只支持声明式的方式书写,不支持脚本式的方式书写。我看下了报错的原因,是因为在创建流水线的时候需要解析成图形化,脚本式的不支持图形化预览所以报错了。这个应该你们能很好解决,判断一下就好。如果是声明式的就展示图形化,不是就直接展示jenkinsfile文件。场景就是我的流水线实通过jenkins共享库实现的。

好的,非常感谢你的反馈。
这个场景通过 创建流水线,编辑 Jenkinsfile ,输入脚本模式的内容,是可以正常使用的。 通过 自定义流水线模版,基于流水线模版 创建 流水线,由于会自动做 转可视化 的操作,导致失败了。
这个我们调整下。
ralated to: https://github.com/kubesphere/ks-devops/issues/714
是的就是这个意思