Can anybody suggest how TEAMCITY RestAPI can used for trigger a build for a particular project availble in bitbucket/mercurial repository and getting the result of the build ,that is jar/war file .
See JetBrains help:
To start a build, send POST request to
http://teamcity:8111/httpAuth/app/rest/buildQueue with the "build"
node in content - the same node as details of a queued build or
finished build. The queued build details will be returned.
Set up build configuration as normal, and trigger using REST API with steps above.
Related
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.
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
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
I have code in a repository. Now I want to create a job which will build code from the repository and deploy it on two servers.
Right now I create two jobs with exactly the same configuration. The only change is the server on which it needs to deploy.
Is it possible to do this with single job?
Can I suggest to use this maven plugin. You can configure batch tasks (either maven goals, or scripts) that you can attach to your normal maven jobs.
https://wiki.jenkins-ci.org/display/JENKINS/Batch+Task+Plugin
Firstly, you have a Jenkins job that builds your job normally.
Then, using this plugin, you can configure two extra tasks on that same Jenkins job called, say, "Deploy-server-1" and "Deploy-server-2".
After you build your job, click on the "Task" button and you can easily run your deploy tasks.
So the process is:
-> build
-> deploy server 1
-> deploy server 2
If you have a look on the link I added for the Batch Tash Plugin, they have a single task called 'release'. Just imagine you can have more tasks right under it, to do whatever you want.
You probably need admin rights on your Jenkins server in order to install this plugin, if it's not there already...
I solved this adding Flexible Publish plugin, and as a Conditional Action, using Run:'Always'. Now it is possible to add as many actions as like in Flexible publish conditional action, and all these actions can be 'Deploy WAR/EAR to container'.
You can deploy to multiple servers using the Node and Label parameter plugin.
Add the servers you want to deploy your code using Jenkins nodes: Manage Jenkins > Manage nodes > New node.
Be sure to add a label to each node so you can group them together and deploy to that group.
Create a new freestyle project and check the This project is parameterized option. Add a parameter and choose Label, and add the label you just created for your servers (nodes).
From here, every build step will replicate itself in each labeled node, so you can fetch your repository code using a SCM plugin, GitHub, GitLab, etc. or directly from your server, this is up to you, and the code will be deployed on each node.
Be aware that if your code need to be compiled, it will be compiled on the remote server. Also, every time this build is deployed to a node, will create an additional build in your build queue.
You can use Copy Artifact Plugin, where you can copy build artifacts one project to another. So you just have on job which builds what you need and it can be shared across other jobs.
I got same problem, I'm about to solve it using multiple curl statements. See my post http://martin.podval.eu/2013/10/tomcat-7-remote-deployment.html
Well, jenkins does not allow me to add multiple command line execution tasks, so I need to use three curl statements in one.
I solved similar problem with ant tasks - getting server urls as input parameter from build.properties file. In my case there were several environments to support with same script, 1-2 servers on each.
<target name="deploy.application">
<groovy>
if (properties['app.server'] && properties["app.server"] != "") {
ant.project.executeTarget('deploy.server1')
}
if (properties['app.server2'] && properties["app.server2"] != "") {
ant.project.executeTarget('deploy.server2')
}
</groovy>
</target>
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.