zxiiro | ugh this requests stuff just makes me feel stupid heh | 00:40 |
---|---|---|
*** kien-ha has quit IRC | 01:19 | |
openstackgerrit | Merged openstack-infra/jenkins-job-builder master: Add discover-tags to multibranch pipeline project https://review.openstack.org/573646 | 01:31 |
openstackgerrit | Merged openstack-infra/jenkins-job-builder master: Use convert_mapping_to_xml helper function https://review.openstack.org/571096 | 01:35 |
openstackgerrit | Merged openstack-infra/jenkins-job-builder master: Add trigger-from-child-projects option. https://review.openstack.org/573210 | 01:47 |
*** hashar has joined #openstack-jjb | 05:52 | |
*** kien-ha has joined #openstack-jjb | 06:24 | |
*** beiske has joined #openstack-jjb | 07:02 | |
beiske | When is the next release planned for? | 07:04 |
beiske | And thank you for accepting my patch :-) | 07:50 |
*** electrofelix has joined #openstack-jjb | 08:16 | |
*** kien-ha has quit IRC | 08:54 | |
ssbarnea | beiske: 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 |
ssbarnea | if 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 |
beiske | Thanks, 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 |
zxiiro | beiske: 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 |
zxiiro | sorry I mean every 2nd Friday | 13:47 |
openstackgerrit | Merged openstack-infra/jenkins-job-builder master: Change default on fail_required parameter to True for convert xml https://review.openstack.org/346140 | 14:31 |
zxiiro | electrofelix: 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 |
zxiiro | i wonder if perhaps we're sending it a syntax error? with our encoding? | 14:41 |
zxiiro | omg I think I fixed it | 15:04 |
zxiiro | it still doesn't return the result thought but at least I think ti runs the script now | 15:05 |
zxiiro | now if I can figure out the output of requests.Request maybe I cna figure out how to return the result | 15:07 |
zxiiro | fixed finally | 15:12 |
zxiiro | banged me head on this thing for over 3 hrs yesterday only to discover the solution was so simple :/ | 15:13 |
zxiiro | s/me/my/ | 15:13 |
openstackgerrit | Thanh Ha proposed openstack/python-jenkins master: Fix run_scripts() API https://review.openstack.org/574302 | 15:22 |
openstackgerrit | qingszhao proposed openstack-infra/jenkins-job-builder master: fix tox python3 overrides https://review.openstack.org/574305 | 15:28 |
electrofelix | zxiiro: sorry was busy giving a presentation | 15:40 |
zxiiro | electrofelix: no worries. I think I finally got a working fix for that issue ^ | 15:40 |
electrofelix | is there any way to test the call? | 15:41 |
zxiiro | electrofelix: I tested it using my own app but I guess I could probably write a minimal test script | 15:42 |
electrofelix | zxiiro: I was thinking just something like a 'println("hello world");' script where we check that what is being sent is formatted correctly | 15:44 |
electrofelix | still sucks that there isn't a useful response from the API though | 15:45 |
electrofelix | https://wiki.jenkins.io/display/JENKINS/Jenkins+Script+Console suggests that we should get something back? | 15:47 |
zxiiro | electrofelix: I pasted a minimal python script for testing. | 15:47 |
zxiiro | electrofelix: we do, it returns the console output of whatever the script returns | 15:47 |
zxiiro | electrofelix: if it's a script that has no output it simply returns "result: True" | 15:47 |
zxiiro | electrofelix: I think the bug in the script was causing it to return nothing. | 15:48 |
electrofelix | Can we use that to confirm that the script ran? | 15:48 |
zxiiro | electrofelix: 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 |
electrofelix | so 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 |
zxiiro | but I think it would be harder to detect failure than that the script ran. | 15:49 |
zxiiro | electrofelix: 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 |
zxiiro | at least that's what I think... I'm not 100% sure on that statement. | 15:50 |
electrofelix | so 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 |
zxiiro | as 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 |
zxiiro | electrofelix: yeah that's probably the safest assumption until we know 100% what kind of content comes bakc. | 15:51 |
electrofelix | cool | 15:51 |
electrofelix | well need to drop, I've a coderdojo meetup to attend | 15:51 |
zxiiro | electrofelix: alright, take care. I'll see if i can add error handling to the script later. | 15:52 |
*** electrofelix has quit IRC | 15:53 | |
*** kien-ha has joined #openstack-jjb | 16:19 | |
openstackgerrit | qingszhao proposed openstack-infra/jenkins-job-builder master: fix tox python3 overrides https://review.openstack.org/574334 | 16:44 |
openstackgerrit | Thanh Ha proposed openstack/python-jenkins master: Fix run_scripts() API https://review.openstack.org/574302 | 17:20 |
*** ckonstanski has quit IRC | 18:06 | |
openstackgerrit | Kien Ha proposed openstack-infra/jenkins-job-builder master: Correct doc for deprecation version of git skip-tag https://review.openstack.org/574389 | 19:15 |
openstackgerrit | Thanh Ha proposed openstack/python-jenkins master: Fix run_scripts() API https://review.openstack.org/574302 | 19:23 |
ssbarnea | zxiiro: 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 |
zxiiro | ssbarnea: huh, it should... let me retry with a fresh environment just to make sure | 20:00 |
ssbarnea | i 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 |
zxiiro | ssbarnea: just tried with a completely fresh virtualenv and installed my patch with "pip install -e ." and I get stuff returned. | 20:02 |
ssbarnea | like a "try { <body> } final { print "EXECT WORKED" }". | 20:03 |
zxiiro | you should see something like this: | 20:03 |
zxiiro | $ python /tmp/script.py | 20:03 |
zxiiro | Hello zxiiro from Jenkins 2.107.3 | 20: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 |
zxiiro | Plugin: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 |
zxiiro | Plugin:extended-read-permission, Plugin:credentials, Plugin:structs, Plugin:display-url-api, Plugin:mailer, Plugin:ldap, Plugin:icon-shim] | 20:03 |
zxiiro | ssbarnea: not sure, but Jenkins just returns text and it can be any kind of console text so it's pretty free form. | 20:04 |
zxiiro | we wouldn't want to falsely fail if someone sent a script that just doesn't output anything on purpose. | 20:04 |
ssbarnea | yep, so we just need to put some special key in output, so we would know if jenkins managed to run the code or not | 20:05 |
ssbarnea | if the output ends with our magic key, we consider command a success. | 20:06 |
ssbarnea | otherwise is extreamly easy to break and very hard to realise it | 20:07 |
ssbarnea | i don't know what happens but on my machine i get not list of plugins | 20:07 |
ssbarnea | and I did download your patch, which is installed with -e | 20:08 |
zxiiro | hmm very odd | 20:08 |
zxiiro | I'm using python version 3.6.5 if it helps | 20:09 |
zxiiro | and requests version should be whatever is pulled in by python-jenkins | 20:10 |
zxiiro | ssbarnea: do you at least get the "Hello user from Jenkins..." print? | 20:10 |
ssbarnea | yes, with correct user and version, also did a get_plugins_info() which also worked | 20:11 |
zxiiro | ssbarnea: 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 |
ssbarnea | but the run_script() prints nothing. i will dig more to see what happens. | 20:12 |
zxiiro | groovy scripts require admin accesss | 20:12 |
ssbarnea | print(server.run_script('println(Jenkins.instance.pluginManager.plugins)')) | 20:12 |
ssbarnea | even tried print(server.run_script('xxxprintln(Jenkins.instance.pluginManager.plugins)')) | 20:12 |
ssbarnea | some result | 20:12 |
ssbarnea | and I was expecting a failure on the last | 20:13 |
zxiiro | ssbarnea: double check the account your using has the administrator account in the Jenkins Security page. | 20:13 |
zxiiro | ssbarnea: no run_script will never return a failure. (unless it's auth) | 20:13 |
ssbarnea | it is admin because it would not be able to list the plugins | 20:13 |
zxiiro | if you use a bad credential you'll see a failure | 20:13 |
zxiiro | other than that, it will never fail | 20:13 |
zxiiro | which is kinda crappy for troubleshooting :( | 20:14 |
ssbarnea | yep, this is why i was proposing to add an implicit groovy wrapper around the passed script. | 20:14 |
ssbarnea | so we would assure that something is printed if the code runs. | 20:15 |
ssbarnea | or else we will be domed to get reports of broken run_script() | 20:15 |
zxiiro | right that might work. | 20:15 |
zxiiro | so if we wrap something at the end if run_script() never makes it to the end of the script we knows it failed | 20:15 |
ssbarnea | exactly | 20:16 |
ssbarnea | and we can even remove our magic key when we return the output | 20:16 |
ssbarnea | add it in groovy, verify it in python, remove it, return sanitized output | 20:16 |
zxiiro | ssbarnea: can you leave a comment on the patch? I can investigate doing that a bit later. | 20:16 |
ssbarnea | sure | 20:17 |
ssbarnea | did it. btw, my test was on Jenkins 2.107.3 | 20:22 |
zxiiro | ok very odd... i wonder why we both get different results | 20:23 |
zxiiro | ssbarnea: 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.groovy | 20:25 |
zxiiro | it sets the git user.name and user.email in global config | 20:25 |
ssbarnea | nothing changed on the server, nothing logged, i am inclined to believe nothing is reaching jenkins in that case | 20:29 |
*** hashar has quit IRC | 20:44 | |
openstackgerrit | Merged openstack-infra/jenkins-job-builder master: Correct doc for deprecation version of git skip-tag https://review.openstack.org/574389 | 22:44 |
Generated by irclog2html.py 2.15.3 by Marius Gedminas - find it at mg.pov.lt!