Re: how to login to jenkins with third party sso from python scripts

2020-06-23 Thread Richard Bywater
https://www.jenkins.io/doc/book/system-administration/authenticating-scripted-clients/
will
hopefully get you started.

Richard.

On Wed, 24 Jun 2020 at 16:53, Lokeshwaran  wrote:

> Where do we get this API token from
>
> On Wednesday, June 17, 2015 at 12:50:28 PM UTC+5:30, Sushant Gupta wrote:
>>
>> Hi All,
>>
>> I don't know if anyone tried to login to sso enabled jenkins server from
>> python api.
>>
>> I need to automate jenkins, It is very easy to login to jenkins from
>> python with its local-user/password. But our jenkins server is configured
>> with assembla sso and I am not able to login through jenkins.jenkins python
>> module. Can any oen suggest how to login to jenkins server with third party
>> sso configuration.
>> python api docs:
>> https://python-jenkins.readthedocs.org/en/latest/api.html
>>
>> I am open to use any other module.
>>
>> import jenkins
>> j = jenkins.Jenkins('http://your_url_here', 'username', 'password')
>> j.get_jobs()
>>
>>
>> Regards,
>> Sushant
>>
> --
> 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/2e41317c-832c-460b-9bbd-4220dc850b60o%40googlegroups.com
> 
> .
>

-- 
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/CAAy0hwe%3DjSh%2BZD_86NE7dgOWqTvdDD8GVm%3DqAv_wpwondLwkpQ%40mail.gmail.com.


Re: how to login to jenkins with third party sso from python scripts

2020-06-23 Thread Lokeshwaran
Where do we get this API token from

On Wednesday, June 17, 2015 at 12:50:28 PM UTC+5:30, Sushant Gupta wrote:
>
> Hi All,
>
> I don't know if anyone tried to login to sso enabled jenkins server from 
> python api.
>
> I need to automate jenkins, It is very easy to login to jenkins from 
> python with its local-user/password. But our jenkins server is configured 
> with assembla sso and I am not able to login through jenkins.jenkins python 
> module. Can any oen suggest how to login to jenkins server with third party 
> sso configuration.
> python api docs: https://python-jenkins.readthedocs.org/en/latest/api.html
>
> I am open to use any other module.
>
> import jenkins
> j = jenkins.Jenkins('http://your_url_here', 'username', 'password')
> j.get_jobs()
>
>
> Regards,
> Sushant
>

-- 
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/2e41317c-832c-460b-9bbd-4220dc850b60o%40googlegroups.com.


Re: How to integrate Jenkins with Google LDAP service

2020-06-23 Thread Mukesh Yadav
Hello Alex 
do you get any success in jenkins integration with stunnel?

On Tuesday, February 12, 2019 at 9:45:27 PM UTC+5:30, Alex Domoradov wrote:
>
> Any advise?
>
> On Monday, February 11, 2019 at 1:37:45 PM UTC+2, Alex Domoradov wrote:
>>
>> Hello,
>>
>> Does anyone has successes in such kind of integration? Because Google 
>> LDAP service requires certificate authentication I can't point Jenkins 
>> directly to the ldaps://ldap.google.com. I have tried to use stunnel but 
>> without success.
>>
>> Jenkins: 2.150.2
>> LDAP plugin: 1.20
>>
>> Jenkins settings
>>
>> https://i.imgur.com/rShdcmR.png
>>
>> https://i.imgur.com/RC0crE9.png
>>
>> 172.17.0.1 is the address of stunnel. I use the following config with 
>> stunnel
>>
>> # cat /etc/stunnel/ldap.conf 
>> [ldap]
>> client = yes
>> accept = 127.0.0.1:389
>> connect = ldap.google.com:636
>> cert = /etc/stunnel/gldap.crt
>> key = /etc/stunnel/gldap.key
>>
>>
>> Also I have tried to import google certificate and private key to my own 
>> keystore
>>
>> $ openssl pkcs12 -export -out ldap.google.com.pkcs12 \
>>
>> -inkey gldap.key -in gldap.crt
>>
>>
>> $ keytool -v -importkeystore -srckeystore ldap.google.com.pkcs12 \
>>
>> -srcstoretype PKCS12 -destkeystore cacerts -deststoretype JKS
>>
>>
>> and point Jenkins to it
>>
>> -Djavax.net.ssl.keyStore=/var/jenkins_home/.cacerts/cacerts 
>> -Djavax.net.ssl.keyStorePassword=changeit
>>
>>
>> But without success. Did I miss something?
>>
>>
-- 
Your feedback matters - At Knoldus we aim to be very professional in our 
quality of work, commitment to results, and proactive communication. If you 
feel otherwise please share your feedback 
 and we would work on it. 

-- 
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/6aff3646-6ba2-4f05-8a3a-4adb7c37c6eeo%40googlegroups.com.


Re: UI IllegalArgumentException regarding credentialsId parameter

2020-06-23 Thread Benjamin Paz
We are able to continue with the job by deleting the secret files and then 
re-adding to the job.  Until the screen is refreshed the UI configuration 
for that job continues to function normally.

As I have used Jenkinsfile in the past on several other projects. I believe 
the Jenkinsfile or other code solution will resolve this issue.

Please provide some feedback on the UI issue, even if it is just to say 
that the experience is the same.

On Friday, June 19, 2020 at 6:33:37 PM UTC-4, Benjamin Paz wrote:
>
> Hello,
>
> I have an easily repeatable issue that i have found in the Jenkins UI.
>
> I am using Jenkins Jenkins ver. 2.222.1 
> credentials-binding plugin 1.23
> aws-lambda plugin 0.5.10
>
> Start with a freestyle job, add a secret file into global store, named 
> Jenkins.  The job buttons to "save" or "apply" changes can be used without 
> issue. Adding the buildstep aws lambda deployment and the job can still be 
> saved. However after reloading the job then it can no longer save.. The job 
> will return the a popup with an error from the UI:
>
> This are excerpts of the stacktrace: 
>
> org.kohsuke.stapler.WrongTypeException: Got type array but no lister class 
> found for type class java.lang.String
>   at 
> org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:724)
>
>
> Caused: java.lang.IllegalArgumentException: Failed to convert the 
> credentialsId parameter of the constructor public 
> org.jenkinsci.plugins.credentialsbinding.impl.FileBinding(java.lang.String,java.lang.String)
>
>
> Caused: java.lang.IllegalArgumentException: Failed to instantiate class 
> org.jenkinsci.plugins.credentialsbinding.impl.FileBinding from 
> {"variable":"NameWasHere","includeUser":"false","credentialsId":["folder-filename.txt",""],"stapler-class":"org.jenkinsci.plugins.credentialsbinding.impl.FileBinding","$class":"org.jenkinsci.plugins.credentialsbinding.impl.FileBinding"}
> 
>
> Caused: java.lang.Error: Failed to instantiate class 
> org.jenkinsci.plugins.credentialsbinding.impl.FileBinding from 
> {"variable":"NameWasHere","includeUser":"false","credentialsId":["folder-filename.txt",""],"stapler-class":"org.jenkinsci.plugins.credentialsbinding.impl.FileBinding","$class":"org.jenkinsci.plugins.credentialsbinding.impl.FileBinding"}
>
>
> Examining the secret displayed name now contains the folder and cannot be 
> updated. The original file name from the global space was "filename.txt" but 
> now the name appears as "folder-filename.txt".   This name always was 
> presented with the folder in the config.xml file but not on the Jenkins UI. 
> Back in the Jenkins UI, the secret file configuration is unable to change the 
> "folder-filename.txt" and cannot display all of the available files in the 
> global store.
>
> Please advise,
> Ben
>
>

-- 
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/f2c166f8-f67c-4ec2-a3e3-1e4fdc081586o%40googlegroups.com.


Re: How to edit xml files through Jenkins pipeline?

2020-06-23 Thread Ivan Fernandez Calvo
Hi, 

I'd not recommend processing the XML file inside the Jenkinsfile, all the 
Groovy code you put in a Jenkins file consumes resources in the Jenkins 
instance (not in the Agent) and process an XML file can be a heavy process. 
I recommend you call a command-line tool or a Python script to process the 
file, in that way you will use only resources in the Agent. You have an 
interesting Jesse Glick presentation about this kind of thing 

How To Use Jenkins Less
https://www.youtube.com/watch?reload=9&v=Zeqc6--0eQw



El martes, 23 de junio de 2020, 6:09:50 (UTC+2), Gajanan Mahajan escribió:
>
> I've to update xml file as a part of pipeline. From following, I've to 
> replace `value` from `true` to false
>
> 
> 
>
> Also, following commented code, I've to uncomment -
>
> 
>
> Both of above snippets can be anywhere in xml file. `sed` utility won't 
> help much here. 
>
> Could you please suggest best possible approaches, solutions for this?
>

-- 
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/9662ec31-53a0-4f38-924e-6359215a200fo%40googlegroups.com.


Re: Ansible plugin problem in pipeline code

2020-06-23 Thread Yiyito
Was this solved? I´m having same issue

On Monday, November 28, 2016 at 4:42:10 PM UTC-3, Guy Knights wrote:
>
> I'm trying to use the ansible plugin in a pipeline script, but it fails to 
> find ansible-playbook. I've used the "ansibleName" parameter to supply the 
> name of the Ansible version I want to use from Jenkins' global tool config 
> page, but it still fails. I get the following when trying to execute a 
> playbook from a pipeline:
>
> [workspace] $ ansible-playbook 
>> /opt/ansible-data/playbooks/client_deploy.yml -i 
>> /opt/ansible-data/inventory/prod/ -f 5 --private-key 
>> "/var/jenkins_home/jobs/Default/jobs/Client 
>> deploy/workspace/ssh7766033036773514652.key" -u ubuntu -e wl_name=default 
>> -e client_version=761c6f24
>>
>> FATAL: command execution failed
>> java.io.IOException: Cannot run program "ansible-playbook" (in directory 
>> "/var/jenkins_home/jobs/Default/jobs/Client deploy/workspace"): error=2, No 
>> such file or directory
>>
>>
> The path to the ansible binaries has been defined in the global config 
> page as /opt/ansible/ansible-2.2/bin, and this works for normal jenkins 
> (ie. not pipeline) jobs, using the "Invoke Ansible playbook" build task.
>
> The ansible call from my Jenkinsfile is as follows:
>
> ansiblePlaybook(
> ansibleName: 'stable-2.2',
> playbook: "${ANSIBLE_DATA_PATH}/playbooks/client_deploy.yml",
> inventory: "${ANSIBLE_DATA_PATH}/inventory/${ENVIRONMENT}/",
> credentialsId: '574fb47c-33df-4096-bd0c-0c44962b2546',
> extraVars: [
> wl_name: "${wlName}",
> client_version: "${gtpCommitId}"
> ],
> additionalParameters: '--vault-password-file 
> "/var/jenkins_home/.ansible/vault.pwd" --forks=10',
> colorized: true
> ) 
>
> "stable-2.2" is the name I've given to the version of Ansible defined on 
> the global tools config page.
>
> Does anyone know why this isn't working?
>
> Thanks,
> Guy
>

-- 
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/7e448011-02bd-412e-847b-8997349962a5o%40googlegroups.com.


Sonarqube quality gate integration with Jenkins

2020-06-23 Thread venkat dev
Hi All,

I have installed and configured sonarqube quality gate in Jenkins. While 
executing jenkins job getting error.

Status => FAILED
Status => FAILED
Status => FAILED
Status => FAILED
Status => FAILED
ERROR: Build step failed with exception
org.quality.gates.sonar.api.MaxExecutionTimeException: Status => Max time to 
wait sonar job!
at 
org.quality.gates.sonar.api.QualityGatesProvider.getAPIResultsForQualityGates(QualityGatesProvider.java:82)
at 
org.quality.gates.jenkins.plugin.BuildDecision.getStatus(BuildDecision.java:24)
at 
org.quality.gates.jenkins.plugin.QGPublisher.perform(QGPublisher.java:85)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at 
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
at 
hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
at hudson.model.Build$BuildExecution.post2(Build.java:186)
at 
hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
at hudson.model.Run.execute(Run.java:1881)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:428)
Build step 'Quality Gates Sonarqube Plugin' marked build as failure
Finished: FAILURE

Can any help this.

Thanks,
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/6439a01f-c680-4e9f-9383-8da1a41497f3o%40googlegroups.com.