How to setup Jenkins shared library with Subversion - jenkins

Every example I've seen for Jenkins shared library setup on the web is based on Git/GitHub.
Can anyone help me with that using Subversion?
I've struggled a lot but could not figure out what should be specified as the Default version.
I've tried many different combinations of Project Repository Base, Include branches, Library Name and Default version but none worked.
Attached is the screenshot of my SVN repository setup. I know it's not as per the standards though, it should work somehow as it's just a demo project.

if your lib svn path is https://192.168.1.1:8443/svn/trunk/JenkinsLib, then Project Repository Base will be https://192.168.1.1:8443/svn/trunk/ and Default version is JenkinsLib.

While setting up the shared library in Configure System --> Global Pipeline libraries select Retrival Methond : Morden SCM and Source Code Management : Subversion like below picture :
and When you select Subversion it will ask you to choose subversion specific branching name like below:

I didn't want to tag a specific branch in SVN, so I just used a period (i.e. '.') in the DEFAULT VERSION field and that takes that HEAD of the repo.
The project repo base is just the svn:// path to your repo.
I hope that helps.

Related

How to add github-resident single-file header library to Visual Studio C++ solution/project?

I've been away from VS for some years and am now returning and would like to make use of modern integrations, e.g., github.
Given my own project, in a VC++ solution/project, how do I most effectively add single-file header libraries from public github repositories?
Is there a way to do it directly as a dependency given the url of the repo?
Do I clone it locally and add it as a dependency?
Do I clone it locally and add the header file to the solution/project
vcpkg?
Some use of git's submodules (integrated with VS I hope...)?
Or?
I'd like it to show up in my project in such a way that I can do #include "best-json/best-json.hpp" for a file in the someuser\best-json repository on GitHub. (Or GitLab, or anywhere with a url.)
I'd like that to be the case even if, in the remote repository, the header file in question was in a subdirectory under the root called include, or maybe a subdirectory called best-json, or maybe even at top level.
By "effectively" I mean: Does the "right" thing as described above, even though not necessarily the absolute simplest way to do it.
Perhaps there's a VS extension that automates this?
[I searched the web for this but only found pages talking about how I'd export ("publish" I guess) my project to Github, or how to clone an entire project from Github, etc. etc.]

in Jenkins, how do I compare versions of a file, the one in previous build with the current build?

I am using Git as SCM, but I would prefer not to tag the code, so I'd rather use Jenkins to find out if one file has changed from one build to another , and read the content.
of course, I would want to do this from the current build.
You should try set up an scm browser server such as fisheye or p4web, and set up the perforce plugin to talk to it. That will provide links to the diffs for each file in the changelog.
Hope it help

Poll and checkout at different levels in SVN repository

We have a Visual Studio solution containing about a dozen class library projects. They're our team's main internal framework. In Jenkins we would like to automate the building of these projects as soon as a check-in is made, and also publish a new version to our local NuGet repo.
The problem: We would like to trigger the build by polling SVN at the class library level, e.g. ..trunk/OurSolution/OurCoreProject. Changes in one project should not trigger a build on all the other projects. But the checkout needs to be done one level higher, e.g. at ..trunk/OurSolution, and I cannot figure out how this can be done.
We've tried and contemplated a few solutions already:
Checking out at project level and then send the .csproj file to
MsBuild.exe instead of the .sln file. This fails because the project
expects a sibling folder named .nuget.
Looking into the Multiple SCMs
plugin, but it seems to mainly add the ability to use different SCM
providers in the same project(?) I would like to avoid adding this
plugin until I know it solves this.
Splitting all the projects up into separate solutions. Doesn't feel very optimal...
Is there a way to solve this in Jenkins? Have a missed any viable solution?
Yes you have missed something... the Advanced... button on the Subversion checkout configuration.
Do your SVN checkout on ..trunk/OurSolution
Click Advanced...
Under Included Regions, type ..trunk/OurSolution/OurCoreProject/*
For more info, click the ? icon next to relevant text area on the UI
If set, and Jenkins is set to poll for changes, Jenkins will ignore any files and/or folders that are not in this list when determining if a build needs to be triggered.

Jenkins won't download svn:externals directory

I've added an svn:externals to my project, and it works great locally via TortoiseSVN. When I use Jenkins to pull from the same repository, it's not showing anything about the externals in the console output.
I read some other questions on here and I made sure my SVN version number in Jenkins was set to (1.6 externals to file) and restarted Jenkins. The problem is still occurring. Any ideas of something else I could set, or something I could use for troubleshooting? Thanks.
Oh, and the external directory is in the same repository, so I don't think it's an authentication issue as it builds fine without a reference to the external files.
I fixed this issue by selecting higher SVN Version Number on Jenkins 2.222.1.
Here is the procedure:
Manage Jenkins -> Configure System -> Subversion Workspace Version
Select at least v1.6. (The default one was 1.4 for me)
I may have had a very uncommon structure, but here's what worked for me...
First of all, here's the directory structure:
--Parent
----folder1
------subfolder1
------svnexternalfolder
----svnexternalfolder
As you can see, I had my svn external folder in two different levels of the project structure, but the Jenkins project was pointing directly at "folder1".
When first configured, it would never pull the files for my svn external folder (whether it was a full checkout, or svn update). This was configured with the svnexternals at the parent level.
My next try was to remove the svn externals at the parent, then specify just the higher location on the parent, then the lower location on folder1. This gave an error since the child svn directory had the same name as the other one.
So I flip-flopped the order of creating the svn external locations and did the child first (on "folder1"), then did the higher one on parent. Once I did that, everything started working.
Hope this helps someone else.
If you're curious about why I configured the directory structure this way, this was a PhoneGap project. apparently cordova/phonegap projects create their directory structures like this, the common folder beneath the parent is the "www" which houses all html, javascript, etc files, then those are also used under the platforms/ios, or platforms/android folders (in my example, I just called it folder1).

How to indicate build version in a DRY and automated manner across project & version control?

I'd like to have a version indicated for my builders i.e Version:101, that is both in my project and in the comments of my version control (GIT).
This is to ensure that if I ever need to change code deployed in production I can find that codes version number from the project, and match it to the GIT revision, then check it out to modify and re-deploy.
I'm using ASP.NET MVC . does anyone know of a good way to do this? I'd like it DRY I.E I mark the version n.o in the code and then GIT picks it up or something.
How can I do this?
If I understood your question correctly, you want that your binaries have the version number somewhere. I'm assuming you are using annotated tags for versioning. For a C++ project I did something like this:
Create a pre-build script that runs the command git describe (and append --match "v[0-9]*" if you use tags for other purposes too) and spits out a file that you can use in the project. For my project, this was "gitversion.h" that had the following:
#define VERSION "v1.2.3-5-g472ac4f"
This file should be in your .gitignore file, you don't want it to end up in the repository.
Then use that file in your build as usual.

Resources