How to publish artifacts from Jenkins to uDeploy - jenkins

How to publish artifacts after a successful build from Jenkins to uDeploy (IBM)?
I heard that urbandeploypublisher.hpi is required to upload this API in Jenkins but I didn't find any where.

Latest copy of the Plugin for UrbanCode Deploy is available here: https://developer.ibm.com/urbancode/plugin/jenkins/

Yes.. There is a plugin IBM UrbanCode Plugin available which you can integrate in Jenkins.
Below is the link you can see the plugin :-
https://developer.ibm.com/urbancode/plugins/
1.1.0 is the stable version that you can use. Just by integrating the plugin in Jenkins you would be able to fetch the recent build (code builded by jenkins) from your Urbancode application.
This should work...

http://www-01.ibm.com/support/docview.wss?uid=swg21664334 is the URL for the detailed steps to integrate IBM UCD and Jenkins
(It might be useful for who is trying to integrate UCD and Jenkins)
Jenkins stage for UCD deploy
stage ('UCD Deploy') {
steps {
script {
ucdDeploy {
ucdUsername="UCD_username"
ucdPassword="UCD_password"
applicationName="application_name"
environmentName="environment_name"
processName="UCD_process_name"
artifactVersion= "UCD_component_name : application_version_to_deploy"
customProps=""
}
}
}
}

Related

Cannot use "Deploy to container plugin" in Jenkins

I want to deploy a java maven webapp to a local tomcat8 via jenkins. I found out that I need to install the "Deploy to container plugin", which I did.
I figured, now I should be able to add a post-build action in the configuration of my pipeline. (like described here: Deploy webapp to Tomcat after Maven build on Jenkins)
But under "configure" of my pipeline there is no tab that says "post build action" (I also don't have the build tab, which I saw on a few screenshots). After researching I added a bunch of plugins described in a few tutorials, like "Hudson Post build task" and "PostBuildScript Plugin" but that didn't change anything.
Am I missing a specific plugin or is there something else wrong?
Thanks in advance!
If you're using a job of 'Pipeline' type (not a 'Freestyle' type where those 'PostBuildScript plugin' refers to), you need the perform the above in the 'post' part of your pipeline:
pipeline {
agent
...
stages {
...
}
post {
PUT YOUR CODE HERE!!!
}
}

No tool named SonarQube Scanner 2.8 found error

I followed these instructions to download the SonarQube Scanner plugin for Jenkins. I've configured these jenkins global settings for the SonarQube scanner correctly. The SonarQube server is setup and functioning properly.
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins#AnalyzingwithSonarQubeScannerforJenkins-AnalyzinginaJenkinspipeline
But when the build runs, it produces this error: No tool named SonarQube Scanner 2.8 found.
I am using a Jenkins declarative pipeline script for pipeline build.
I am using Jenkins ver. 2.131. I am using "SonarQube Scanner for Jenkins" Plugin version 2.8.1. I believe the Jenkins server is a common linux flavor. I am NOT using any version of Maven, and don't require it to build my projects.
I figured the plugin installed the actual scanner files for me on Jenkins. Do I need to have some version of the scanner command files installed, beyond whatever the plugin provided me? Meaning, is there something other than the plugin that I need to install on by Jenkins server? I would hope the SonarQube plugin would give me everything I would need to run on Jenkins build.
Here's the relavent part of my script:
stages {
stage("SonarQube Analysis") {
agent any
steps {
script {
def scannerHome = tool 'SonarQube Scanner 2.8';
withSonarQubeEnv("foo") {
sh "${scannerHome}/bin/sonar-scanner"
}
}
}
}
Here is a screenshot of the global configuration:
I think you didn't add Scanner in Jenkins Global Tool Configuration. You can do it by doing the following steps:
click Manage Jenkins
choose Global Tool Configuration
scroll to SonarQube Scanner
add SonarQube Scanner 2.8
May be would be actual for maven's users
stage("SonarQube analysis") {
steps {
script {
def scannerHome = tool 'SonarQube Scanner';
withSonarQubeEnv('SonarQube Server') {
sh 'mvn clean package sonar:sonar'
}
}
}
}

Invoking a pipeline from another pipeline using scripted jenkinsfile

I am using the following snippet to invoke a pipeline1 from pipeline2 both the pipelines have their own Jenkins file in their respective git repo
stage
{
build job:'../pipeline1Repo/master',parameters:[[$class:'StringParameterValue',name:'USER', value:'user'],[$class:'StringParameterValue',name:'PASSWORD', value:'password']],wait:true
}
The repo location in git for pipelines are:
pipeline1 repo - https://github.company-domain.com/main/pipeline1-repo
pipeline2 repo - https://github.company-domain.com/main/pipeline2-repo
when I am running the job I am getting following error:
build
job:'../pipeline1Repo/master',parameters:[[$class:'StringParameterValue',name:'USER',
value:'user'],[$class:'StringParameterValue',name:'PASSWORD',
value:'password']],wait:true
Note- I don't have the access to check the installed plugins I am assuming is this can be due to pipeline plugin is not installed and if so is there another way to do so without using a plugin
The issue was the plugin as I didn't have the admin access I could not check the plugin was there or not.
After installing the pipeline plugin it got resolved

Plugin [id: 'org.sonarqube', version: '2.6.2'] was not found

We use Sonatype Nexus as artefact repository, configured with credentials in Jenkins and it works fine.
Now i'm trying to get get a gradle project running as jenkins multibranch pipeline job using gradlew including a sonarqube code scan.
Problem:
when using only the rootProjekt.name property in settings.gradle
i get this error:
What went wrong: Plugin [id: 'org.sonarqube', version: '2.6.2'] was not found in any of the following sources:
Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
Plugin Repositories (could not resolve plugin artifact 'org.sonarqube:org.sonarqube.gradle.plugin:2.6.2') Searched in the
following repositories:
Gradle Central Plugin Repository
The sonarqube gradle plugin is found when using the Nexus web UI, but not by gradle inside the pipeline, seems it searches only in Gradle Central Plugin Repository.
When using a Settings.gradle like that:
pluginManagement {
repositories {
maven {
url "http://nexushost/content/groups/public/"
}
}
}
rootProject.name = 'fooBar'
it works like a charm.
How to tell gradle it should always use the sonatype nexus host without having
to configure it in settings.gradle for every Job ?
You should use a Gradle init script.
For example, in every agent, create a file USER_HOME/.gradle/init.d/use-corporate-nexus.gradle, with content:
settingsEvaluated { settings ->
settings.pluginManagement {
repositories {
maven {
url "http://nexushost/content/groups/public/"
}
}
}
}

Gradle tool in Jenkins Declarative Pipeline

I defined a Jenkins Declarative pipeline to CI/CD my project. I am using gradle as my build tool. However I don't want to use the Gradle Wrapper and check it int the VCS. So I planed on using the jenkins tools functionality as below so that I can update the version number if I need to in future. But it doesn't seem to work.
pipeline {
agent any
tools {
gradle "gradle-4.0"
}
stage("Compile") {
steps {
sh 'gradle project/build.gradle classes'
}
}
I get the error "script.sh: gradle: not found".
I tried to echo PATH and that doesn't contain the path of this autoinstalled gradle tool. Please help.
Looks like there is an issue on the gradle plugin for Jenkins on plugin version 1.26. Please see the link to the bug reported below.
https://issues.jenkins-ci.org/browse/JENKINS-42381

Resources