How does the tools statement in a jenkinsfile make those tools available? - jenkins

In one of my team's jenkinsfile, I see the following:
tools {
maven 'Maven 3'
jdk 'JDK 8'
}
It is not clear to me what the syntax is doing. Our CI/CD guy said, "'Tools' are approved by the IT department; they are tools that can be integrated in the pipeline. Each tool is accessible via jenkins commands as if it were running the CLI. Other tools that are available are listed on our company's support portal at https://..."
I'm still not clear on what is happening, and he couldn't offer more explanation.
What is maven 'Maven 3' doing, exactly?
I have been trying to google the topic, looking for articles on jenkins.io and other StackOverflow topics that directly address the tools { syntax. I haven't come across an explanation that tells me what maven 'Maven 3' does to make the mvn tool available to me.

Related

Groovy 3 and Jenkins Embedded Scripting?

I've just started playing around with Jenkins - and I'm looking at Pipelines.
I'm looking to brush-up on my Groovy skills to facilitate this.
The latest literature is all "Groovy 3" based and comes with some significant new features, but despite having the latest Jenkins install (Jenkins 2.249.2), the embedded scripting engine seems to be older - from Jenkins' script console on my master:
println GroovySystem.version
Gives 2.4.12.
My question - Is the version of Groovy easily/sensibly configurable in Jenkins or is it usual to stick with whatever ships with Jenkins?
You must choose system groovy if you want ready access to the Jenkins internals, jobs, etc. See Groovy Script vs System Groovy Script, and Known limitations; you get what is packaged.
If you use external groovy and don't need to access Jenkins internals, your choice. Lots of internal debate on upgrading as it's lots of work. You can follow JENKINS-51823 and Pipeline Groovy Epic

Jenkins job - no options found under pipeline section

I have started learning Jenkins recently.
I installed docker on a server which I created on AWS server and using docker I have installed Jenkins.
I wanted to test a Hello pipeline stage by creating new item, but when I go to the pipeline tab I cant see any options like pipeline script or pipeline script from SCM . I have installed git plugin and pipeline plugin also seems to be installed successfully. I am not able to continue my study further. I will be really thankful if someone can help me here.
In reality the pipeline plugin is not just one plugin but a bunch of 6 to 8 plugins. So you may want to install all the pipeline related items in your available plugins section of Manage Jenkins. Once this is done, a reboot of Jenkins is required for the changes to take effect. Here are some of them:
https://plugins.jenkins.io/build-pipeline-plugin/
https://www.jenkins.io/doc/pipeline/steps/pipeline-build-step/
https://plugins.jenkins.io/pipeline-stage-view/

How to add Sonarqube into Jenkins

I have installed sonar and jenkins. Now I want to add Sonarqube into Jenkins. But in the manage plugins, it doesn't show me the Sonarqube.the display I get
SonarQube is a standalone server. It offers a web user interface to visualize bugs, code smells and vulnerabilities. You cannot include this web-ui SonarQube in Jenkins.
However, you can trigger a scan as part of your Jenkins job. This scan can "send" its findings into a SonarQube installation - either hosted by your own (on-premise), or using the hosting offer at sonarcloud.io.
There are a couple of different ways to include the scanner in your job, but the setup is specific to your programming language and build tools (Maven, VisualStudio, command line, ...). Check the sonarcloud docs for the way, that fit's best to your situation.

Jenkins CI/CD pipeline tools and stages

I am trying to understand the CI/CD pipeline.
I know that there are different stages like getting the requirement (using JIRA), fetching the source code from SCM, building it (Maven, Ant, Gradle, NPM), Artifact archival (Nexus, JFrog, Artifactory), unit testing (JUnit), other testings and deployment.
I am missing some advanced steps like integrating tools like Code Quality check (SonarQube), Configuration Managment (Chef/Ansible), Deployment tools (Docker) and maybe more.
What would be a good example of a full Continuous Integration, Continuous Deployment and Continuous Delivery pipeline including the popular tools and plugins used with Jenkins for a Java, PHP, JavaScript or Node based project?
Thanks in advance.

How would I install Sonar in my existing Jenkins

I would like to integrate Sonar Qube in my Existing Jenkins Set Up(Build Script in ANT).Please do help me in doing it
Mike
The easiest and recommended way would be to use SonarQube Jenkins Plugin. The documentation explains the process quite nicely and there is an option to run Standalone analysis, which is not dependent on your build process...

Resources