Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node labels to Jenkins Pipelines traces #212

Merged
merged 4 commits into from
Jun 14, 2021

Conversation

drodriguezhdez
Copy link
Collaborator

Requirements for Contributing to this repository

  • Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • The pull request must only fix one issue at the time.
  • The pull request must update the test suite to demonstrate the changed functionality.
  • After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see CONTRIBUTING.

What does this PR do?

This PR adds the Node Labels to the Jenkins Pipelines traces using the tag ci.node.labels.

Description of the Change

Alternate Designs

Possible Drawbacks

Verification Process

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)

  • Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@drodriguezhdez drodriguezhdez added the changelog/Added Added features results into a minor version bump label Jun 9, 2021
@drodriguezhdez drodriguezhdez force-pushed the drodriguezhdez/add_labels branch from ff7e01a to bcc573d Compare June 9, 2021 15:47

// We want to avoid using Json libraries cause
// may cause incompatibilities on different Jenkins versions.
final StringBuilder sb = new StringBuilder();
Copy link
Collaborator

Choose a reason for hiding this comment

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

can there be quotes in Jenkins labels?

Copy link
Collaborator Author

@drodriguezhdez drodriguezhdez Jun 14, 2021

Choose a reason for hiding this comment

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

If you mean double quotes: no, Jenkins removes the double quotes (") when you configure the labels for the worker. Other characters are allowed (', $, %, etc..)

A valid label array could be:

["arch01","worker","''''asd''''","·$··$·$","asdasdasd"]

@@ -133,6 +133,7 @@ private void completeInformation(final List<BuildPipelineNode> nodes, final Buil
final BuildPipelineNode executableChildNode = searchExecutableChildNode(node);
if(executableChildNode != null) {
node.setPropagatedNodeName(executableChildNode.getNodeName());
node.setPropagatedNodeLabels(executableChildNode.getNodeLabels());
Copy link
Collaborator

Choose a reason for hiding this comment

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

are you propagating it from job spans to stage/pipeline? I guess that's accurate for Jenkins?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, the worker information only is available in an actual executable child node, which is a job.

AdrianLC
AdrianLC previously approved these changes Jun 14, 2021
@hithwen hithwen merged commit 347e090 into master Jun 14, 2021
@hithwen hithwen deleted the drodriguezhdez/add_labels branch June 14, 2021 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/Added Added features results into a minor version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants