I'm on the Jenkins ver. 2.176.1.

I wish to connect to mysql database by passing host, port, and credentials 
in Jenkins pipeline for SELECT / INSERT queries to an existing database 
table.


As, I have understood there is no good plugin that works for MySQL 
connectivity (tried a couple which do not mask the password); I decided to 
set the MySQL hostname and Port as environment variables and username and 
password as credentials in Jenkins.


I have three plugins installed for this purpose viz. Credentials plugin, 
Credentials Binding plugin,Plain Credentials plugin.


[image: Jenkins Credential Plugins]

I then setup mysql credentials by clicking: 
Jenkins->Credentials->System->Global credentials (unrestricted)


[image: Mysql credentials]

Now; in-order to generate code for pipeline for accessing these credentials 
i go to-> http:///pipeline-syntax/ see below snapshot: 


[image: Syntax Generator]

Below are three queries I have:


1. The credentials drop-down (marked with *RED ARROW* in the snapshot 
above) in the pipeline syntax generator does not populate anything & seems 
disabled. I was expecting the mysql credentials ID to show up in the 
drop-down as expected. Can you suggest what could be the issue here ? Also, 
I have administrator role.

   1. 
   
   2. I need the syntax to pass the MySQL username and password as 
   variables to a different Jenkins job from my pipeline script below. Please 
   suggest how can I ? 
   
steps { build job: 'myjob1', parameters: [string(name: 'Region', value: 
"${params.Region}"),<mysql-username>,<mysql-password>)] }

3. Is there Alternate / better solution than the one I chose for Masking 
Database credentials ?

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8afa06c2-aafe-43b8-9316-d6aea25ff2b0%40googlegroups.com.

Reply via email to