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

I don't understand how to make the plugin work #77

Open
Ka1va opened this issue Apr 24, 2024 · 5 comments
Open

I don't understand how to make the plugin work #77

Ka1va opened this issue Apr 24, 2024 · 5 comments

Comments

@Ka1va
Copy link

Ka1va commented Apr 24, 2024

What feature do you want to see added?

here is my pipeline
Screenshot from 2024-04-24 15-19-49
here is my plugin settings
Screenshot from 2024-04-24 15-22-28

Upstream changes

No response

Are you interested in contributing this feature?

No response

@Ka1va
Copy link
Author

Ka1va commented Apr 24, 2024

Please explain what's wrong

@justbelieveinmyself
Copy link

You should review the jenkins logs

@peterarsentev
Copy link

@Ka1va If you don't mind, I'd like to help you out as I've had to deal with this plugin recently.
Some configurations are a little tricky to overlook.
First of all, after installing this plugin, you need to go into the system config and look up the block telegram.
There you will find the field name where you need to enter the name of your bot starting with @.
Like this @job4j_bot.
Then you have to specify TOKEN.
I then restarted jenkins as I did not see any changes in the system log.
So all you have to do now is add notification lines to your pipeline script.

     post {
        always {
           telegramSend "Build number: ${currentBuild.number}"
           telegramSend "Build status: ${currentBuild.currentResult}"
           telegramSend "Started at: ${new Date(currentBuild.startTimeInMillis)}"
           telegramSend "Duration so far: ${currentBuild.durationString}"
           telegramSend "The build was triggered by: ${currentBuild.getBuildCauses()}"
        }
    }   

Then I run my pipeline and get the first message in telegram, it makes me so happy.

@JoshuaSeidel
Copy link

@peterarsentev

im having this issue, followed your suggestions and i got this

org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'UserIdCause' in 'The build was triggered by: [[_class:hudson.model.Cause$UserIdCause, shortDescription:Started by user anonymous, userId:null, userName:anonymous]]'
        at PluginClassLoader for token-macro//org.jenkinsci.plugins.tokenmacro.Parser.processToken(Parser.java:492)
        at PluginClassLoader for token-macro//org.jenkinsci.plugins.tokenmacro.Parser.parseNonDelimitedToken(Parser.java:186)
        at PluginClassLoader for token-macro//org.jenkinsci.plugins.tokenmacro.Parser.parseToken(Parser.java:113)
        at PluginClassLoader for token-macro//org.jenkinsci.plugins.tokenmacro.Parser.parse(Parser.java:87)
Caused: org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Error processing tokens
        at PluginClassLoader for token-macro//org.jenkinsci.plugins.tokenmacro.Parser.parse(Parser.java:97)
        at PluginClassLoader for token-macro//org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:75)
        at PluginClassLoader for token-macro//org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:68)
        at PluginClassLoader for token-macro//org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:196)
        at PluginClassLoader for token-macro//org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:234)
        at PluginClassLoader for token-macro//org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:204)
        at PluginClassLoader for telegram-notifications//jenkinsci.plugins.telegrambot.telegram.TelegramBot.expandMessage(TelegramBot.java:92)
        at PluginClassLoader for telegram-notifications//jenkinsci.plugins.telegrambot.telegram.TelegramBot.sendMessage(TelegramBot.java:104)
        at PluginClassLoader for telegram-notifications//jenkinsci.plugins.telegrambot.TelegramBotMessager.perform(TelegramBotMessager.java:71)
        at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
        at PluginClassLoader for workflow-basic-steps//org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:101)
        at PluginClassLoader for workflow-basic-steps//org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
        at PluginClassLoader for workflow-step-api//org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)```

@peterarsentev
Copy link

@Ka1va
I think you are trying to run your pipeline as anonymous. Try logging in and running your pipeline as the current user.
This will reduce the number of problem fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants