ks-devops icon indicating copy to clipboard operation
ks-devops copied to clipboard

【devops】pipeline running error after modify the jenkinsfile parameters

Open TinaSprunt opened this issue 3 years ago • 4 comments

Describe the bug When the pipeline is running,Three situations occur randomly

Situation 1:The input window gets the parameter value of the previous jenkinsfile. The pipeline in jenkins and k8s has been updated to the parameter value of the current jenkinsfile at this time, and an error 500 will be reported when you click Run

15

Situation 2: The input window does not display the jenkinsfile parameter value, and it runs normally (but the window does not display the jenkinsfile parameter to the user, which loses the meaning of setting the jenkinsfile parameter) 11

Situation 3:The input window shows that the current jenkinsfile parameter value is running normally,everything is ok

Environment kubesphere v3.1.0 kubernetes v1.20.4

To Reproduce

  1. create a pipeline. add jenkinsfile 5

  2. first run, There is no jenkinsfile parameter "Greeting" in the entry window 6

But Jenkins has already got the "Greeting" parameter 7

Check the running log, Greeting has been used 8

  1. Modify the "Greeting" parameter in jenkinsfile to "Greeting1" 9 10

  2. Second run,There is still no jenkinsfile parameter in the input window 11

Check the running log, actually we have used Greeting1 in the jenkinsfile parameter 12

  1. Modify the jenkinsfile parameter Greeting1 parameter to Greeting2 13

  2. Third run,The input window loaded the previous parameter Greeting1, but the put request has been successfully sent and the backend changed to Greeting2, 500 error was reported. 14 15

Expected behavior pipeline running normally

Kubesphere Chinese Community https://kubesphere.com.cn/forum/d/4586-devopspipeline-jenkinsfile

/priority high /area devops

TinaSprunt avatar May 25 '21 08:05 TinaSprunt

@LinuxSuRen @huanggze

TinaSprunt avatar May 25 '21 08:05 TinaSprunt

Consider you have parameter arg1 which is not in the Jenkinsfile. The possible reason is that you created a parameter via UI. Please see also the following screenshot:

image

This is a drawback of Jenkins Pipeline. We cannot fix this from the KubeSphere DevOps side. In my opinion, there're two possible solutions that we can improve.

  • always get the parameter list before popping the box when users click the run button
    • for multi-cluster case: The API is http://ip:port/kapis/clusters/host/devops.kubesphere.io/v1alpha2/devops/testk682v/pipelines/asdf/
    • for single-cluster case: The API is http://ip:port/kapis/devops.kubesphere.io/v1alpha2/devops/testk682v/pipelines/asdf/
  • disable the UI parameter settings (need more discussion)
    • or put the parameters into Jenkinsfile directly when saving it

/cc @kubesphere/sig-console , please take a look at this issue. Thanks.

/remove-priority high /priority medium

LinuxSuRen avatar Jun 01 '21 03:06 LinuxSuRen

arg1 created by via UI as you say.There will be problems when using web UI parameters and jenkinsfiles parameters at the same time. Put the parameters into Jenkinsfile directly when saving it maybe good idea.thanks a lot

TinaSprunt avatar Jun 01 '21 08:06 TinaSprunt

/area console

LinuxSuRen avatar May 31 '22 09:05 LinuxSuRen