Nexus packages deployment using Jenkins - jenkins

I am trying to automate build and deployment of .Net windows service and SQL server scripts using Jenkins.
For .Net windows service, I am able to use MSBuild to create release exe/dlls. I have zipped the release folder and uploaded to Nexus.
For SQL server scripts, I have started using SSDT and able to create .dacpac file. I am also able to generate deployment script for a specific server using the .dacpac file. I have uploaded the .dacpac file to Nexus.
I am not sure what the best practices to deploy .Net artifacts from Nexus. I have the following questions:
How do I deploy .net Nexus packages? (do I unzip them and use
InstallUtil to install the service?)
How do I deploy sql .dacpac Nexus package? (do I unzip the
package and use SQLPackage to generate a script for the target
database server?)
Are there any better ways to deploy .Net Nexus packages?

Use NuGet packages and upload NuGet packages to nexus.
create a NuGet package using nuget pack command. You can do
this part of your msbuild
Push the above created NuGet package to
Nexus using nuget push command.
Here is the link about how to setup .Net Package repositories in Nexus
https://help.sonatype.com/repomanager2/.net-package-repositories-with-nuget

Related

How to .exe file to msi via jenkins

I'm new to .net application (non-web application) project and using jenkins for continuous build and release. I completed creating builds for my project and got the .exe and dll files. But i need to repackage it(create a msi) before deploying to servers. So can anyone give a stepwise information for rePackaging and tool to be used with jenkins for packaging. I want to automate this process in jenkins CI AND CD.
Jenkins is not capable to pack any applications directly.
It will always use an external tool via a plugin or installed by you.
In MSI case, you need an windows agent with an app that will receive the command in command line and produce your deliverable.
Applications:
Installshield (very old - paid)
visual studio (paid)
TFS (on premises or cloud) (paid)
MSIX (? I don't know much about it)
WIX (free)
Jenkins plugin here

Resolve nuget packages from Artifactory Pro using Jenkins Artifactory plugin for .net projects

Mainly used for : C# project, nuget package dependencies, MSBuild build tool (no TFS)
We are evaluating Artifactory Pro eval version, Jenkins for CI & dependency management. Currently, I have setup Jenkins to use the "Generic-Artifactory integration" build environment to resolve/restore nuget packages from Artifactory. I am able to access artifactory from Jenkins and see the various repos.
All I am looking to see is to have the Jenkins CI use the Artifactory plugin to fetch Nuget packages from Artifactory. If the nuget packages are not cached currently in Artifactory, I will go fetch it from Nuget gallery (https://www.nuget.org) and cache them in one of remote repos in Artifactory. Then the subsequent builds can then fetch from this Artifactory cache repo for any nuget dependencies. How do i do this with Jenkins CI, MSbuild tool, Artifactory Pro eval version.
IMO the fastest and easiest way to do that is to use the MsBuild Artifactory plugin.
This plugin is a simple extension for Visual Studio which allows you to add a new project type to your solution.
By doing it you will be able to control how to resolve nuget dependencies from Artifactory and what you want to publish in your repos.
Also I recommend using a single virtual repository for your case and to aggregate in it a local which will be your target for deployment and a remote connected to the official nuget gallery.
Also you can watch this webinar about the MsBuild Artifactory plugin. It is showing how to use it with TFS but the idea is the same for Jenkins as the plugin is simply an extension to the MsBuild process.

Repository manager that manages binary dll files (Embedded C/C++ project artifacts) and that integrates with Jenkins

Is there any Repository manager that manages the binary dll files and also integrates well with the Jenkins?
Can Nexus be used to manage the dll files as these files are created as a part of Embedded C/C++ Projects and not sure if Nexus Artifact Manager supports/integrates well with such Projects as it mainly supports the Java projects?
Is there a way to automatically manage the upload and download of such project artifacts from Nexus/other artifact managers without the use of POM file?
Suggest in case there are other Artifact Managers that supports binary artifacts.
Artifactory can be used to store any type of binaries.
Starting with Artifactory 4.0, you can create generic repositories which allows uploading packages of any type. You will not need to upload any POM files and Artifactory will not need to calculate any metadata (for example Maven metadata).
To deploy files you can use the REST API or the UI, for example:
curl -uUSER:PASS -T file.dll http://localhost:8081/artifactory/dll-local/path/to/file.dll
If you have a certain layout you would like to use for this repository you can create a custom layout and associate it with the repository. This can be useful for automatic snapshot/integration versions cleanup and other module management tasks.
Disclaimer: I'm affiliated with Artifactory
The Nexus repository manager is java oriented, but can be used to store any files you want. Binaries of all types or even just text configuration files.
To automate the file upload process, you can use maven from command line:
mvn deploy:deploy-file -DgroupId=com.you -DartifactId=file -Dversion=1.0 -Dpackaging=exe -Dfile=c:\out\file.exe -Durl=http://yourserver/nexus/content/repositories/releases -DrepositoryId=releases
Then, to get the file, you should be able to get it directly with the following URL:
wget http://yourserver/nexus/content/repositories/releases/com/you/file/1.0/file-1.0.exe
This is a simple approach to using Nexus as a general artifact repository.
I hope this helps.
The open source version of Nexus (Nexus OSS) is supports many repository formats out of the box including Maven, NuGet, NPM, RubyGems and others. Nexus just runs on Java (e.g. like Jenkins). It is not Java only...
Depending on how you plan to get the DLL files from the repository, different formats might be more or less suited to your usage. You could even use a custom format, but then you rely custom tools.
The scenarios I have seen at many customers are
using a Maven repo and pulling the files in either in a Maven build together with the Maven NAR Plugin (used for native development with C/C++)
using a Maven repo and pulling via plan HTTP GET calls using your scripting language/build tool of choice
using NuGet format and store the DLLs in NuGet packages in the repo and using nuget to retrieve them for the projects
All of these work well.

How do I deploy my nuget package with Octopus Deploy and TFS 2013?

I am attempting to fully automate the deployment of a simple assembly onto two application servers (which have the Tentacle services installed), and I'm running into a few challenges.
What I have achieved:
I can create a NuGet package with /p:RunOctoPack=true.
I can manually upload (publish?) the package to my built-in feed on the Octopus Deploy server.
I can deploy the packages to both my application servers using the Octopus Deploy portal.
I can infer from the post (OctopusPublishPackageToHttp in TFS Service) that I should be able simply put all of the following on the Process/Build/Advanced/MSBuild Arguments box
/p:RunOctoPack=true
/p:OctopusPublishPackageToHttp=http://octoserver:8081/nuget/packages
/p:OctopusPublishApiKey=API-MYKEY.
However my builds are returning the error
Exception Message: Access to the path 'C:\Builds\1\Experiments\CIBuildDef\bin\ConsoleTibcoMefClient1.1.0.0.0.nupkg' is denied.
(type UnauthorizedAccessException)
With this assembly (a simple .NET Class Library). The builds are all being dropped into the same path (C:\Builds\1\Experiments\CIBuildDef\bin). I'm accustomed to a new folder being created by the build every time. I must be missing something in the build definition settings. Am I getting this error because I'm not changing the version number of the package yet? I cannot seem to delete the nupkg that was originally dropped in the Builds directory, even after deleting it from the feed.
How do put my NuGet package onto the feed with TFS?
How do run my Octopus Deploy steps from TFS?
Am I asking the right questions?
Thanks for any input you can provide.
Could you ping your octopus server from tfs build server? And could you telnet to 8081 port from your tfs build server? If you could, you should rebuild the project not build for the same repository. If the new nuget version is not higher than 1.0.0.0 octopack could fail. You must increment the nuget version from your tfs build template. The following commands must be work for you. This commands are for msdeploy deployment with powershell. If you want to use msdeploy you must install it to tentacles. I am using it for web project deployment.
Command line arguments:
/t:Rebuild /p:AutoParameterizationWebConfigConnectionStrings=False
/p:DebugSymbols=false /p:DebugType=None /p:IsAutoBuild=True
/p:CreatePackageOnPublish=true /p:Configuration=Release;DeployOnBuild=True;PackageLocation=".\obj\Release\Myproject.zip";PackageAsSingleFile=True /p:RunOctoPack=true
/p:OctoPackPackageVersion=%VERSION%-dev
/p:OctoPackPublishPackageToHttp=http://octopus.yourdomain.com/nuget/packages /p:OctoPackPublishApiKey=API-xxxxxxxxxxxxx

How to upload files and folders to jenkins server

I have created a jenkins server in Mac OS X, and have iOS application project files in windows machine(not configured anything in windows machine) here want to achieve the below points.
Have to upload the iOS application projects into mac os x jenkins
server
Create a job for that uploaded project
have to build that project.
download the package files into windows machine
is this possible to achieve using jenkins framework?.
yes it is possible
the easiest way is to:
use git to upload project from windows to some git server (ex. github.com or your own installation on OsX machine)
configure jenkins job to use git repository you've created and add proper build step
use 'Publish Over CIFS' plugin to push build result to windows share

Resources