Home > Blockchain >  Download SQLPlus to Jenkins server
Download SQLPlus to Jenkins server

Time:07-06

I'm trying to run SQLPlus in a Jenkins build (I have SQLPlus installed on my local). Currently, I have a variable in my build called PATH:

PATH=/usr/local/Cellar/instantclient

My build is stable and Jenkins is able to connect to the database and execute commands. Is there a way to run SQLPlus commands on a Jenkins server that doesn't have SQLPlus installed. I'm trying to avoid using the SQLPlus script runner plug in as well.

CodePudding user response:

You can install SQLPlus through the pipeline itself. For example, refer to the following. Having said that, if you have a static Jenkins instance best option is to install whatever tools that are required in the server itself.

pipeline {
    agent any

    stages {
        stage('SetUpSQLPLus') {
            steps {
                echo 'Setup'
                cleanWs()
                sh """
                curl -LO https://download.oracle.com/otn_software/linux/instantclient/216000/instantclient-sqlplus-linux.x64-21.6.0.0.0dbru.zip
                unzip instantclient-sqlplus*.zip
                cd instantclient_21_6
                chmod  x sqlplus
                ./sqlplus --version
                """
            }
        }
    }
}
  • Related