How can I automate a release build in hudson? - build

I have a release job, which I would like to automate. But I've only found the functionality to schedule a normal Build in hudson - and not a release build.
Which possibilities do I have?

Related

TFS 2017 - Build and Release

I am very new in TFS, need to implement CICD using TFS 2017 and its build and release feature,
when I tried to run build after creating build definition, I got error like no agent found, I googled and found how to configure agent, but I have logical confusion in my mind as below:
How Agent works with TFS 2017?
Where process of CI will be run on Agent or on TFS server?
Where I need to have msbuild ? where my built code will be placed?
What other dependencies would be there on Agent machine?
all question might be silly but as I have worked with Jenkins and Git, i dont have knowledge of Microsoft technologies, and I can't find well documents for the same.
How Agent works with TFS 2017?
In short to build with TFS, you need to Deploy an agent, in the agent machine you need to install the proper build components/SDKs accordingly based on your project.
Create a build definition. Once a build is triggered , the sources will be downloaded from the TFS repository to the agent machine and then build in the agent machine.
Related documents : Agent pools and queues; Build and Release Agents; Build definition options
Where process of CI will be run on Agent or on TFS server?
You can eanble the CI (turn on the Continuous integration trigger) in build definition. See Configure continuous integration for details. Thus the build will automatically be triggered once changes are checked in.
Related documents: A quick introduction to CI/CD ; Build and release
Where I need to have msbuild ? where my built code will be placed?
For vNext build, it's task based build system. You can define your build definition based on the tasks. See Build and release tasks .
e.g.: You can use MSBuild or Visual Studio Build task, you can specify the MSBuild Arguments as needed.
You can use the utility task: Copy and Publish Build Artifacts and Publish Build Artifacts to specify where the built code will be placed. (Artifact Type : Server/File share path)
What other dependencies would be there on Agent machine?
Refer to the answer for the first question.

Team Foundation Build 2013 and Octopus Deploy - How to reject a package when build or unit test fail?

We are using Team Build 2013 to create builds, and Octopus to deploy. The problem is that I can't figure out how to prevent my builds to reach the build server on failure, and finally prevent them from appearing on Octopus when the build or unit test fail. I have change the "Retention Policy" to erase builds when it fails, but Octopus still sees the empty builds.
My ultimate goal is to rollback the checkin if the build or unit test fails. But again, I can't find an event called "On Build failure" or something similar. I tried to use the Post-Build Script, but it is not called when a build fails.
I am using the new style builds not the XAML builds, but I find the following build steps effective:
Build Solution
Run Tests
MSBUILD with RunOctoPack=true
If the build or tests fail, Octopack doesn't send anything to Octopus Deploy.
So I don't set RunOctoPack in the project file or on the initial build.

How to set up TeamCity for Build -> Test -> Deploy flow

I have configured TeamCity with Git to get my ASP.NET MVC project.
My solution contains the web app and the corresponding unit tests:
MY_SOLUTION.sln:
- WebAppProject
- SomeCoreLibrary
- SomeCoreLibraryTests
- OtherProjects...
The steps that I have configured in TeamCity are the following:
Get external packages using NuGet
Build the solution and deploy it
Run Unit Tests
Run Automated Tests (using Selenium)
I want to run the unit tests after building but before deployment and stop deployment if the unit tests failed. Currently the deployment is done after the build using the following Command Line Parameters:
/p:VisualStudioVersion=11.0
/p:DeployOnBuild=true I want this to be done only after SomeCoreLibraryTests.dll unit tests have passed
/p:PublishProfile=MyWebDeploy
/P:AllowUntrustedCertificate=True
/P:UserName=username_here
/P:Password=password_here
Thanks,
Ionut
What I've done in similar cases is to use RoboCopy to just mirror the new website into the deployment path. Doesn't that work for you?
P.S.: if you do get this working, I'd suggest doing a performance improvement change in TeamCity (which would allow you to run the unit tests in parallel to the automated tests):
I assume you are employing a single build configuration for all those steps. If that is the case, what I would recommend instead is using Dependent Build configurations to separate the different concerns. You can see an example here in an open source project of mine:
http://teamcity.codebetter.com/viewLog.html?buildId=112432&buildTypeId=bt1075&tab=dependencies
Log in as Guest and expand the Testeroids :: Publish to NuGet tree node to visualize the build flow.
To achieve this, basically you pass around the result of your build step in the artifacts (e.g. you pass the resulting binaries from Compile into Unit Test). You gain several things by using dependent builds: several independent build steps can run in parallel on different agents, plus if one of your build steps fails because of external factors (e.g. let's say Publish failed because the network went down), you can trigger again the build and it will only rebuild the failed steps.
I am not familiar with the tools that you use. However, I would, in general, use a few build configurations for a project:
build configuration, triggered on change, containing these steps: get the latest source code and packages, build/compile and unit test. Then create an artifact for deployment task.
build configuration to deploy to a development server, triggered by successful completion of and using artifact (via dependency) from (1).
build configuration for long running (eg integration/functional) testing that is scheduled to run less frequently.
An advantage of (2) is that you can, if necessary, re-deploy a build/artifact without having to rebuild the artifact first. Also, if you have multiple agents, (2) and (3) can run independently of each other.
Furthermore, you can also tag build in (2) that have passed development checks and then use its artifact in another build configuration to deploy it to test server, etc.

Starting running all build configuration in TeamCity

In TC there is a project with a couple build configurations. Build configs targets projects that not interfere with each other - so I can start the build process simultaneously. On each build configuration home page there is Run button that starts the build.
My question - there is possible to create a such button that triggers the build of all configs?
I know that there is Build triggers and so on - but sometime there is need to start all build configuration - "on demand" build run - and it is a little inconvenient to go to each home page and press Run button.
You can accomplish this by creating a 'kick-off' build configuration -- it doesn't need to do anything -- and linking each of your parallel configurations to it by a Finish Build trigger. When you Run... the 'kick-off' configuration, it'll finish quickly and all of the parallel configurations should then get triggered.

Use specific build executor for releases in Hudson/Jenkins

I'm using Jenkins with Phing to make builds. I have one main build executor (master) and a few other build executors (slaves). Master is much slower than the slaves at building. However, master is the only executor which is able to make release builds.
My question is, how can I get non-release builds to build on the slaves/master and release builds to build only against the master?
Currently I manually change the project config in Jenkins restricting which executor can build the project. I often forget to change this when releasing and so want to avoid having to change the project config every time.
Your best option is to create two jobs, one for normal development builds, and the other for release builds.
You could also try creating a parameterised build, where the value of the variable is the slave to run the build on - I am not sure if hudson would allow you to put a variable in the "restrict where this project can be run" box though.