I have two different VCS roots configured in TeamCity (9.1.4) with master as default and also +:refs/pull/(*)/head in other branch specification.
Now I have a build configuration that uses both repositories.
Building master works just fine but if you try to build a specific pull request/other branch then TC will check the same branch for both repositories.
I know I can add a different VCS with only master and use it for that configuration but is there a way to specify different branches for different repositories on the same build configuration?
Related
We are in process of versioning microservice for parallel deployments.
During this process we are versioning the entire service by following git release branches i.e. cut release branches from main during the release and maintain release branches as supporting that specific release.
Now we have a problem we are trying to solve which is Spring Cloud configuration.
We have external config server deployed which gets the configuration from Git repo.
What is best way to version the configuration properties or yaml files?
We have brainstromed different ideas like
single git repo and multiple branches for different version for e.g. service-v1 gets config from v1 branch and service-v2 gets config from v2 branch
single git repo and single branch but use prefix key and suffix as version for e.g. key1.v1=v1, key1.v2=v2
Please let me know what is better/clean approach or any best practices for solving this versioning of of configuration.
Thanks
I see several options:
directly in pom.xml
in company super-pom
in settings.xml (global or user)
in a profile or directly (in settings.xml or pom.xml)
We want our Jenkins to push artifacts to internal repository, and developers to pull missing artifacts from there.
If I put the repository URL in pom.xml, and later the internal repository is moved to a different address, the released versions will all have a broken link.
Super-pom saves some repetition, but in a clean setup you need to somehow know where the repository is to find the parent POM — to tell you where the repository is.
Having the URL in settings allows one to change it without modifying the artifacts, but there are two problems:
build will fail due to unresolved dependencies, if maven settings have no reference to the internal repo
developers have to update their settings.xml files manually
I'm also unsure about the merits of putting repository configuration in profiles. I know it let's you easily switch the repositories on and off, but shouldn't the -o option and snapshot resolution settings be enough for most uses?
What about using a different repository (e.g. with instrumented classes) for integration tests?
Configure a single repository in the users ${HOME}/.m2/settings.xml and configure other needed repositories in your appropriate repository manager either Nexus, Artifactory or Archiva. In Jenkins there is the Config File Provider plugin which exactly handles such situations in a very convinient way.
If you want to have repeatable builds and good control over your organization internally, use a repository manager and use a mirrorOf entry in everyone’s settings.xml to point at that url.
If you are exposing your source and want to make it easy for others to
build, then consider adding a repository entry to your POM, but don’t
pick a URL lightly, think long-term, and use a URL that will always be
under your control.
http://blog.sonatype.com/2009/02/why-putting-repositories-in-your-poms-is-a-bad-idea/
I'm asking for recommendation on how to configure our Client/Server build. we have a client server architecture. the versions of the Client and the Server are tightly coupled, meaning,
they are both stored in the same git repository.
during development, changes in Client and the Server must be made at the same time to maintain compatibility in some cases
the Client code is dependant on server code
at the moment they do not share a parent pom.
I'm wondering what would be the best way to have both Client and Server compiled from the same branch. keeping in mind branches are created all the time and developers may run a job on a private branch using parameterized builds.
options:
Create combined parent pom.
Create a Jenkins job and execute 2 maven builds one of the other using shell commands
Add branch name to the version and deploy the server to the Artifactory
Maven modules
You can use modules to aggregate both the client and server projects within the same Maven build. You don't have to have a parent POM in the inheritance sense, but you need one more POM to aggregate the two projects. You'll need the following directory/files structure (normally all POM files are named pom.xml, I renamed them here for clarity):
main-pom.xml
server/
server-pom.xml
client/
client-pom.xml
In main-pom.xml specify the projects to be built in the "modules" section:
<modules>
<module>server</module>
<module>client</module>
</modules>
The module names have to be the directory names. Don't worry about the order, Maven will figure it out according to dependencies.
You can combine this approach with inheritance (the real parent POM) if it makes sense to share properties between your client and server projects (version, common dependencies, plugins, etc.).
I have a Jenkins cluster that is shared by several teams, that I can configure build jobs on, However i can't easily make changes to the Jenkins configuration itself.
There is a central "nexus pro" maven repository manager but each team / group in this very large multinational has their own repo, publishing to the repos requires username / password combination.
This means that I have to configure the Jenkins server with a maven settings.xml that is unique to the team I am working with without messing up the maven configuration of the other users of the Jenkins cluster.
Git is the source control repository.
On a shared Jenkins cluster how do I configure a maven settings.xml that is unique to a a group of build jobs or to a single job? What are the best practices for handling this type of situation?
I would recommend using the configuration file plugin, provides a UI to edit one or more Maven settings files.
These settings files can be passed into your Maven build using the "-s" option.
You can specify for each job in the Maven Advanced Options part a specific seetings.xml path
We manage all our build nodes using Puppet. It gives you greater control than just settings.xml. Highly recommended
Puppet is IT automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to patch management and compliance. Using Puppet, you can easily automate repetitive tasks, quickly deploy critical applications, and proactively manage change, scaling from 10s of servers to 1000s, on-premise or in the cloud.
If your company is using Nexus Pro (as you've already mentioned), then your unique Maven settings.xml can be stored there, and retrieved at build time using the nexus-maven-plugin as described here: http://books.sonatype.com/nexus-book/reference/maven-settings.html
Combined with token-based access (again, Nexus Pro does this), you do not need to store passwords insecurely in the settings.xml (see https://books.sonatype.com/nexus-book/reference/usertoken.html)
I faced the similar issue when building the project with jenkins as ojdbc jar is not available in maven central repository.
It worked when I placed the ojdbc jar in WEB-INF/lib folder and removed the maven dependency in pom.xml.
A good way to automate the provisioning of maven executors with specific configuration, is using ElasticBox Jenkins plugin.
You only need to create a box for the Maven slave, that define all the customization variables and files to be used by it and choose your preferred cloud provider for deploying it.
ElasticBox gives you also the flexibility to create new slaves only when needed and automatically destroy them after an specified retention time.
Here is how-to connect your Jenkins with ElasticBox:
https://elasticbox.com/documentation/integrate-with-jenkins/jenkins-elasticbox-setup/#jenkins-configure-plugin
Here is how to automate creation of Jenkins slaves with ElasticBox:
https://elasticbox.com/documentation/integrate-with-jenkins/jenkins-elasticbox-slaves/
There is a blog post about how easily build and deploy from GitHub pull requests with ElasticBox Jenkins plugin:
https://elasticbox.com/blog/github-pull-requests-jenkinsplugin/
I have a project that uses maven and I am attempting to deploy to the sonatype OSS repository. When I execute mvn release:perform, 5 different staging repos are created instead of just one. The various files are spread among these different repos so I cannot successfully deploy.
Is there a reason that maven is splitting up my release?
The project along with my pom files are here:
https://github.com/Uncodin/bypass/tree/master/platform/android
Turns out that each staging repository thought that it was deployed from a different IP address. This can happen in corporate environments where a floating IP address proxies outbound requests.
https://issues.sonatype.org/browse/OSSRH-5454?focusedCommentId=180666&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-180666
the parent you are using (https://oss.sonatype.org/service/local/repositories/central/content/org/sonatype/oss/oss-parent/7/oss-parent-7.pom) does not really give a hint on whats going wrong. there is only one release repository configured: https://oss.sonatype.org/service/local/staging/deploy/maven2/
Is it possible this is caused by some configuration inside the Nexus Proxy? And not by your maven structure?