Monday, 2018-06-11

zxiirough this requests stuff just makes me feel stupid heh00:40
*** kien-ha has quit IRC01:19
openstackgerritMerged openstack-infra/jenkins-job-builder master: Add discover-tags to multibranch pipeline project  https://review.openstack.org/57364601:31
openstackgerritMerged openstack-infra/jenkins-job-builder master: Use convert_mapping_to_xml helper function  https://review.openstack.org/57109601:35
openstackgerritMerged openstack-infra/jenkins-job-builder master: Add trigger-from-child-projects option.  https://review.openstack.org/57321001:47
*** hashar has joined #openstack-jjb05:52
*** kien-ha has joined #openstack-jjb06:24
*** beiske has joined #openstack-jjb07:02
beiskeWhen is the next release planned for?07:04
beiskeAnd thank you for accepting my patch :-)07:50
*** electrofelix has joined #openstack-jjb08:16
*** kien-ha has quit IRC08:54
ssbarneabeiske: historically we use to release every other Friday, when there is a need for it, but honestly there is not guarantee unless someone pings us on Friday to do it.09:11
ssbarneaif there is an important fix, clearly we will make a release. if now, it can wait. still, I think it should be safe for you to use jjb from git master branch.09:12
beiskeThanks, for the explanation. It was just a minor feature added from my side, so nothing that warrants an out of cycle release, but if somebody has time to cut a release this Friday that suits me just perfect.09:23
zxiirobeiske: ssbarnea next release is this Friday. I have a calendar reminder to do it every Friday but if I'm on vacation I skip that week.13:47
zxiirosorry I mean every 2nd Friday13:47
openstackgerritMerged openstack-infra/jenkins-job-builder master: Change default on fail_required parameter to True for convert xml  https://review.openstack.org/34614014:31
zxiiroelectrofelix: I've been banging my head about that run_script issue this weekend. I can get Jenkins' example using "requests.post()" working but something about the way we handle it in python-jenkins using requests.Request() seems to break. I can confirm it runs 200 OK though which is odd considering the groovy script doesn't run.14:41
zxiiroi wonder if perhaps we're sending it a syntax error? with our encoding?14:41
zxiiroomg I think I fixed it15:04
zxiiroit still doesn't return the result thought but at least I think ti runs the script now15:05
zxiironow if I can figure out the output of requests.Request maybe I cna figure out how to return the result15:07
zxiirofixed finally15:12
zxiirobanged me head on this thing for over 3 hrs yesterday only to discover the solution was so simple :/15:13
zxiiros/me/my/15:13
openstackgerritThanh Ha proposed openstack/python-jenkins master: Fix run_scripts() API  https://review.openstack.org/57430215:22
openstackgerritqingszhao proposed openstack-infra/jenkins-job-builder master: fix tox python3 overrides  https://review.openstack.org/57430515:28
electrofelixzxiiro: sorry was busy giving a presentation15:40
zxiiroelectrofelix: no worries. I think I finally got a working fix for that issue ^15:40
electrofelixis there any way to test the call?15:41
zxiiroelectrofelix: I tested it using my own app but I guess I could probably write a minimal test script15:42
electrofelixzxiiro: I was thinking just something like a 'println("hello world");' script where we check that what is being sent is formatted correctly15:44
electrofelixstill sucks that there isn't a useful response from the API though15:45
electrofelixhttps://wiki.jenkins.io/display/JENKINS/Jenkins+Script+Console suggests that we should get something back?15:47
zxiiroelectrofelix: I pasted a minimal python script for testing.15:47
zxiiroelectrofelix: we do, it returns the console output of whatever the script returns15:47
zxiiroelectrofelix: if it's a script that has no output it simply returns "result: True"15:47
zxiiroelectrofelix: I think the bug in the script was causing it to return nothing.15:48
electrofelixCan we use that to confirm that the script ran?15:48
zxiiroelectrofelix: I believe so. If you get any amount of text back then the script has run. (and i suspect "result: False" in some cases means it failed)15:49
electrofelixso we should have been checking the output via JJB as well to report an error if we didn't get 'result: True' back?15:49
zxiirobut I think it would be harder to detect failure than that the script ran.15:49
zxiiroelectrofelix: we only get "result: True|False" IF the script has no output. If the script calls println then we will never see the "result: True|False" instead awe only see the println outputs.15:50
zxiiroat least that's what I think... I'm not 100% sure on that statement.15:50
electrofelixso I guess we just check for output in the response and error if no content, and leave it to the caller to inspect the response otherwise?15:51
zxiiroas I'm not sure where result: True|False comes from. maybe it comes from the cloud.save() command I call in some of my scripts.15:51
zxiiroelectrofelix: yeah that's probably the safest assumption until we know 100% what kind of content comes bakc.15:51
electrofelixcool15:51
electrofelixwell need to drop, I've a coderdojo meetup to attend15:51
zxiiroelectrofelix: alright, take care. I'll see if i can add error handling to the script later.15:52
*** electrofelix has quit IRC15:53
*** kien-ha has joined #openstack-jjb16:19
openstackgerritqingszhao proposed openstack-infra/jenkins-job-builder master: fix tox python3 overrides  https://review.openstack.org/57433416:44
openstackgerritThanh Ha proposed openstack/python-jenkins master: Fix run_scripts() API  https://review.openstack.org/57430217:20
*** ckonstanski has quit IRC18:06
openstackgerritKien Ha proposed openstack-infra/jenkins-job-builder master: Correct doc for deprecation version of git skip-tag  https://review.openstack.org/57438919:15
openstackgerritThanh Ha proposed openstack/python-jenkins master: Fix run_scripts() API  https://review.openstack.org/57430219:23
ssbarneazxiiro: i tried your patch for run script but apparently it does not return anything, even if your example has a print on it.19:59
zxiirossbarnea: huh, it should... let me retry with a fresh environment just to make sure20:00
ssbarneai wonder if it would not make sense to add an implicit groovy wrapper that returns something on stdout, so we would be able to check its execution result.20:02
zxiirossbarnea: just tried with a completely fresh virtualenv and installed my patch with "pip install -e ." and I get stuff returned.20:02
ssbarnealike a "try { <body> } final { print "EXECT WORKED" }".20:03
zxiiroyou should see something like this:20:03
zxiiro$ python /tmp/script.py20:03
zxiiroHello zxiiro from Jenkins 2.107.320:03
zxiiro[Plugin:envinject, Plugin:apache-httpcomponents-client-4-api, Plugin:git-client, Plugin:workflow-scm-step, Plugin:jsch, Plugin:script-security, Plugin:command-launcher, Plugin:matrix-auth, Plugin:bouncycastle-api, Plugin:workflow-step-api, Plugin:scm-api, Plugin:workflow-api, Plugin:junit, Plugin:ssh-credentials, Plugin:ssh-agent, Plugin:plain-credentials, Plugin:workflow-support, Plugin:durable-task,20:03
zxiiroPlugin:workflow-durable-task-step, Plugin:matrix-project, Plugin:resource-disposer, Plugin:ws-cleanup, Plugin:cloud-stats, Plugin:token-macro, Plugin:config-file-provider, Plugin:ssh-slaves, Plugin:timestamper, Plugin:envinject-api, Plugin:postbuildscript, Plugin:description-setter, Plugin:antisamy-markup-formatter, Plugin:openstack-cloud, Plugin:github-api, Plugin:git, Plugin:github, Plugin:jackson2-api, Plugin:ghprb,20:03
zxiiroPlugin:extended-read-permission, Plugin:credentials, Plugin:structs, Plugin:display-url-api, Plugin:mailer, Plugin:ldap, Plugin:icon-shim]20:03
zxiirossbarnea: not sure, but Jenkins just returns text and it can be any kind of console text so it's pretty free form.20:04
zxiirowe wouldn't want to falsely fail if someone sent a script that just doesn't output anything on purpose.20:04
ssbarneayep, so we just need to put some special key in output, so we would know if jenkins managed to run the code or not20:05
ssbarneaif the output ends with our magic key, we consider command a success.20:06
ssbarneaotherwise is extreamly easy to break and very hard to realise it20:07
ssbarneai don't know what happens but on my machine i get not list of plugins20:07
ssbarneaand I did download your patch, which is installed with -e20:08
zxiirohmm very odd20:08
zxiiroI'm using python version 3.6.5 if it helps20:09
zxiiroand requests version should be whatever is pulled in by python-jenkins20:10
zxiirossbarnea: do you at least get the "Hello user from Jenkins..."  print?20:10
ssbarneayes, with correct user and version, also did a get_plugins_info() which also worked20:11
zxiirossbarnea: only other thing i can think of is if you're user you are using with python-jenkins is missing the "administrator" permission.20:11
ssbarneabut the run_script() prints nothing. i will dig more to see what happens.20:12
zxiirogroovy scripts require admin accesss20:12
ssbarneaprint(server.run_script('println(Jenkins.instance.pluginManager.plugins)'))20:12
ssbarneaeven tried print(server.run_script('xxxprintln(Jenkins.instance.pluginManager.plugins)'))20:12
ssbarneasome result20:12
ssbarneaand I was expecting a failure on the last20:13
zxiirossbarnea: double check the account your using has the administrator account in the Jenkins Security page.20:13
zxiirossbarnea: no run_script will never return a failure. (unless it's auth)20:13
ssbarneait is admin because it would not be able to list the plugins20:13
zxiiroif you use a bad credential you'll see a failure20:13
zxiiroother than that, it will never fail20:13
zxiirowhich is kinda crappy for troubleshooting :(20:14
ssbarneayep, this is why i was proposing to add an implicit groovy wrapper around the passed script.20:14
ssbarneaso we would assure that something is printed if the code runs.20:15
ssbarneaor else we will be domed to get reports of broken run_script()20:15
zxiiroright that might work.20:15
zxiiroso if we wrap something at the end if run_script() never makes it to the end of the script  we knows it failed20:15
ssbarneaexactly20:16
ssbarneaand we can even remove our magic key when we return the output20:16
ssbarneaadd it in groovy, verify it in python, remove it, return sanitized output20:16
zxiirossbarnea: can you leave a comment on the patch? I can investigate doing that a bit later.20:16
ssbarneasure20:17
ssbarneadid it. btw, my test was on Jenkins 2.107.320:22
zxiirook very odd... i wonder why we both get different results20:23
zxiirossbarnea: curious if it's just not printing and actually ran on the server side or not. Maybe you can run some script that modifies something on the server side like this one: https://github.com/hayderimran7/useful-jenkins-groovy-init-scripts/blob/master/set_git_global_config.groovy20:25
zxiiroit sets the git user.name and user.email in global config20:25
ssbarneanothing changed on the server, nothing logged, i am inclined to believe nothing is reaching jenkins in that case20:29
*** hashar has quit IRC20:44
openstackgerritMerged openstack-infra/jenkins-job-builder master: Correct doc for deprecation version of git skip-tag  https://review.openstack.org/57438922:44

Generated by irclog2html.py 2.15.3 by Marius Gedminas - find it at mg.pov.lt!