Comments (17)
Steps cannot take closures with arguments. (Even if they could, such a syntax would be incompatible with Declarative Pipeline.) You can add either an environment variable or a custom contextual object that other steps can look for:
withCheck('My Check Name') {
sh 'test --output output.xml'
junit 'output.xml'
}
from checks-api-plugin.
update an existing check
There is no need for a special API. You just submit a check with the same name and different details.
from checks-api-plugin.
the suggestion is that adding a new object that contains checks context information would allow other implementations to resolve the name from that object rather than using a default.
i.e.:
withChecks('my junit') {
// this adds a ChecksInfo or something which has a name
junit '*.xml'
}
and junit would report 'my junit'
which woud mean there would be a standard way to provide a checks name (although a default would still be required)
and yes ah Bill mentioned it would allow publishing the in progress check as well
from checks-api-plugin.
Or if for architectural reasons it is impossible for Jenkins to keep track of this information (the earlier check was posted by a different plugin, for example), github-checks
could at your option track the start time of a given build × check name in some InvisibleAction
so that an update could be displayed as occupying an interval of time.
from checks-api-plugin.
I've opened a PR against github-api
to allow for updates: hub4j/github-api#980 - it appears to be a very small change required to get it to work.
from checks-api-plugin.
This was fixed by #49
from checks-api-plugin.
would it make sense if I expose the status
instead of setting it as completed
(we can use that as default if the user didn't provide the status)?
Since we don't have the mechanism to track the status of a check unless we request GitHub through project name, PR, and check name which is bad IMO.
from checks-api-plugin.
Ah yes, sorry - spent too much time on shared libraries - where what I've written is roughly what I implemented before I realised it woudln't really work without more plugin support.
A contextual checks object would make a lot of things easier.
from checks-api-plugin.
If interested, check Javadoc.
from checks-api-plugin.
Since we don't have the mechanism to track the status of a check unless we request GitHub through project name, PR, and check name which is bad IMO.
Yes, that wouldn't be ideal! Can we not add the id
returned by the checks provider to the ChecksDetails
? It doesn't seem an unreasonable assumption that any checks provider would provide a unique id to allow updating the check. I see that github-api
is lacking an api to update an existing check, beyond the internal implementation of paginating annotations. That looks like it should at least be a fairly simple addition to make.
from checks-api-plugin.
Ah, does that work? I tried to find details of what happens in the github docs and it wasn't clear. I note that github-api does explicitly call the update
endpoint to append annotations.
from checks-api-plugin.
Ah, does that work? I tried to find details of what happens in the github docs and it wasn't clear. I note that github-api does explicitly call the
update
endpoint to append annotations.
That's how our status checks work.
from checks-api-plugin.
I believe you, I just wish the documentation was a bit clearer :) For instance I wonder what it does to existing annotations?
from checks-api-plugin.
After reading so many conversations about the custom names for JUnit checks, I'm still a little confused at some points.
You create this issue here just want us to provide the ability to update the checks, which you can actually do by publishing checks with the same name as long as you call the publishChecks
in the same branch. Does that meet your needs? Or you need more to publish different status
to help you keep track of your builds, since now publishChecks
will only publish completed checks?
And about the withChecks
step, you write the closure because you tend to use it to let it help you create or update the checks published by others plugins? I currently have no idea how to implement it (I'm not quite familiar with the interactions between the pipeline code and java code), since in my understanding, shouldn't such works are achieved by shared libraries?
from checks-api-plugin.
So I did initially try just creating a checks with the same name, however, this didn't work as I would hope as, because every time time the checks api posts a new check to github it clobbers the started at time:
For almost every other field this doesn't matter, as it's the last value that matters (title, status, details, finished at etc etc) but for started at the only thing that knows it is the first check I post. The junit plugin (currently) has no way of knowing what time the check was started, and unless I'm missing something undocumented in the github docs, when we post a new check it entirely replaces the old check.
from checks-api-plugin.
it clobbers the started at time
Well, not sure if the junit
plugin even defines otherwise (by default a check would be considered instantaneous), but if so, then it should keep track of the time when the check was first added under a given name, and use that same explicit start time.
from checks-api-plugin.
I'm figuring out a way to update the checks.
We need an update
method:
public void update(ChecksDetails addedDetails);
or
public void update(CheckDetails originDetails, ChecksDetails addedDetails);
since the dependent github-api library doesn't support updating the checks either (which always POST instead PATCH as github documented for updating a check), we just append things (started at time, annotations) in addedDetails
to originDetails
and publish another again.
And another problem is, where we define this method, in checks-api, github-check, or just in the withChecks
step?
from checks-api-plugin.
Related Issues (20)
- Primary error message is not shown in error header, instead says `error in 'error' step` HOT 5
- Do not report handled exceptions HOT 3
- Build log Output truncated. - print tail of log instead of head HOT 2
- Allow using specific credentials for Checks HOT 5
- How do I create a custom rerun check in Pipeline HOT 1
- 1.7.5: download plugin checks-api to file: status code: 403, reason phrase: Forbidden HOT 2
- Phantom release 1.7.5 of checks-api HOT 1
- Possibility Of Specifying Credentials HOT 3
- Fix flaky test `BuildStatusChecksPublisherITest.shouldPublishStageDetails`
- [Question] Hanging checks with "withChecks()" HOT 5
- Include optional checks publisher to warnError HOT 1
- [doc] How to get started? HOT 5
- How to publish checks from sub-jobs HOT 1
- Dependency Dashboard
- Tests fail on Java 21 with Mockito errors HOT 2
- Setting Status checks name does not change it from the default Jenkins HOT 4
- Dependencies of flattened POM of latest release do not match `MANIFEST.MF`
- Return information about the check
- checks not working for Bitbucket scm HOT 1
- Steps with labels are not logged as errors HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from checks-api-plugin.