Open shryta234 opened 1 year ago
Hello, @shryta234 l'm not by my computer but I think that the error is because the method notifyWithPhilipsHueLight is not defined in your Jenkinsfile script. I'll try to take a better look ar this soon when I'm by my computer :)
Looking forward on hearing from you, any help in this regard will be greatly appreciated!
Hello Egill,
Hope you are doing well.
I'm using Jenkins and trying to integrate it with my Hue light. Succesfully managed to switch ON the Hue lights using freestyle Jenkins job.
Wanted to implement that using Pipeline ,came across your github code - https://github.com/EgillAntonsson/Jenkinsfile_Philips_Hue_Light_Notifier/blob/master/Jenkinsfile
But getting this error, not sure how to resolve it. Error when executing failure post condition: java.lang.NoSuchMethodError: No such DSL method 'notifyWithPhilipsHueLight' found among steps [archive, bat, build, catchError, checkout, deleteDir, dir, echo, emailext, emailextrecipients, envVarsForTool, error, fileExists, findBuildScans, getContext, git, input, isUnix, junit, library, libraryResource, load, mail, milestone, node, parallel, powershell, properties, publishChecks, pwd, pwsh, readFile, readTrusted, resolveScm, retry, script, setGitHubPullRequestStatus, sh, sleep, stage, stash, step, timeout,
This is my pipeline code- import groovy.json.JsonOutput
// Change the light id to the one you want to use. LIGHT_ID = 1 // Change to your Jenkins secret text credential IDs for your Hue Bridge IP address and username. CREDENTIALS_ID_IP = 'xx.xx.xx.xx' CREDENTIALS_ID_USER = 'xxxxxxxxxxxxx'
final def XY_RED = [0.692, 0.308] final def XY_GREEN = [0.17, 0.7] final def XY_BLUE = [0.153, 0.048] final def XY_YELLOW = [0.511, 0.444] final def XY_PURPLE = [0.208, 0.088] final def XY_GREY = [0.323, 0.329]
final int BRI_MAX = 254 pipeline { agent any
post { success { notifyWithPhilipsHueLight([xy: XY_GREEN, bri: BRI_MAX, alert: 'none', transitiontime: 1, on: true]) } failure { notifyWithPhilipsHueLight([xy: XY_RED, bri: BRI_MAX, alert: 'none', transitiontime: 1, on: true]) } unstable { notifyWithPhilipsHueLight([xy: XY_YELLOW, bri: BRI_MAX, alert: 'none', transitiontime: 1, on: true]) } } //post
} //pipeline
Thanks, Shruti