Trigger a job for every Jenkins update automatically
I am trying to run a job in Jenkins automatically every time my Jenkins restarts or update my Jenkins instance. Any insight of how to do would be appreciated. -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8e0a8e20-ae8a-41be-b04f-014af6b27572n%40googlegroups.com.
Jenkins pipeline build not happening automatically upon code push to GitHub
Hi Team, Recently we have migrated from Bit bucket to Github and I am trying to update the existing Jenkins pipeline bitbucket web-book with the Github webhook and when we are trying to push the code pipeline build is not working.(Automatic trigger is not happening) When I try to trigger the pipeline manually it is working. Can someone please help? Screenshot of existing Jenkins pipeline configuration. [image: image.png] -- Thanks & Regards Venkat -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAF-cHwwVR7rX7gEKkw9nXaNQtoi7VtBXzWABZ%3DR1xhecSojTCQ%40mail.gmail.com.
setting Mailer authentication
In one of my init.groovy scripts, I'm trying to do: mailServer.setSmtpAuth(SMTPUser, SMTPPassword) But this flags an error, saying that's deprecated, and to use "authentication". But I can't find that documentation. Can anyone point me to a reference or example of using "authentication" to set mailer SMTP auth? Thanks. -Alan -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/DM6PR18MB330600D3F3FE656C936FC63EC5D99%40DM6PR18MB3306.namprd18.prod.outlook.com.
[JCasC] Configure mailer SMTP credentials
Can anyone point me to an example of using SMTP configuration with JCasC? I tried adding a bogus username and password to the "email notification" configuration and dumping the config, but the configuration comes out as: smtpPassword: "{AQAAABA...}" Can someone point to how JCasC wants the configuration to include an SMTP user/password? Thanks in advance. -Alan -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/DM6PR18MB3306D9D415A16C5F5670034BC5D99%40DM6PR18MB3306.namprd18.prod.outlook.com.
Re: Any way to construct a url to a particular file in the jenkins workspace?
Humm, that would be hard and security unwise. The executing node path aren't available to the web. If you are on a secure local network and you really want to go down that road, you need to 1. mount the slave nodes into the master node local path that would be accessible by the jenkins web process. 2. You need to expose those path to the web master node (this is a security breach). 3. You would have to make relative path from the node, then recreate the path to the web local web path. I think it would be easier to just gather artifacts and make them available to jenkins results. Example from the number above: slave node (SLAVE1) path: /myjenkinsworkspace/projectA/MyPathIWant master node mount (do this for every slave node you need): $SLAVE1:/myjenkinsworkspace /MyJenkinsSlaveAccess/Slave1 Expose the whole /MyJenkinsSlaveAccess/ to the Jenkins web (this is a huge security breach), depend how you serve the jenkins to the web, configure the share (build in, ngix, apache...) then convert the MyPathIWant to a valid jenkins url: /myjenkinsworkspace/projectA/MyPathIWant --> http://myjenkins/MyJenkinsSlaveAccess/Salve1/MyPathIWant That would work, but I would not recommand that. On Monday, September 13, 2021 at 11:28:11 AM UTC-4 davidmic...@gmail.com wrote: > Thanks for the reply, but I think you've misunderstood the problem. > Getting, using, and publishing the filesystem path to the file is not a > problem. What I need to do is create a functional url to that file, which I > can print in the Jenkins build output, which a user can click to get to > that file. > > On Monday, September 13, 2021 at 6:40:56 AM UTC-7 jerome.god...@gmail.com > wrote: > >> Some helper I made for my scripted: >> >> Path conversion: >> *def ToWindowsPath(path) {* >> *return path.replace("/", "\\");* >> *}* >> >> *def ToUnixPath(path) {* >> *return path.replace("\\","/");* >> *}* >> >> *def ToNativePath(path) {* >> *if(isUnix()) {* >> *return ToUnixPath(path);* >> * }* >> *return ToWindowsPath(path);* >> *}* >> >> *def RemoveLastChar(str) {* >> *return str.substring(0, str.length() - 1);* >> *}* >> >> *def RemoveFirstChar(str) {* >> *return str.substring(1, str.length());* >> *}* >> >> Joining path part: >> *def PathJoin(path1, path2) {* >> *String p1 = ToUnixPath(path1);* >> *String p2 = ToUnixPath(path2);* >> *if(p1.length() > 1 && p1.endsWith("/")) {* >> *p1 = RemoveLastChar(p1);* >> * }* >> *if(p2.startsWith("/")) {* >> *p2 = RemoveFirstChar(p2);* >> * }* >> *if(p1 == "/") {* >> *return p1 + p2;* >> * }* >> *if(p1.length() == 0) {* >> *return p2;* >> * }* >> *if(p2.length() == 0) {* >> *return p1;* >> * }* >> *return p1 + "/" + p2;* >> *}* >> >> *def PathsJoin(paths) {* >> *String result_path = "";* >> *if(paths instanceof List && paths.size() > 0) {* >> *result_path = paths[0];* >> *for(int i = 1; i < paths.size(); ++i) {* >> *result_path = PathJoin(result_path, paths[i]);* >> * }* >> * }* >> *return result_path;* >> *}* >> >> And to get the workspace root, you can use the pwd command, when the >> script start onto the node, the current dir is the workspace, so you could >> save it into a var with pwd command at the beginning. After use the path >> join above to recreate some path. >> >> https://www.jenkins.io/doc/pipeline/steps/workflow-basic-steps/#pwd-determine-current-directory >> >> >> On Monday, September 13, 2021 at 2:30:18 AM UTC-4 ice...@googlemail.com >> wrote: >> >>> Hi, >>> >>> no, not really. Especially as workspaces typically are reused between >>> jobs such an URL would be at leas open to surprise. Best practice is to >>> archive such files (log output, generated files. ) as artifacts to get >>> persistence. >>> >>> Björn >>> >>> davidmic...@gmail.com schrieb am Freitag, 10. September 2021 um >>> 22:09:36 UTC+2: >>> I do notice that my build has a "BUILD_URL" var in the environment, so that gives me the "prefix" of the url, but the url to the file in the workspace has pieces like the following after the BUILD_URL value: "/execution/node/22/ws/". I don't see anything else in the environment that can help me construct that part of the url. On Friday, September 10, 2021 at 9:22:16 AM UTC-7 David Karr wrote: > When a Jenkins build completes, I can navigate to "Workspaces" to > manually inspect files in the workspace. While I'm navigating that tree, > and viewing specific files, I can see that the current browser url goes > directly to that point in the tree, and to the specific file I am viewing. > > Is there a practical way in a Jenkins scripted pipeline, to CONSTRUCT > a url to a file in the workspace so I can print it out in the log, to > enable a single click to get to a particular file? > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email
Re: Any way to construct a url to a particular file in the jenkins workspace?
Thanks for the reply, but I think you've misunderstood the problem. Getting, using, and publishing the filesystem path to the file is not a problem. What I need to do is create a functional url to that file, which I can print in the Jenkins build output, which a user can click to get to that file. On Monday, September 13, 2021 at 6:40:56 AM UTC-7 jerome.god...@gmail.com wrote: > Some helper I made for my scripted: > > Path conversion: > *def ToWindowsPath(path) {* > *return path.replace("/", "\\");* > *}* > > *def ToUnixPath(path) {* > *return path.replace("\\","/");* > *}* > > *def ToNativePath(path) {* > *if(isUnix()) {* > *return ToUnixPath(path);* > * }* > *return ToWindowsPath(path);* > *}* > > *def RemoveLastChar(str) {* > *return str.substring(0, str.length() - 1);* > *}* > > *def RemoveFirstChar(str) {* > *return str.substring(1, str.length());* > *}* > > Joining path part: > *def PathJoin(path1, path2) {* > *String p1 = ToUnixPath(path1);* > *String p2 = ToUnixPath(path2);* > *if(p1.length() > 1 && p1.endsWith("/")) {* > *p1 = RemoveLastChar(p1);* > * }* > *if(p2.startsWith("/")) {* > *p2 = RemoveFirstChar(p2);* > * }* > *if(p1 == "/") {* > *return p1 + p2;* > * }* > *if(p1.length() == 0) {* > *return p2;* > * }* > *if(p2.length() == 0) {* > *return p1;* > * }* > *return p1 + "/" + p2;* > *}* > > *def PathsJoin(paths) {* > *String result_path = "";* > *if(paths instanceof List && paths.size() > 0) {* > *result_path = paths[0];* > *for(int i = 1; i < paths.size(); ++i) {* > *result_path = PathJoin(result_path, paths[i]);* > * }* > * }* > *return result_path;* > *}* > > And to get the workspace root, you can use the pwd command, when the > script start onto the node, the current dir is the workspace, so you could > save it into a var with pwd command at the beginning. After use the path > join above to recreate some path. > > https://www.jenkins.io/doc/pipeline/steps/workflow-basic-steps/#pwd-determine-current-directory > > > On Monday, September 13, 2021 at 2:30:18 AM UTC-4 ice...@googlemail.com > wrote: > >> Hi, >> >> no, not really. Especially as workspaces typically are reused between >> jobs such an URL would be at leas open to surprise. Best practice is to >> archive such files (log output, generated files. ) as artifacts to get >> persistence. >> >> Björn >> >> davidmic...@gmail.com schrieb am Freitag, 10. September 2021 um 22:09:36 >> UTC+2: >> >>> I do notice that my build has a "BUILD_URL" var in the environment, so >>> that gives me the "prefix" of the url, but the url to the file in the >>> workspace has pieces like the following after the BUILD_URL value: >>> "/execution/node/22/ws/". I don't see anything else in the environment that >>> can help me construct that part of the url. >>> >>> On Friday, September 10, 2021 at 9:22:16 AM UTC-7 David Karr wrote: >>> When a Jenkins build completes, I can navigate to "Workspaces" to manually inspect files in the workspace. While I'm navigating that tree, and viewing specific files, I can see that the current browser url goes directly to that point in the tree, and to the specific file I am viewing. Is there a practical way in a Jenkins scripted pipeline, to CONSTRUCT a url to a file in the workspace so I can print it out in the log, to enable a single click to get to a particular file? >>> -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/dbd45854-9e8f-402e-9243-29a1181b6257n%40googlegroups.com.
Re: Any way to construct a url to a particular file in the jenkins workspace?
Some helper I made for my scripted: Path conversion: *def ToWindowsPath(path) {* *return path.replace("/", "\\");* *}* *def ToUnixPath(path) {* *return path.replace("\\","/");* *}* *def ToNativePath(path) {* *if(isUnix()) {* *return ToUnixPath(path);* * }* *return ToWindowsPath(path);* *}* *def RemoveLastChar(str) {* *return str.substring(0, str.length() - 1);* *}* *def RemoveFirstChar(str) {* *return str.substring(1, str.length());* *}* Joining path part: *def PathJoin(path1, path2) {* *String p1 = ToUnixPath(path1);* *String p2 = ToUnixPath(path2);* *if(p1.length() > 1 && p1.endsWith("/")) {* *p1 = RemoveLastChar(p1);* * }* *if(p2.startsWith("/")) {* *p2 = RemoveFirstChar(p2);* * }* *if(p1 == "/") {* *return p1 + p2;* * }* *if(p1.length() == 0) {* *return p2;* * }* *if(p2.length() == 0) {* *return p1;* * }* *return p1 + "/" + p2;* *}* *def PathsJoin(paths) {* *String result_path = "";* *if(paths instanceof List && paths.size() > 0) {* *result_path = paths[0];* *for(int i = 1; i < paths.size(); ++i) {* *result_path = PathJoin(result_path, paths[i]);* * }* * }* *return result_path;* *}* And to get the workspace root, you can use the pwd command, when the script start onto the node, the current dir is the workspace, so you could save it into a var with pwd command at the beginning. After use the path join above to recreate some path. https://www.jenkins.io/doc/pipeline/steps/workflow-basic-steps/#pwd-determine-current-directory On Monday, September 13, 2021 at 2:30:18 AM UTC-4 ice...@googlemail.com wrote: > Hi, > > no, not really. Especially as workspaces typically are reused between > jobs such an URL would be at leas open to surprise. Best practice is to > archive such files (log output, generated files. ) as artifacts to get > persistence. > > Björn > > davidmic...@gmail.com schrieb am Freitag, 10. September 2021 um 22:09:36 > UTC+2: > >> I do notice that my build has a "BUILD_URL" var in the environment, so >> that gives me the "prefix" of the url, but the url to the file in the >> workspace has pieces like the following after the BUILD_URL value: >> "/execution/node/22/ws/". I don't see anything else in the environment that >> can help me construct that part of the url. >> >> On Friday, September 10, 2021 at 9:22:16 AM UTC-7 David Karr wrote: >> >>> When a Jenkins build completes, I can navigate to "Workspaces" to >>> manually inspect files in the workspace. While I'm navigating that tree, >>> and viewing specific files, I can see that the current browser url goes >>> directly to that point in the tree, and to the specific file I am viewing. >>> >>> Is there a practical way in a Jenkins scripted pipeline, to CONSTRUCT a >>> url to a file in the workspace so I can print it out in the log, to enable >>> a single click to get to a particular file? >>> >> -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/14c806a7-7337-48a1-9cb7-c2a112a99372n%40googlegroups.com.
Re: Any way to construct a url to a particular file in the jenkins workspace?
Hi, no, not really. Especially as workspaces typically are reused between jobs such an URL would be at leas open to surprise. Best practice is to archive such files (log output, generated files. ) as artifacts to get persistence. Björn davidmic...@gmail.com schrieb am Freitag, 10. September 2021 um 22:09:36 UTC+2: > I do notice that my build has a "BUILD_URL" var in the environment, so > that gives me the "prefix" of the url, but the url to the file in the > workspace has pieces like the following after the BUILD_URL value: > "/execution/node/22/ws/". I don't see anything else in the environment that > can help me construct that part of the url. > > On Friday, September 10, 2021 at 9:22:16 AM UTC-7 David Karr wrote: > >> When a Jenkins build completes, I can navigate to "Workspaces" to >> manually inspect files in the workspace. While I'm navigating that tree, >> and viewing specific files, I can see that the current browser url goes >> directly to that point in the tree, and to the specific file I am viewing. >> >> Is there a practical way in a Jenkins scripted pipeline, to CONSTRUCT a >> url to a file in the workspace so I can print it out in the log, to enable >> a single click to get to a particular file? >> > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3124e21e-9b34-4359-9e83-d0401ac64ec0n%40googlegroups.com.