I've been working on deployment automation. Major challenge am facing is copying the files from Jenkins to servers. Artifacts are present in workspace of the deployment job but I am not knowing how to deploy them by taking input parameters as userid and password. Since same job is used by release team and they only have access to production servers. I've searched online but seems there are not many articles for this common scenario. Can anyone suggest how this can be achieved without using tools such as puppet, preferably batch script or power shell script.
I recommend looking at the Jenkins SCP plugin: https://wiki.jenkins-ci.org/display/JENKINS/SCP+plugin
I haven't used it myself, but since you mentioned PowerShell, there is a Jenkins PowerShell plugin: https://wiki.jenkins-ci.org/display/JENKINS/PowerShell+Plugin
The PublishOver plugin looks useful as well: https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over
Alternatively you can run any arbitrary shell command using Jenkins shell script build step.
Related
I am completely new to Azure and PowerShell but have been tasked with setting up a build and deploy solution for several app services.
We currently have a build server (Azure VM) that is running CruiseControl.NET to build and test some C# .NET solutions that should be deployed in Azure.
This build server currently handles the following tasks:
Pulling code from source control when commits happen
Building the projects
Running some unit test cases
Copying output/binaries to an output location
However, as it exists now, developers of each of our app services need to 'Publish' their services manually from their development machines by clicking the button in Visual Studio once they have verified that the build and test cases have passed in the test environment on the server.
As I am hoping for a completely automated solution, I expect I need to use something like PowerShell or the Azure Cross Platform CLI (npm) to do this?
I'm extremely confused with the Azure Service Management vs Azure Resource Management versions with the new Azure Powershell 1.0. All of our services appear to be the newer Resource Management versions, not 'classic'.
The eventual goal is to have the build server do the following
Pulling code from source control when commits happen
Building the projects
Running some unit test cases
Copying output/binaries to an output location
If the build and test cases are successful, update the service in azure to the latest build
I am hoping there is a way to set up these projects, or take the existing binaries that result from the builds, and have them be deployed into Web Apps using the new Azure Resource Management Powershell features.
Any advice or resources for more information about how this can be done?
Hopefully this makes some sense. Please let me know if I am going about this completely the wrong way or direct me to a more correct forum.
Thanks!
have you consider to use Azure App Service? where you can get those build infrastructure for free. e.g https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/
Once you setup continues deployment, you will get below three when there is push event (if you are using git)
Pulling code from source control when commits happen
Building the projects
Copying output/binaries to an output location
and to "Running some unit test cases", you can create your own batch or powershell script with post deployment hook https://github.com/projectkudu/kudu/wiki/Post-Deployment-Action-Hooks
The school has given us an ubuntu server to use for an svn repository, trac, and building automated processes. The people in my group are all using visual stuido to develop the project.
Right now the server is setup to use ant as the builder and auto reports junit and javadocs to the apache webserver for easy viewing on the web.
My question is, how do I setup the server to do the same thing but for a c# project.
What I have done is install mono on the server. Now I am looking into nant to replace ant on the server but I am struggling to come up with a script to run with the post-commit hook.
From my understanding, we will develop in visual studio and commit through svn and then nant will execute when post-commit hook is called by the svn server.
I also found nunit to replace junit for testing purposes.
Sorry for the random thoughts but basically I am looking for advice/suggestions on how the setup the server for the project. am I headed in the right direction?
Run NAnt through mono or run XBuild (similar to MSBuild). post-commit hooks are ok for very light things, but look at Jenkins or TeamCity or travis-ci.org or AppVeyor or AppHarbor for anything major. Even better, git publish to Azure Web Apps with a free DreamSpark account, and it'll build and deploy on a post-commit hook.
I have been tasked with updating the companies outdated build process. It is all done in batch and perl scripts. The current build process is:
Schedule a build through a web interface.
Build server takes the build process off the queue.
Build server checks out all of the files from the TFS source control.
Build server runs a couple of code injection scripts that modify the source before the build.
Build server updates versions and signs the code.
Build server uses visual studio to compile the projects.
After that is finished the build server zips up the output and drops it in a network share location.
The real difficult part is the code injection scripts. They are 3 perl scripts that modify a lot of code. They are also very machine dependent in the way they were designed. (So I can't just drop them in the build process without a lot of modification)
My end goal is to be able to run the build process on local dev machines and also have CI running on the TFS server.
In my searching it seems that there is no way to emulate a TFS Build on a local machine. So is my only option to use pre-/post-build command line scripts in my cs.proj files? Or is there a better way to do complex builds on the local machine and run the same builds on the TFS?
I have seen Using TFS build definitions on a local machine, but that seems a bit hacky to me. I guess it wouldn't be a horrible solution if there isn't a better one.
I have tried to do something similar in the past myself. Unfortunately, there isn't a good way to go about it because of everything that the TFS Build Workflow requires. What I found was that there are basically 2 ways to go about it.
Create a MSBuild script that will run on both Server and Local
Create a MSBuild script for local and Custom Activity for Server.
If you are intent or have a requirement that you be able to reproduce the build exactly on both the developer machine and the build server, then I would opt for #1. Otherwise I would go with #2. The second option is nice because then you can play within the TFS workflow for doing the main builds which provides you with many objects that you would need as well as giving you a nice place to configure settings without having to check out/in files to change how the build occurs.
For either method you would most likely have to modify your Perl scripts to take in parameters to account for any customization you have to do between systems. Then you can have the user either pass these in or default them in the MSBuild script for local builds and set them up as parameters in the TFS Build Workflow. Thus they can be easily modified if needed. Regardless of the method though, the only good way to do it is to standardize on how things need to be setup on the developer machines and the build server so that you don't have to provide the customization as much.
If you do opt for the first option then you can use the Legacy build configuration for TFS build which supports using a MSBuild script for everything and then you can share the script between both developers and the build server but if someone accidentally changes this script then it does run the risk of breaking the build.
We have a solution which consists of several projects. Some of the projects are windows tasks, some are windows services and some are mvc-websites which are running on a remote server. On this server we are currently implementing TeamCity as CI server for automating our builds and deployments. As of now, the projects are deployed on this same server. The build, test steps etc works fine but I am not sure how to deploy the tasks and services. All tutorials about this subject (at least those I have seen) only concerns deployment of websites.
The most obvious way is to have a post-build step running a powershell script which are uninstalling the current running windows service, removes the old service, copy the new dll and start the service again. The windows task files could simply be replaced directly with the new version.
However, I do not like this solution, it feels very blunt and could perhaps be hard to implement if the deployment server is remote.
Does anyone have any better suggestion on how to make the deployment?
Have a nice day!
Try to look at Octopus depoy: http://octopusdeploy.com/. You can easy integrate it with TeamCity. It has abillity to star/stop service and much more. Moreover it use nuget packages.
You can deploy windows services via Web Deployment Tool as well. All you have to do is to create manifest.xml file with runCommand (un/install and start/stop service) and dirPath (deploy service) providers.
My manifest file which deploys also DB and web site looks like:
<sitemanifest>
<dbDacFx path='$dbSource' />
<runCommand path='$presync' waitInterval='30000'/>
<dirPath path='$winSource' />
<runCommand path='$postsync' waitInterval='30000'/>
<IisApp path='$webSource' managedRuntimeVersion='v4.0'/>
<setAcl path='$webSource' setAclResourceType='Directory'/>
<setAcl path='$webSource' setAclResourceType='Directory' setAclUser='anonymousAuthenticationUser'/>
</sitemanifest>
It's generated by build script in Psake, but you can do it as you wish.
I wrote two blogs about this topic, but they are in czech language.
Everything in one package
Parametrization of package
Hope, there is something that can help you.
Inedo's BuildMaster can pick up right where TeamCity leaves off using the BuildMaster TeamCity Extension. There's a free version avaiable that will probably solve your requirements.
We have to solve this own problem when we use BuildMaster to build/deploy BuildMaster (before installers get built), and if you take a look at the BuildMaster Specifics (Inedo.com > Support > Specifics > BuildMaster, you can see precicely how we stop/deploy/start the Windows service.
I want to create an ASP.NET build server for the first time since I've never used it.
Does anyone have a tutorial or resource on how to make an ASP.NET build server?
Or can anyone tell me how it's done?
If by "create" you mean "setup a build server" then I suggest you take a look at TeamCity from JetBrains.
TeamCity is a multi purpose build server and can be used to build ASP.NET projects as well. You can get up and running for free, and its very easy to set up, compared to CruiseControl.Net.
Take a look at MSBuild to see how to do specific ASP.NET build stuff.
MSBuild reference
How to use MSBuild to do ASP.NET compilation (video)
You might need something from the msbuildtasks open source task collection
If you really want to create your own build server from scratch (but why?), I can't help you.
You could make a build server using CruiseControl.NET which can build your project.
CruiseControl.Net Tutorial – Part 1
CruiseControl.Net Tutorial – Part 2
There is no ASP.NET build server as such.
Do you have a one-click build script? If not, you should create that first. Once you are able to run a single command and get a complete build, then it is easy to set up CruiseControl or some other build server.
Given the strength of the build servers out there it's really not sensible to spend any time developing your own.
You will, however, need at the minimum
a one-click build script
a source code repository (e.g. Subversion, TFS, or even [shudder] SourceSafe)
a server to use as a build box (I use a virtual image)
You may also find a one-click deployment script written using something like Powershell to be useful, too.
Note that a very effective alternative to CruiseControl.NET and TeamCity is Hudson. Although it's written in Java it's ridiculously simple to get going with a J2EE server like Tomcat.
The key strength of Hudson is the range the plug-ins, which allow you to monitor most version control systems and then not just build (through MSBuild or even the command line) but also run unit tests, acceptance tests, and so on.
You might look at Web Deployment Projects -- they allow you to build your site and merge all DLLs into a single file, for a fully pre-compiled site. You can use it with MSBuild.
An option on the automation side is Team Foundation Server's (TFS) automated builds. TFS also includes source control, bug tracking and many other features you may or may not need.