Skip to content

fix(jenkins): additional process to avoid panic#3758

Merged
likyh merged 1 commit intoapache:release-v0.14from
merico-ai:fix-jenkins-error
Nov 18, 2022
Merged

fix(jenkins): additional process to avoid panic#3758
likyh merged 1 commit intoapache:release-v0.14from
merico-ai:fix-jenkins-error

Conversation

@warren830
Copy link
Contributor

Summary

According to issue#3757, user met the error which related to line 67 in subtask enrichApiBuildWithStages
I checked the code of that line build.JobName = strings.TrimSpace(str[0]), I can only assume the error was caused by str[0] which means len(str) = 0.
To avoid this panic, I tried to add some check to avoid panic by the following situations:

  1. After splitting stage's buildName by '#', and the string list of that result has less than 2 elements, we can just ignore this build
  2. If the last element of the string list above is not a number, which means we got an error after converting it to number, then we again ignore the build

Does this close any open issues?

Relates to #3757

Screenshots

Include any relevant screenshots here.

Other Information

Any other information that is important to this PR.

dataflowTester.FlushTabler(&models.JenkinsStage{})
dataflowTester.ImportCsvIntoTabler("./raw_tables/_tool_jenkins_stages.csv", &models.JenkinsStage{})

dataflowTester.Subtask(tasks.ExtractApiBuildsMeta, taskData)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some test data in e2e test to cover the logic about JenkinsBuild. HasStages

@warren830 warren830 force-pushed the fix-jenkins-error branch 2 times, most recently from 8b50336 to 1fbfdc5 Compare November 18, 2022 08:51
Copy link
Contributor

@likyh likyh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSV is so difficult to understand. Have a try.

@likyh likyh merged commit bb93ae1 into apache:release-v0.14 Nov 18, 2022
@warren830 warren830 deleted the fix-jenkins-error branch November 18, 2022 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants