question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pipeline (formerly Workflow) snippet generator unhelpful

See original GitHub issue

The snippet generator for wrap -> Color ANSI Console output gives a pretty unhelpful snippet:

wrap(<object of type hudson.plugins.ansicolor.AnsiColorBuildWrapper>) {
    // some block
}

The only place I found out how to use it was from your README.md 😃

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
ericfranciscommented, May 16, 2017

Would be nice to see some common examples.

Where does the ansiColor configuration go in a declarative Jenkinsfile?

pipeline {
  agent any

  // Set log rotation, timeout and timestamps in the console
  options {
    buildDiscarder(logRotator(numToKeepStr:'10'))
    timeout(time: 5, unit: 'MINUTES')
  }

  stages {

    stage('Initialize') {
      steps {
        sh '''
          java -version
          node --version
          npm --version
        '''
      }
    }

Is it possible to configure the ansiColor plugin for the entire job?

7reactions
qvicksilvercommented, Jan 28, 2016

Got some time to play with this. Just removing the unused integers from the constructor parameters (defaultFg and defaultBg) produces a nicer snippet.

    @DataBoundConstructor
    public AnsiColorBuildWrapper(String colorMapName, Integer defaultFg, Integer defaultBg) {
        this.colorMapName = colorMapName;
    }
wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {
    // some block
}

I can’t see those being used anywhere else in the code so I guess they should be safe to remove?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[JENKINS-31831] Allow Workflow Snippet Generator to be ...
At least, it would be useful to be able to link to a functional Workflow Snippet Generator. Since the available snippets may vary...
Read more >
Jenkins Pipelines and their dirty secrets | by Pencillr - Medium
From any Jenkins you can reach a pipeline snippet generator, which helps you figure out the syntax. Anyway here is an example.
Read more >
Design: Automatically create a new merge request pipeline ...
The common workflow is as follows: work in branch with opened MR in a draft state (detached pipelines will be created); after work...
Read more >
Pipeline Snippet Generator return the name of the object ...
For some plugins when you use the "Snippet Generator" for Pipelines you could obtain the name of the object instead of the parameter...
Read more >
customizing default behaviour of Pipeline Snippet Generator
In general, value is skipped during the generation of snippet if it is null , so in case of ResourceStep.encoding it is converted...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found