How to add additional mysql-connector after installing dependency-check in Jenkins Global Tool Configuration

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to add additional mysql-connector after installing dependency-check in Jenkins Global Tool Configuration

Amedee Van Gasse
I'm going to use dependency-check on Jenkins to check a .NET build.

I have added a Dependency-Check installation to Jenkins' Global Tool Configuration.
I'm using an install from dl.bintray.com.

In my Jenkins Pipeline, I have:

environment {
    DEPENDENCY_CHECK = tool name: 'Dependency Check', type: 'org.jenkinsci.plugins.DependencyCheck.tools.DependencyCheckInstallation'
}

and

stage('Dependency Check') {
    steps {
        println 'Dependency Check'
        println DEPENDENCY_CHECK.toString()
    }
}

(Just for now)

Can confirm:
* In the build log I see
Unpacking https://dl.bintray.com/jeremy-long/owasp/dependency-check-6.1.1-release.zip to C:\Jenkins\tools\org.jenkinsci.plugins.DependencyCheck.tools.DependencyCheckInstallation\Dependency_Check on ********
* In the build log I see  
14:53:23 Dependency Check 
14:53:23 C:\Jenkins\tools\org.jenkinsci.plugins.DependencyCheck.tools.DependencyCheckInstallation\Dependency_Check
* On the build node, a new directory C:\Jenkins\tools\org.jenkinsci.plugins.DependencyCheck.tools.DependencyCheckInstallation\Dependency_Check contains the correct files.


Now.

I'm using a local database in MySQL, so I need to put an additional file mysql-connector-java-8.0.22.jar inside a plugins folder in the installation folder.
How do I do that in the Jenkins Global Tool Configuration? If I add a second installer to copy the mysql jar, then it only installs that one single jar file.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/39b2e0ad-6d04-415a-a310-4e1865ac0eabn%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to add additional mysql-connector after installing dependency-check in Jenkins Global Tool Configuration

Amedee Van Gasse
Never mind, I wound up writing an entire batch script directly inside the Jenkins Global Tool Configuration:

if exist C:\Jenkins\tools\org.jenkinsci.plugins.DependencyCheck.tools.DependencyCheckInstallation\Dependency_Check\dependency-check\bin\dependency-check.bat (
    echo "Dependency Check is already installed"
) else (
    powershell -Command "Invoke-WebRequest https://<ARTIFACTORY_URL>/files/tools/dependency-check/dependency-check-6.1.1-release.zip -OutFile dependency-check-6.1.1-release.zip"
    powershell Expand-Archive 'dependency-check-6.1.1-release.zip' -Force -DestinationPath 'C:\Jenkins\tools\org.jenkinsci.plugins.DependencyCheck.tools.DependencyCheckInstallation\Dependency_Check'
    powershell -Command "Invoke-WebRequest https://<ARTIFACTORY_URL>/files/tools/dependency-check/mysql-connector-java-8.0.22.jar -OutFile dependency-check/plugins/mysql-connector-java-8.0.22.jar"
    del *.zip
)

It's as ugly as the night, but it works.

If anyone has an idea for a more elegant solution, please enlighten me.
On Tuesday, February 23, 2021 at 4:33:48 PM UTC+1 Amedee Van Gasse wrote:
I'm going to use dependency-check on Jenkins to check a .NET build.

I have added a Dependency-Check installation to Jenkins' Global Tool Configuration.
I'm using an install from dl.bintray.com.

In my Jenkins Pipeline, I have:

environment {
    DEPENDENCY_CHECK = tool name: 'Dependency Check', type: 'org.jenkinsci.plugins.DependencyCheck.tools.DependencyCheckInstallation'
}

and

stage('Dependency Check') {
    steps {
        println 'Dependency Check'
        println DEPENDENCY_CHECK.toString()
    }
}

(Just for now)

Can confirm:
* In the build log I see
Unpacking https://dl.bintray.com/jeremy-long/owasp/dependency-check-6.1.1-release.zip to C:\Jenkins\tools\org.jenkinsci.plugins.DependencyCheck.tools.DependencyCheckInstallation\Dependency_Check on ********
* In the build log I see  
14:53:23 Dependency Check 
14:53:23 C:\Jenkins\tools\org.jenkinsci.plugins.DependencyCheck.tools.DependencyCheckInstallation\Dependency_Check
* On the build node, a new directory C:\Jenkins\tools\org.jenkinsci.plugins.DependencyCheck.tools.DependencyCheckInstallation\Dependency_Check contains the correct files.


Now.

I'm using a local database in MySQL, so I need to put an additional file mysql-connector-java-8.0.22.jar inside a plugins folder in the installation folder.
How do I do that in the Jenkins Global Tool Configuration? If I add a second installer to copy the mysql jar, then it only installs that one single jar file.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ce8d8dad-a383-499b-946a-a4dc7e6fc8cdn%40googlegroups.com.