CI Visibility support in Agentless mode#309
Conversation
09e044d to
7b5c5b7
Compare
| * @return a boolean to signify the success or failure of the HTTP POST request. | ||
| */ | ||
| @SuppressFBWarnings("REC_CATCH_EXCEPTION") | ||
| public boolean postWebhook(String payload) { |
There was a problem hiding this comment.
This method looks pretty similar to postLogs and postApi. Maybe a refactor could be worth it?
There was a problem hiding this comment.
I tried but there are subtle differences. We might be able to get rid of them, but I don't want to risk breaking something so I would do it on a separate PR.
sarah-witt
left a comment
There was a problem hiding this comment.
Looks great 🎉 Left a few nits! Can you also update the README.md describing the new environment variables/settings, as well as make a note that CI visibility is available for both methods?
| } | ||
| } | ||
|
|
||
| // If there is no labels and the node name is master, |
There was a problem hiding this comment.
Making a note that in the future we will want to change this to "built-in" since that is what jenkins refers to the main node now.
Co-authored-by: Sarah Witt <[email protected]>
a7201b0 to
1fa4d07
Compare
f25b24f to
29fd379
Compare
sarah-witt
left a comment
There was a problem hiding this comment.
Just a few more small comments, otherwise looks good!
| HttpURLConnection conn = null; | ||
| try { | ||
| logger.fine("Setting up HttpURLConnection..."); | ||
| String urlParameters = "?service=" + DatadogUtilities.getDatadogGlobalDescriptor().getCiInstanceName(); |
There was a problem hiding this comment.
For testing purposes (and abstracting code) what about making this a function createRequest or something and verifying the url and headers are valid?
There was a problem hiding this comment.
I've refactored the duplicated code into a separate method in 54c3da0
Co-authored-by: Sarah Witt <[email protected]>
For postApi this means some changes: - The API key is not passed as a header instead of a URL param - We now set the User Agent.
3249ae1 to
54c3da0
Compare
What does this PR do?
CI Visibility was only available when running with an Agent, but not for Agentless. This allows CI Visibility to be enabled in Agentless mode.
Description of the Change
Implements the
startBuildTrace,finishBuildTraceandsendPipelineTraceinDatadogHttpClientwhich previously were only implemented in theDatadogAgentClient.For Agentless reporting we use CI Visibility Webhooks API, which unlike the Agent API doesn't receive traces. Because of this I had to add
DatadogWebhookBuildLogicandDatadogWebhookPipelineLogicto generate payloads for the Webhooks API, equivalent to the existingDatadogBuildPipelineLogicandDatadogTracePipelineLogicthat generate spans.Known issues
These two "features" were working when using APM through the Agent and won't work in Agentless since the Webhooks API still doesn't support them:
Nested stages (stages that have another stage as their parent)(fixed)Verification Process
Run different kinds of jobs and pipelines with the two modes and compare the data on the Datadog app.
Review checklist (to be filled by reviewers)
changelog/label attached. If applicable it should have thebackward-incompatiblelabel attached.do-not-merge/label attached.kind/andseverity/labels attached at least.