why the jenkins did not checkout the source code in multibranch build - java

when I build a multi pipeline project, I found the dictory only generate one dir:
an-superhub-multipipeline_hades
and the dir an-superhub-multipipeline_hades did not have source code. and other project have 3 dir like this:
an-superhub-multipipeline_master
an-superhub-multipipeline_master#libs
an-superhub-multipipeline_master#tmp
why would this happen, what should I do to fix it? I want to delete the branch and regerate it, but I did not find any delete option in the UI. Only one option to delete all multibranch.

Check logs first:
Job's logs;
System's logs (go to Manage Jenkins - System logs);
logs in jenkins home folder.
What are the differences between develop and hades branches?
If you want to recreate job in multibranch pipeline - delete it on gitlab side, then run scan on jenkins multibranch job, and create branch again.
From my point of view it is better to use Gitlab branch source plugin to automate jobs creation in jenkins and create webhooks in auto manner on gitlab side.

Related

Triggering Maven Build on changes to particular directory in Jenkins

We have Github repository with the structure as:
Project Name
- submoduleA
- submoduleB
- submoduleC
Every submodule is an extra microservice present inside the same branch. It is maven project. Every submodule is having a seperate jar which are not having any build dependencies.
I want to setup a Jenkins job which will get triggered when there is some changes to the submodule directory and build the respective jar.
Is there any way we can achieve that or is my approach is not correct? I also want to integrate Sonarqube analysis with it.
I suggest you refer to these blogs to setup the automatic trigger process step by step, my favorite is the 3rd blog.
Trigger Jenkins builds by pushing to Github
Automatically triggering a Jenkins build on Git commit
Triggering a Jenkins build from a push to Github

How to increase build number in Bitbucket Pipelines?

I have a Maven project where I use buildnumber-maven-plugin for incrementing the build number. After each "mvn package" command, a variable inside buildnumber.properties file is incremented to keep tracking of current build number.
Is there a way in Bitbucket Pipelines after I run the job with "mvn package" command to commit/push the changes made by buildnumber-maven-plugin in that file? Of course, this question makes sens if running a command in butbucket pipeline can change files inside the repository.
If any users with access to the repo are able to push to the branch you would like to commit to, you are able to commit that file back to your repository as outlined here: https://community.atlassian.com/t5/Bitbucket-Pipelines-articles/Pushing-back-to-your-repository/ba-p/958407. Ensure to add [skip ci] so you don't create a new pipelines build for that new version bump commit.
If pushing to the branch is restricted, you can use one of these methods: https://confluence.atlassian.com/bitbucket/push-back-to-your-repository-962352710.html. However, this will require providing a single user with permission to push to the branch.

jenkins hook not working - jenkins bitbucket

Hi i am using jenkins and bitbucket , i want to trigger a build in jenkins when ever i commit any thing to bitbucket repository .
in jenkins
i created a project called test_1
in configure section Build Triggers part i ticked Trigger builds remotely
i added a token TEST_TOKEN
when i type this in my browser url and execute the jenkins build is triggered
http://test.com:8080/job/test_1//build?token=TEST_TOKEN
In bitbucket
i added a jenkins hook
Endpoint : http://test.com:8080/job/test_1//build?token=TEST_TOKEN
Module name - empty
Project name - test_1
Token - empty
then commited some code to bitbucket via git , The jenkins build not running , seems that the trigger is not running . :/ how to solve this problem . please help me . thanks in advance :)
I had the same problem. #fmitchell is correct with his suggestions for these fields.
But it didn't work for me.
I use a normal POST Hook instead where I provide the whole URL:
http://USER_NAME:USER_TOKEN#YOUR.JENKINS.URL.COM:YOUR_PORT/job/YOUR_PROJECT_NAME/build?token=some_token_from_jenkins
eg: http://bob.miller#jenkins.example.com:8080/job/test_1/build?token=TEST_TOKEN
It seems to be that Bitbuckt is missing the last parameter "build" in its created URL, but I can't tell for sure.
------Update------
I found a better solution, where you don't only trigger your build but also be able do build different branches by different Jenkins projects:
Install Bitbucket Plugin at your Jenkins
Add a normal Post as Hook to your Bitbucket repository (Settings -> Hooks) and use following url:
https://YOUR.JENKINS.SERVER:PORT/bitbucket-hook
Configure your Jenkins project as follows:
under build trigger enable Build when a change is pushed to BitBucket
under Source Code Management select GIT; enter your credentials and define Branches to build (like **feature/*)
By this way I have three build projects, one for all features, one for develop and one for release branch.
And best of it, you don't have to ad new hooks for new Jenkins projects.
It should be:
Endpoint : http://test.com:8080/
Module name:
Project name: test_1
Token: TEST_TOKEN

Script executed in Jenkins after commit from repo

I am new with Jenkins and I can't find answer for something. I use SVN as my file repository and Jenkins for CI.
The question: is it possible to execute my own script/trigger or sth in Jenkins after SvN commit on commited project? This script would change one file in this project.
Thanks for any suggestions.
Yes it is possible.
In your Jenkins project -> Conifgure -> Build Triggers
Check the box poll SCM
In the schedule use the cron expression '*' This will ensure that jenkins project is build on every commit.
Go to Build Environment section
Select Configure M2 Extra Build Steps
Click on add-pre build step. On clicking you would get option asking if you wish to runn Shell script or windows batch script.
Provide the script details and save the configuration and check
JENKINS is a build tool. In case you wish to perform actions post commit you would have to write a Post-Commit hook for SVN or whichever SCm tool you are using

Maven/Jenkins automatic download/copy

I'm in a team to develop plugins in java.
We got Maven, a repository and Jenkins,
And I got myself a debian-server to test my applications.
When I push my commits, this happens:
Push in repository, upload and build in Jenkins.
Users download these .jar files and upload these to their server
What I want to be happen:
There are two ways,
First: After building with Jenkins: Download these files,
Second: When pressing "maven build", maven builds my applications and copy these to my server
How can I do this?
(Sorry for my bad English: I'm German)
If I understand you correctly, following scenario should help.
create two jobs
first job builds your artifact and archives it: user will be able to download it, job is triggered by source modification
second job is only executed manually (and requires two plugins, listed below), copies artifacts from first job and then uploads them to the server
Following plugins you would need to install:
copy artifact plugin to enable jenkins to copy artifacts from another job
publish over ssh plugin to enable jenkins to upload binaries and run commands on remote servers
You want when you push your SCM repository, to get Jenkins build into your local projet (update your jars), then manipulate send your final build to your server. Is that you want ?
If yes, I think that plugin would be interesting :
http://evgeny-goldin.com/wiki/Jenkins-maven-plugin#Supported_Plugins
you can manage jenkins goals from your pom.xml but I am not sure if you can get jenkins build.

Categories