Posts

Using SSH keyfile for launching agents via ssh

Image
We use known hosts file strategy as Host key verification strategy here. Create the following Directory mkdir -p /var/lib/jenkins/.ssh Copy entries for your ssh host in the known_hosts directory ssh-keyscan -H hostname >> /var/lib/jenkins/.ssh/known_hosts Change the ownership of .ssh folder to jenkins user chown -R jenkins /var/lib/jenkins/.ssh

Setup Flyway,Postgres in Jenkins using Docker

Recently I was trying to setup Flyway on Jenkins for my db in Postgres. The required files can be found here https://github.com/gauravmatta/devops/tree/main/jenkins_flyway The basic files you will need will be  The configuration file in conf folder The sql files in the sql folder The pipeline file "jenkinsfile-2" Here is the sample configuration file flyway.url= jdbc:postgresql://localhost:5432/flyway flyway.user = postgres flyway.password = postgres flyway.schemas= flyway flyway.locations=filesystem:../sql flyway.driver=org.postgresql.Driver Create DB Credentials in Jenkins with ID  "db-creds" We are using this in our sample you may change it but be sure to change it in jenkins pipeline file too. Here is the sample jenkins pipeline file https://github.com/gauravmatta/devops/blob/main/jenkins_flyway/jenkinsfile-2 My postgres is installed on localhost so I am using "--network=host" in my docker command for example docker run --rm --networ...