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.
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.
I have a problem with Maven project in netbeans. I am new to maven so maybe this is a general question. The problem is, every time I run the main class file (Shift+F6), the console will display the downloading from the repo. I notice that this makes me slower because if I just change some line, I will need to wait the maven to re download every dependency again. Is it possible to run file without maven re downloading all dependency?
This is not the standard behaviour of Maven. First of all, check whether Maven is really downloading the jar files and not only metadata or poms. If so, it can have several reasons:
You activated Update-Snapshots in your build (-u). This downloads all SNAPSHOT dependencies in every build (if they changed).
Your update period for SNAPSHOTs is set to a very low value (the standard value, which is good for most purposes, is 1 day). Same effect as above.
Your local repository (user/.m2/repository) is broken. Delete it and try again.
I have yet to find documentation on what exactly triggers the force update and I've seen that it behaves differently depending on which lifecycle phase is run. This has led me to the conclusion though that maven certainly cares which phase you are running if you try to force update (with a -U) and ignores the force update if it doesn't need to.
I'd like to force an update even when I am not running a default lifecycle phase directly. My use case is in releasing my app with timestamped snapshot versions with the command:
mvn clean release:perform release:prepare -U
I'm seeing that even though the snapshots are versioned, internally it is getting the latest SNAPSHOT version in its local repo. If I run mvn compile -U first, then my snapshots are updated, and the release happens as expected.
I am curious as to why the timestamp version isn't used to pull the new artifact from nexus, but I figure it has something to do with the more narrow-minded release plugin rather than with maven itself.
Since I'm accepting defeat with the release-plugin, is there a way to force the update without running a separate (and unnecessary) lifecycle phase. Or a way to pass in the -U to be run by the maven release plugin when building my project?
First you are mixing different concepts. You are calling:
mvn release:prepare...
which does not start a life cycle in contradictions it runs the release plugin with it's particular goal prepare and of course .. release:perform runs the goal perform.
Furthermore the release plugin starts a sub process (starting maven in subfolder target/checkout) with the created release (tagged state) which usually does not transfer the -U option to this sub process. This can be accomplished by using `mvn -Darguments="..."'.
But if you like to force an update of snapshot's during your build you can simply using mvn -U... like:
mvn -U clean package
This means simple let maven checks in Nexus are there newer SNAPSHOT's if yes download them to local repository instead of waiting till time out for updating of SNAPSHOT's has come (see updatePolicy).
If you like to change your versions in your build without the maven-release-plugin you can take a look at the versions-maven-plugin but in this case you need to do your tagging etc. yourself.
First of all don't let release candidate ever dependent on SNAPSHOTS, if you still want to do it then
mvn dependency:resolve -U
I'm using Hudson to build my application. I have several branches that come and go. Whenever there's a new branch, I have to set up the following builds for it:
a continuous build that runs after every change in SVN
a nightly build
a nightly site generation (I'm using Maven under the hood)
and a weekly integration build for some branches
currently this means I need to copy four template configurations and set them up with the branch URL. I don't like this for two reasons:
It's redundant, so modifying something is error-prone and takes a lot of time.
I need four full checkouts of the product per branch on every build slave, plus four separate private Maven repository, not to mention the built artifacts. This is a lot of space wasted.
What I'd like instead is to have one workspace and one configuration for allthese builds. Is this possible with Hudson?
If you go for the assumption that your nightly build is the same than your continuous build. You can publish your continuous build artifacts into a folder/repository path that contains the date. So your second and subsequent builds of a day will overwrite the previous builds of that day.
The site generation and the weekly integration build is more difficult since you would need conditional build steps. (The idea is to run batch/shell scripts that will determine if it is time for the action (like site build) and run that as part of that script).
In my opinion the better solution is to write a batch/shell script (or a Java program would work too) that copies your templates and replaces the svn entry in all your new jobs. Than you have two steps for creating a new branch. First run your script with the SVN path as the parameter and second tell Hudson to reload the configuration. The beauty of the solution is, that you can change your templates when necessary without making changes to your scripts.
I'm trying to use CruiseControl 2.7.3, (the original), to build a Java project that is in an SVN repository.
My cruise configuration is using the svn plugin for the modification set. When a modification is detected, a build is scheduled using Ant. That Ant build file then uses the svnant Ant Task to do a complete checkout of the project. For a while, we had this set to just checkout "HEAD", but we've had cases where the build won't fire for a check in or two because the checkin occurred after the modification set check, but before the ant call to svn checkout. As a result, we are trying to change the ant build file to use the revision number that the modification check retrieves.
The CruiseControl Configuration Reference page claims that a property, svnrevision, is set and passed to the builders, just like the label property is by the labelincrementers. It appears to not be set when I press the force build button.
Is there something I need to do to make this go?
Looking at the code for the SVN source control it seems that svnrevision should be passed along to the builder, and thus along to your Ant invocation. Have you tried using the property from your Ant script?
In response to the question in the comment:
That's because in the force build case there was no modification, so there's no modification revision number. In that case the svnlabelincrementer will pass the latest revision number for what you have locally, which will also be the latest.
The cruisecontrol ant invocation has nothing to do with the (svn)label that is contructed as such. The svn label is used to annotate the build-names whereas the build.log is really just the output from ant as it is passed through cruisecontrol.
If you would like to have the revision number written to the ant build output, there are basically two ways:
One way is to have ant interact with svn in some way. Svn in ant is only available through a contrib ant task from tigris, so it is not trivial to put into your ant file. But with this in your build, you could do a svn info and get the revision number as ant properties at your disposal.
Another way is to use the svnlabelincrementer to assign the revision number to the label, and pass that onto the ant script using the buildproperties that are passed from cruisecontrol to the build scripts. As Jay mentioned in the comments, the label contains only the last successfull build revision, which is not what he wants. A fix has been proposed on this blog, but doing the work in the ant build file seems more suitable.
Can you use the quietperiod setting? After a commit, CruiseControl can wait for some amount of time (say, 30 seconds) before kicking off a build.
It won't fire off individual builds for each commit. Rather, commits around the same time will kick off a single build.