How to query Postgres database from Jenkins pipeline

Published: 08 August 2023
on channel: Toolio
1,322
12

This video explains the steps of integration between postgresql and jenkins to query data from postgres database from jenkins pipeline.
Step 1 is to download and Install the postgres psql client on windows. Once it's installed, just add the client path in system path variable
Step 2 is to create a .pgpass file on the Jenkins agent under user home directory that should contain the .jenkins folder
Step 3 is to create the jenkins credentials to refer the password in a most secure way.
Step 4 is to create jenkins pipeline to execute the psql commands. Here you need to add the PGPASSFILE environment variable to the jenkins pipeline under Environment declarative and provide the path of the .pgpass file and that's it. now you can run the jenkins job and it would execute the query on your postgres database if you have already implemented the access between your jenkins agent and postgres database


Watch video How to query Postgres database from Jenkins pipeline online without registration, duration hours minute second in high quality. This video was added by user Toolio 08 August 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,322 once and liked it 12 people.