Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 09:32
    codecov[bot] commented #1331
  • 09:03
    github-actions[bot] assigned #1331
  • 09:03
    dependabot[bot] labeled #1331
  • 09:03
    dependabot[bot] labeled #1331
  • 09:03

    dependabot[bot] on maven

    Bump jenkins-core from 2.361 to… (compare)

  • 09:03
    dependabot[bot] opened #1331
  • Aug 10 19:02
    uhafner commented #1327
  • Aug 10 16:40

    uhafner on master

    [maven-release-plugin] prepare … (compare)

  • Aug 10 16:40

    uhafner on v9.16.0

    (compare)

  • Aug 10 16:40

    uhafner on master

    [maven-release-plugin] prepare … (compare)

  • Aug 10 15:20
    jglick commented #1327
  • Aug 10 15:01
    uhafner closed #1327
  • Aug 10 15:01

    uhafner on master

    Support plugin compatibility te… Merge branch 'master' into pct Merge remote-tracking branch 'o… and 2 more (compare)

  • Aug 10 08:30
    codecov[bot] commented #1327
  • Aug 10 07:32
    codecov[bot] commented #1327
  • Aug 10 07:31
    uhafner synchronize #1327
  • Aug 10 07:30
    codecov[bot] commented #1327
  • Aug 10 07:29
    uhafner synchronize #1327
  • Aug 10 07:26

    uhafner on maven

    (compare)

  • Aug 10 07:26

    uhafner on master

    Bump jenkins-core from 2.362 to… Merge pull request #1328 from j… (compare)

Joel Armstrong
@jrarmstro
We want a shared library to trigger another build to perform some common linting operations, then post any warnings it finds back to the original build.
Ulli Hafner
@uhafner:matrix.org
[m]
I think you are trying to misuse builds or separate jobs, shouldn’t these linters run as a step of your original pipeline? I am very reluctant in introducing a new API that cannot be used from UI and Freestyle jobs. I‘m also not sure what this means for the original build: it is already finished, so I am not sure if it is even possible to add additional results.
Jordan Gibson
@JordanGibson
Hi all - I'm trying to get spotbugs results to be published to github for a multibranch pipeline job, but for some reason it doesn't seem to be working. The checks are published in Jenkins correctly, but not to github. Is there a particular way to specify to publish checks to github that I'm missing currently? Thanks.
Ulli Hafner
@uhafner:matrix.org
[m]
Did you follow the instructions on how to connect the Checks with your Jenkins instance?
What exactly happens when you write " it doesn't seem to be working"? What does the warnings plugin (and checks plugin) show in the console log of the build?
Jordan Gibson
@JordanGibson
Yeah - followed the instructions in the docs. Apologies for the ambiguity - what I mean is the results are not published to github, the only difference that I can see between the setup guide and our own implementation is that we are using a user instead of an app. This was a dedicated user for publishing statuses, and using it has worked so far for us. There is mention in the logs of [Checks API] saying no suitable checks publisher is found, however the results of the build are still published with the default context of continuous-integration/jenkins/pr-merge. The following are the final relevant logs of the build.
[Static Analysis] Created analysis result for 331 issues (found 0 new issues, fixed 0 issues)
[Static Analysis] Attaching ResultAction with ID 'analysis' to build 'Pull_Requests_SpotBugs_Pipeline_Build/PR-27926 #50'.
[Checks API] No suitable checks publisher found.

GitHub has been notified of this commit’s build result
I'm not a Jenkins pro (as you can probably tell) so it may be that I'm missing something quite simple.
Jordan Gibson
@JordanGibson
No, we haven't been able to due to organization permission issues. We have so far been using a user dedicated for publishing statuses. Are users unable to publish detailed statuses (ie with test results)?
Ulli Hafner
@uhafner:matrix.org
[m]
I think GitHub checks API requires a GitHub App. I don't know if there is another way available yet. Maybe this question is better suited for the https://matrix.to/#/#jenkinsci_github-checks-api:gitter.im room?
My plugin simply calls the checks API, which then publishes these results
Jordan Gibson
@JordanGibson
Ok sure - apologies! Thank you for the help :)
Jordan Gibson
@JordanGibson

Hi - thanks for the reference. I was able to get the issue sorted. Just one query - is it possible to define a branch as the baseline branch for new issues? The build which we will be running is for a multibranch pipeline against pull requests. We want to verify that in each pull request, no new warnings are introduced as a result of those changes, otherwise the build fails.

I can see there are quality gates, which I've added with the type NEW, however this compares the basline number of warnings against the previously ran build on the feature branch. I'd like to compare the baseline against the target branch's recent build. Is this possible?

Ulli Hafner
@uhafner:matrix.org
[m]
You need to run the reference build step: https://github.com/jenkinsci/git-forensics-plugin#reference-build
Before you invoke the warnings plug-in
Jordan Gibson
@JordanGibson
I wasn't aware of that - thanks
Ulli Hafner
@uhafner:matrix.org
[m]
You can see this plug-in in action in the CI builds of the warnings plug-in
mkm-dt
@mkm-dt
In a big project with 1k+ checkstyle XML files, I'm seeing a delay of 30s in the step that is recording checkstyle warnings before the first log line is printed. Unfortunately, this increases to 15+ min when executing the same build in the cloud. Any hints on how to debug? Note: this does not happen when there are no files to be found, and putting those files into their own directory hierarchy also does not change anything. Also, java() is not affected, so it seems related to the files, somehow.
1 reply
Ulli Hafner
@uhafner:matrix.org
[m]
Can you please post your original question? It seems that the message somehow disappeared from the server...
mkm-dt
@mkm-dt
Reposting on request: In a big project with 1k+ checkstyle XML files, I'm seeing a delay of 30s in the step that is recording checkstyle warnings before the first log line is printed. Unfortunately, this increases to 15+ min when executing the same build in the cloud. Any hints on how to debug? Note: this does not happen when there are no files to be found, but putting those files into their own directory hierarchy does not help. Also, java() is not affected, so it seems related to the files, somehow.
Ulli Hafner
@uhafner:matrix.org
[m]
The processing depends on the number of issues (and the number of affected files). All issues are serialized to XML and that takes time and memory to create and to transfer from agent to the controller. So if you have 1k warnings are typically ok, but 10k warnings will bring the plugin architecture at its limits. It is developed with the focus on clean projects.
mkm-dt
@mkm-dt
We fail the build if there are any warnings (and use this plugin to report why that happened), so that's not the case here. Most of the files are empty except for XML necessities, but others list some files, so the total size is about 6MB.
3 replies
Jordan Gibson
@JordanGibson
Hi @uhafner:matrix.org , me back again. Everything has been working great so far and we were able to successfully establish baseline builds. There is however an issue I've noticed with resetting quality gates. We have a trunk branch, which for some reason or another, had ~600 warnings less than expected on one build, which decreased the threshold and all subsequent builds then failed. I noticed there was a reset button beside the quality gate on Jenkins, but I think I must be using it wrong as when I click it, the button disappears - when I build again against trunk, it'll fail on the quality gate with the same number of warnings and using the previously successful build as the reference build for the threshold, which is the lower number. Do you have any advice on how we can reset this quality gate?
Ulli Hafner
@uhafner:matrix.org
[m]
The disable button is only for the last build. There’s an open feature request for this issue. The only workaround I see is to disable the quality gates, run a build, and enable again.
You can test the performance by cloning the analysis-model module and running the CheckStyle test with your cal file. Then you see how long the parsing lasts.
Jordan Gibson
@JordanGibson
I don't think that's feasible for us, we only allow committing to our base branches through PRs as they are protected branches. To disable the gates, we need to commit as it's for a multibranch pipeline in a Jenkinsfile so I'm not too sure what our plan is.
and the check this is for is a required check
Ulli Hafner
@uhafner:matrix.org
[m]
I see. You can add yourself as watchee of https://issues.jenkins.io/browse/JENKINS-56178, but I don't have capacity to implement that feature right now.
Jordan Gibson
@JordanGibson
Thanks. I have discovered that even when I reset the quality gate for the given pipeline, the subsequent build flags the same number of issues (the actual number, not the lower number), looks like it's still using the last "successful" build (where the number was lowered). Does resetting the quality gate not work when we fail the build if the quality gate is violated? Build #27 had 1300 warnings, Build #30 then had 700 warnings (which was marked as successful). Build #35 this morning had 1300 issues and failed on the quality gate as it was using #30 as the reference. I then reset the quality gate. Build #36 then had 1300 issues but still failed, saying it was using #30 as a reference. Maybe this is expected, I'll follow that issue on Jira, thanks.
2 replies
Ulli Hafner
@uhafner:matrix.org
[m]
Ok, then this is https://issues.jenkins.io/browse/JENKINS-61140, yet another issue in that part of the code 🤦‍♂️
Richard Eckart de Castilho
@reckart
Hiho all
I am trying to set up a matrix build but it fails at the end with a message
java.lang.IllegalStateException: ID analysis is already used by another action: io.jenkins.plugins.analysis.core.model.ResultAction for Static Analysis
By googling this message. I found amongst other things this channel
I have already tried setting a unique ID for each of the matrix branches - and it seems to have worked once and now again does not work:
                script {
                  def mavenConsoleIssues = scanForIssues tool: mavenConsole("maven-${PLATFORM}")
                  def javaIssues = scanForIssues tool: java("java-${PLATFORM}")
                  def javaDocIssues = scanForIssues tool: javaDoc("javaDoc-${PLATFORM}")
                  def analysisId = "analysis-${PLATFORM}"
                  echo "analysisId: ${analysisId}"
                  publishIssues id: analysisId, issues: [mavenConsoleIssues, javaIssues, javaDocIssues]
Looking at issue reports, experience reports, even the source code, I don't see what I might be doing wrong or what I might be missing 😢
Richard Eckart de Castilho
@reckart
... ok ... as usual after lots of searching and asking, it could be I found the problem... namely a second location in my pipeline script where I call publishIssues and there the ID was not set ... let's see ...
Richard Eckart de Castilho
@reckart
ok... works now 😅 🎉
Ulli Hafner
@uhafner:matrix.org
[m]
Good to see!
Ulli Hafner
@uhafner:matrix.org
[m]
Ok, maybe the parsing overhead for a single file is too large in in the current parser implementation. I must admit that I never encountered a project with more than 10 checkstyle.xml files...
mkm-dt
@mkm-dt
I thought this was quite common, especially since the gradle built-in checkstyle plugin generates one file per source-set per project. Even a tiny gradle multi-module project could easily exceed 10 xmls that way
Sebastian Roth
@sebsnyk

Hi everyone - I'm trying to run multiple instances of the sarif tool within a Jenkinsfile. For example:

recordIssues tool: sarif(pattern: 'results-tool1.sarif')
recordIssues tool: sarif(pattern: 'results-tool2.sarif')

This will cause incorrect UX in Jenkins, with 2 SARIF Warnings Tabs pointing to the same link. Is it possible to separate the data properly?

1 reply
Cristian Morales Vega
@RedDwarf82_gitlab

Sometimes I get errors like this

[gcc/clang] [-ERROR-] Can't create fingerprints for some files:
[gcc/clang] [-ERROR-] - '/usr/include/c++/12/bits/std_function.h' file not found

With /usr/include/c++/12/bits/std_function.h being a file inside a container the plugin is never going to have a chance to find.

I have tried to simply not IssueBuilder.setFileName(), but that losses information. I have tried to put it in IssueBuilder.setAdditionalProperties(), but that's not shown in the Jenkins Issues view.

I control the parser. What are my alternatives?
Can I setFileName() and still tell it "don't bother trying to get a fingerprint out of it"?

Cristian Morales Vega
@RedDwarf82_gitlab
I guess I could IssueBuilder.setFingerprint(). But not sure what values would be safe to use.
Ulli Hafner
@uhafner:matrix.org
[m]
Yes, you can set the fingerprint to the hashcode of the Filename. The fingerprint is just there to compute if a warning is new with respect to the source code content. If the content changes, then the hash changes. But the content of your file is not relevant.
Cristian Morales Vega
@RedDwarf82_gitlab

I have an issue here. If I use

builder.setFileName(matcher.group(2))
       .setLineStart(matcher.group(3))
       .setColumnStart(matcher.group(4))
       .setMessage(matcher.group(5))
       .setCategory(matcher.group(6))

return builder.buildOptional()

I get the error I mentioned before.

If I change it to

builder.setLineStart(matcher.group(3))
       .setColumnStart(matcher.group(4))
       .setMessage(matcher.group(5))
       .setCategory(matcher.group(6))

if(!matcher.group(2).startsWith("/usr/include")) {
  builder.setFileName(matcher.group(2))
}

return builder.buildOptional()

the job succeeds, but the issues are shown with file -.

Finally, if I do

builder.setFileName(matcher.group(2))
       .setLineStart(matcher.group(3))
       .setColumnStart(matcher.group(4))
       .setMessage(matcher.group(5))
       .setCategory(matcher.group(6))

if(matcher.group(2).startsWith("/usr/include")) {
  builder.setFingerprint(matcher.group(2).hashCode())
}

return builder.buildOptional()

the job succeeds, but the issues are not counted.

Ulli Hafner
@uhafner:matrix.org
[m]
What do you mean with not counted? Are the issues shown?
Cristian Morales Vega
@RedDwarf82_gitlab
In the job status view the number of warnings is less and, when you click on it to check the warnings, those are not listed.
Changing it to builder.setFingerprint(matcher.group(2))seems to have solved the issue. Not 100% sure it's OK (the fingerprint type is just a "String").
Ulli Hafner
@uhafner:matrix.org
[m]
I see. I did not look into those algorithms for quite some time now so maybe I forgot some not obvious dependencies. But the fingerprint is used only to compute the new and old warnings. You can set it to any string value. In your former case (where you get the error) the fingerprint simply is an incremented integer value.