Need some help for jenkins gradle integration - jenkins

I am getting some issues with the configuration and setup jenkins to the local gradle project .it's some thing like integration of gradle with jenkins and jenkins will be responsible for building and running the gradle ...initially I tried with cmd execution available at jenkins but its not promising solution .So I feel I need some help for setup gradle plugin for local bild.gradle execution

I don't know which version of Jenkins you use, but with decently recent version you should have a build step type "Invoke Gradle Script" in "Freestyle project" project types, that you should use to execute your gradle build.
Everything is well explained here: https://guides.gradle.org/executing-gradle-builds-on-jenkins/#create_a_jenkins_job

Related

Can configure Jenkins pipeline with fastlane commands in xcode project file

i'm working on iOS project which have continous intergration set up, i wanted to create a jenkins pipeline for my project to run automation steps to do build,test and etc operations. For the automation process i'm using Fastlane tool, so how can i sync up the jenkins pipeline with my Fastlane commands in it? I got few examples related to maven commands in pipeline file, as maven plugin option is already available in jenkins, similary how can i achieve the same for fastlane. I need few examples to write my declarative pipeline syntax in my xcode project jenkins file.
Also i would like to know should the jenkinspipe line file should be inside the xcode project or it should be under the master branch ?
Any help is appreciated.
Thanks.
Refer Following Document for configuration of jenkins with fastlane.
https://docs.fastlane.tools/actions/upload_to_app_store/#jenkins-integration

How to push npm project from jenkins to oneops

I have an npm project which I am using Jenkins for Continuous Integration. So I achieved build automation in Jenkins. Right now I am struggling how to push the build output to Oneops. I browsed couldn't find any solution.
Any help is appreciated.
It depends. Let's say you are deploying something like a React application that you are building in Jenkins. Maybe you run "npm run build" and your build creates an optimized application in the build/ subdirectory?
This is a process I run several times a day in response to a CI build.
I do this now in Jenkins, Jenkins run the build "npm run build."
I use a simple Maven deploy-file task to upload a ZIP archive to Nexus. (See the documentation for Maven deploy-file here: https://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html)
Then I configure the OneOps artifact component to download from Nexus - http://oneops.com/user/design/artifact-component
Admittedly, this may not be the NPM-focused way of publishing artifacts, but I found the using NPM to publish artifacts to Nexus had some limitations that I couldn't accept.
To take this a step further, I've configured by Jenkins build to call out to OneOps and trigger an environment variable update that triggers the deployment of code to OneOps.

Setting up gradle org.sonarqube plugin sonar analysis task (sonarqube) in jenkins

As per the recent announcement on Gradle forum, the Sonar Plugin and Sonar Runner Plugin are being deprecated in favor of the SonarQube plugin. Can someone share any links (documentation or blogs) that demonstrate setting this up in Jenkins. I tried this on the local setup and gradle sonarqube task works great.
Should we continue to use the "Invoke Standalone Sonar Analysis" (from Jenkins-Sonar plugin) build step in a freestyle Jenkins job? With the default settings, it doesn't infer mandatory information like sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources from the build.gradle file. To provide it manually for a multi-module project is painful (particularly for sonar.libraries and sonar.binaries). One could think to generate a sonar-project.properties file as part of a custom gradle task that will subsequently be used by the Standalone Sonar analysis step.
However, it seems that this a generic requirement and I feel that there might be a simpler way out in in the Jenkins-Sonar plugin. Could someone familiar with the Jenkins-Sonar Plugin shed some light on it?
System info:
Gradle 2.5
Jenkins 1.560
SonarQube 4.5
SonarQube Gradle Plugin 1.0
Sonar Runner 2.3
Jenkins Sonar Plugin 2.2
JDK 1.8
Linux 2.6
Thanks in advance!
EDIT:
I did not want to put the database username and password of the remote sonarqube instance in my gradle build file and hence don't want to use the existing 'sonarqube' task.
I think that you are referring to the following improvement that we want to do on the Jenkins SonarQube plugin: SONARJNKNS-217
This should come sooner or later. In the meantime, you're right, there's no easier way than what you described - unfortunately.

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...

What is the advantage of the Jenkins SonarQube plugin over adding sonar:sonar to maven build step

I am using Maven as a build tool and Jenkins as a CI tool. Currently I have a Jenkins job configured with a Maven build step.
I started using SonarQube and was wondering what is the advantage of using the Jenkins SonarQube plugin and configuring the SonarQube analysis as a post-build-action over simply adding sonar:sonar to the goals of my existing Maven build step.
Thanks and best regards,
Ronald
You can save a lot of configuration. So, if you use jenkins sonar plugin you can centralize database credentials and sonar credentials but if you make a decision about execute sonar:sonar in each jenkins job you will configure each with the same credentials.
I just found: Why use sonar plugin for Jenkins rather than simply use maven goal "sonar:sonar"?
And to add one reason: Using the Jenkins SonarQube plugins one can specify "Skip if triggered by SCM Changes". This is nice if you trigger your Jenkins job for each commit but only want to do a SonarQube analysis at a scheduled time, e.g. one per night.
And here is a summary of the the points made by "emelendez":
Centralize database credentials and sonar credentials Use jenkins
Use jenkins sonar plugin configuring SonarRunner for non Java projects
I've just changed to maven-sonar-plugin from the Jenkins SonarQube plugin to avoid divergence of information between the pom.xml and sonar-project.properties.
For example, developers elsewhere had bumped the project version number in the pom.xml, but they don't use the Jenkins builds and didn't care about the sonar-project.properties (or probably understand it). By switching to the maven plugin instead, the project version is defined once and referenced in the sonar property set within the pom.
The downside is that I no longer have the SonarQube link from the project's Jenkins page.
I'm not sure where the responsibility might be for adding this link back for projects using maven-sonar-plugin... The link is "owned" by the Jenkins SonarQube Plugin, but this is not being used here. Meanwhile the maven-sonar-plugin component is integrating with maven not Jenkins.
Something would need to observe the build and extract the SonarQube link which is emitted as a [INFO] ANALYSIS SUCCESSFUL, you can browse http://... line in the log.

Resources