Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 22:50
    batmat review_requested #3874
  • Jan 31 2019 21:29
    basil opened #3875
  • Jan 31 2019 18:18
    nisarg1499 opened #3874
  • Jan 31 2019 18:12
    nisarg1499 edited #3873
  • Jan 31 2019 18:04
    nisarg1499 edited #3873
  • Jan 31 2019 18:03
    nisarg1499 opened #3873
  • Jan 31 2019 15:53
    batmat synchronize #3865
  • Jan 31 2019 15:24
    jglick commented #3861
  • Jan 31 2019 15:18
    nisarg1499 closed #3863
  • Jan 31 2019 15:18
    nisarg1499 commented #3863
  • Jan 31 2019 15:13
    oleg-nenashev commented #3863
  • Jan 31 2019 15:11
    nisarg1499 reopened #3863
  • Jan 31 2019 15:11
    nisarg1499 closed #3863
  • Jan 31 2019 15:01
    nisarg1499 synchronize #3863
  • Jan 31 2019 14:54
    batmat synchronize #3865
  • Jan 31 2019 14:45
    batmat synchronize #3865
  • Jan 31 2019 14:16
    Wadeck closed #3805
  • Jan 31 2019 14:12
    pjanouse commented #3802
  • Jan 31 2019 14:12
    pjanouse commented #3802
  • Jan 31 2019 14:05
    pjanouse synchronize #3802
Gavin Mogan
@halkeye
or just a general call() statement?
Semih Ural
@semihural
general call() statement in groovy script
in shared library
Gavin Mogan
@halkeye
I've never used types in groovy, i've just used def but i think its fine. Whats the previous line look like?
Semih Ural
@semihural
#!/usr/bin/env groovy

def call() {

    users = [
        semural: [
            git: 'semih.ural@gmail.com',
            slack: 'UNSJWLP9P'
    ]

    String email = sh(script: "git --no-pager show -s --format=\'%ae\'",returnStdout: true).trim()  

    String authorSlackID = users.findAll { _, contact -> contact.git == email }
     .collect { _, contact -> contact.slack } 

    def colorCode = '#848484' // Gray

    switch (currentBuild.result) {
        case 'SUCCESS':
            colorCode = '#00FF00' // Green
            break
        case 'UNSTABLE':
            colorCode = '#FFFF00' // Yellow
            break
        case 'FAILURE':
            colorCode = '#FF0000' // Red
            break;
    }

    String message = """
        *Jenkins Build*
        Job name: `${env.JOB_NAME}`
        Build number: `#${env.BUILD_NUMBER}`
        Build status: `${currentBuild.result}`
        Author: ${authorSlackID ? '<@' + authorSlackID + '>' : '???'}
        Build details: <${env.BUILD_URL}/console|See in web console>
    """.stripIndent()

    return slackSend(color: colorCode, message: message)
}
@halkeye here is full script
Gavin Mogan
@halkeye
your users chunk is missing a close bracket
whats the real term? hard bracket? square bracket? /shrug
Semih Ural
@semihural
hard - > ]
let me try I could not see that
Semih Ural
@semihural
@halkeye now it seems ok at least no error thanks for that but that script did not return the git committer email
Gavin Mogan
@halkeye
that i don't know sorry
maybe you need to provide the hash
Semih Ural
@semihural
ok it worked also with escape char
ı wanna ask one more question
I am trying to find user’s slackID as below.. But output is with bracket.. That is why format is broken in slack I guess.. Is there anyway to ignore brackets ?
[UNSJWLP9P]
def call() {
    users = [
        semural: [
            git: 'semih.ural@gmail.com',
            slack: 'UNSJWLP9P' 
        ]
    ]
    String email = sh(script: 'git --no-pager show -s --format=\'%ae\'',returnStdout: true).trim()  
    echo email
    String authorSlackID = users.findAll { _, contact -> contact.git == email }
     .collect { _, contact -> contact.slack } 
    echo authorSlackID
String message = """
        *Jenkins Build*
        Author: ${authorSlackID ? '<@' + authorSlackID + '>' : '???'};
Gavin Mogan
@halkeye
what do you mean ignore brackets?
like strip them out? groovy should be able to strip or search and replace easily
Semih Ural
@semihural
when I echo authorSlackID, it turn me the list but I need that value as a string instead of list... I 've multiple users in that list by the way
Gavin Mogan
@halkeye
oh, your treating authorSlackID as an singleEntry, but findAll returns an array
so you either need to find a single one, or use join to convert the array into a string
Good luck. I need sleep
Semih Ural
@semihural
thanks @halkeye
Timo Leppäkorpi
@Kettu2_gitlab
Hello, I'm trying to install agents in Windows, but our network perhaps prevents to load agent.jar from network, so I'm not able to launch the agent from browser. http://master_ip:8080/jnlpJars/agent.jar leads to "Oops! A problem occurred while processing the request." message. Master's log shows: Caught unhandled exception with ID e1d861d2-fad0-4300-b826-e47b09adba35
java.io.FileNotFoundException: agent.jar
at hudson.model.Slave$JnlpJar.getURL(Slave.java:434)
at hudson.model.Slave$JnlpJar.connect(Slave.java:402)...
Seems it's trying to load "slave" (old name) instead of "agent". How to fix it? Jenkins version is 2.259
Sigi
@Siegfriedk
How good/stable is the password hide functionality of jenkins? I just had a log output with a password which contains these specical chars: #%~_ and after the change of the pw, it works again. Username was starred, password was not
Simona Avornicesei
@savornicesei
Can I embed a SVG (coverage badge) in an email template? I can add an url to it but after a while the build info will be deleted and thus the svg will be lost as well
Alex Earl
@slide
Yes, I think you should be able to as long as the client supports it
Alex Earl
@slide
email-ext supports inlining of stuff as base64 encoded data, which many clients support
@Kettu2_gitlab What version of Jenkins?
Bruce Szalwinski
@thelazydba_twitter
where would i find information about the changes needed to make to a jenkins enviroment with respect to the github oauth deprecation, https://developer.github.com/changes/2020-02-14-deprecating-password-auth/?
Alex Earl
@slide
I am not sure, but I believe you just need to create an API key and use that in the credentials instead of the password
Bruce Szalwinski
@thelazydba_twitter
the next brownout is tomorrow, so i guess i'll find out if i've done enough.
the github docs, https://developer.github.com/changes/2020-02-14-deprecating-password-auth/#changes-to-make, seem to indicate that a new Authorization header is required, which has me concerned that a plugin update may be required.
Bruce Szalwinski
@thelazydba_twitter
and stack trace from last brownout was java.io.FileNotFoundException: https://api.github.com/ at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:243) at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getInputStream(DelegatingHttpsURLConnection.java:210) at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:25) at org.kohsuke.github.Requester.parse(Requester.java:612) at org.kohsuke.github.Requester.parse(Requester.java:594) at org.kohsuke.github.Requester._to(Requester.java:272) Caused: org.kohsuke.github.GHFileNotFoundException: {"message":"Bad credentials. The API can't be accessed using username/password authentication. Please create a personal access token to access this endpoint: http://github.com/settings/tokens","documentation_url":"https://docs.github.com/articles/creating-a-personal-access-token-for-the-command-line"} at org.kohsuke.github.Requester.handleApiError(Requester.java:686) at org.kohsuke.github.Requester._to(Requester.java:293) at org.kohsuke.github.Requester.to(Requester.java:234) at org.kohsuke.github.GitHub.checkApiUrlValidity(GitHub.java:703) at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.checkApiUrlValidity(GitHubSCMSource.java:1291) at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1344) at jenkins.scm.api.SCMSource.fetch(SCMSource.java:583) at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:95) at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:263) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429)
Gavin Mogan
@halkeye
@thelazydba_twitter have you looked at github apps? https://www.jenkins.io/blog/2020/04/16/github-app-authentication/
@Siegfriedk you mean credentials hide? it'll match your credentials and replace them with ** in the logs, only if you declare and use it as a credential. credential() in declarative, or withCredentials block in scripted
mlasevich
@mlasevich
@halkeye Thanks for your response on echo vs println - from some googling, there is apparently also some CPS related downside on using printlnwhere there is a race condition where println may not print in time
Bruce Szalwinski
@thelazydba_twitter
@halkeye - thanks. my understanding is that feature in the github-branch-source-plugin allowed jenkins itself to authenticate as an app. is it also about changing how users authenticate to github? the fact that the feature was released in in April of this year and github has been announcing the password deprecation since December of last year makes me think there are a lot of folks that will be needing to upgrade or the required change is related to something else.
Gavin Mogan
@halkeye
@thelazydba_twitter well the error you posted says the api is using username/password and to use username/token instead, which would be the first change i'd make. looking at https://github.com/jenkinsci/github-branch-source-plugin/blob/master/src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java#L1344 it seems to be looking
at the credentails/github owner for the job, so I suspect first checking the credentials for that to make sure its using a token not a password
Colin Morris
@ColinMorris83
Hi, is there any plugin that will enable things like :octopus: that are in Github repository descriptions to be displayed as their emoji when displayed inside Jenkins and pulled in automatically as part of a Github organisation scan by the github branch source plugin? It currently displays the actual text e.g : octopus :
Gavin Mogan
@halkeye
oh you want github emoji working in the descriptions?
There's a plugin to pull github descriptions though. I don't know if it handles emoji directly. Its probably not hard to make a plugin that lets you use github flavored markdown in the description.
is a completely barebones formatter you could hook up
Colin Morris
@ColinMorris83
The descriptions are automatically pulled through when the repository is first discovered, and are uneditable once pulled through
Gavin Mogan
@halkeye
Yea but you can set the formatter to something that knows how to handle the format
mlasevich
@mlasevich
while asking about formatters, is there a decently supported MD formatter out there? the only one I found has not seen an update in something like 8 years
Gavin Mogan
@halkeye
I think that was my suggestion, though not clearly written. It should be a super easy plugin to make
Bruce Szalwinski
@thelazydba_twitter
https://issues.jenkins-ci.org/browse/JENKINS-60480 - looks like that has my answers