How to configure Jenkins with .NET Core in Openshift? - jenkins

Openshift provides a standard Jenkins template with preinstalled tools allowing us to execute oc commands. If we want to build NodeJS apps we can install NodeJS plugin for Jenkins. If we want to build .NET apps we can use MSBuild plugin. But there's no .NET Core plugin. In virtually all resources online people just install .NET Core CLI using apt-get (or different app management tools) on the Jenkins machine directly.
How to properly build .NET Core applications in Jenkins within Openshift environment? Should I provision Jenkins pod with .NET Core CLI using some scripts? Can I use some custom image to create slave Jenkins instance with .NET Core CLI preinstalled (this link suggests that way)? What's the recommended way?

For using the dotnet-jenkins-slave images, there is information in the Red Hat documentation: https://access.redhat.com/documentation/en-us/net_core/2.2/html/getting_started_guide/gs_dotnet_on_openshift#using_jenkins.
There is also a blog post on Red Hat developer blog on this topic: https://developers.redhat.com/blog/2019/10/17/ci-cd-for-net-core-container-applications-on-red-hat-openshift/.

Related

Run a gitlab CI pipeline in Docker container

Absolute beginner in DevOps here. I have a Gitlab repo that I would like to build and run its tests in the Gitlab pipeline CI.
So far, I'm only testing locally on my machine with a specific runner. There's a lot information out there and I'm starting to get lost with what to use and how to use it.
How would I go about creating a container with the tools that I need ? (VS compiler, cmake, git, etc...)
My application contains an SDK that only works on windows, so I'm not sure building on another platform would work at all, so how do I select a windows based container?
How would I use that container in the yml file in gitlab so that I can build my solution and run my tests?
Any specific documentation links or suggestions are welcomed and appreciated.
How would I go about creating a container with the tools that I need ? (VS compiler, cmake, git, etc...)
you can install those tools before the pipeline script runs. I usually do this in before_script.
If there's large-ish packages that need to be installed on every pipeline run, I'd recommend that you make yourown image, with all the required build dependencies, push it to GitLab and then just use it as your job image.
My application contains an SDK that only works on windows, so I'm not sure building on another platform would work at all, so how do I select a windows based container?
If you're using gitlab.com - Windows runners are currently in beta, but available for use.
SaaS runners on Windows are in beta and shouldn’t be used for production workloads.
During this beta period, the shared runner quota for CI/CD minutes applies for groups and projects in the same manner as Linux runners. This may change when the beta period ends, as discussed in this related issue.
If you're self-hosting - setup your own runner on Windows.
How would I use that container in the yml file in gitlab so that I can build my solution and run my tests?
This really depends on:
previous parts (you're using GL.com / self hosted)
how your application is built
what infrastructure you have access to
What I'm trying to say is that I feel like I can't give you a good answer without quite some more information

how to add docker support for the web application developed by using .netcore and angular5?

I developed simple web application using .NET core and Angular5 by following this Create Angular 5 application using .NET Core 2.0 Template in Visual Studio 2017. But I want to add the Docker support for that application.
So, how can I add the Docker support and how to do CI and CD using VSTS for that application.
Enable docker support: Right click the project > Add > Docker support.
Regarding CI and CD for Docker supported project in VSTS, there are some build templates, such as Container (Preview), ASP.NET with containers. You need to update it per to the detail requirement.
There is a blog that may benefit you: Continuous Deployment for Docker with VSTS and Azure Container Registry

How to use Jenkins for .NET builds

We have a Jenkins server running on a Linux box and we are using it for Java projects (Maven builds).
We shall have a couple of .NET applications coming up. Shall I be able to build them on the Linux box? Do I need to add a windows box? Any help will be appreciated.
If these are .NET Framework (and not .NET Core) applications, the easiest way to go about it is to add a Windows box with everything you need for building your .NET apps (e.g. install .NET Build tools), etc. and then setup a Jenkins slave on that box.
Then on your builds for .NET, you specify a requirement to use the slave on the Windows box to build it.
N.B. Keep the Windows build node as clean as possible - i.e. Resist the temptation and do not install the full Visual Studio on it (!). Only install the SDKs you need.

How can I use SonarQube to scan an ASPNET Core 1.1 project?

I have my Mac setup with Jenkins and SonarQube and Docker to test automation. I also have the same setup on my Windows VM using VMWare and all the windows variants as well. My .NET application compiles well and I can run SonarQube after pulling from GitHub and running MSBuild.exe against it fine. But how can I do a similar process with the 'dotnet restore', 'dotnet publish' on my Mac with the .NET Open Source projects like ASPNET Core 1.1? I have not seen how to setup SonarQube to scan the ASPNET Core 1.1 or the DotNet Core 1.1 projects with any prebuild, build, postbuild steps from within Jenkins. Is there support for the ASPNET Core yet in SonarQube? Do I need a patch or to run a certain commandline group of scripts to do the same thing natively on my Mac? Any help is appreciated. I have searched for a few hours and have found nothing.
The support of .NET Core projects is not yet available in the SonarQube Scanner for MSBuild. We are currently working on it and it should be available within the upcoming 2 weeks.
Feel free to watch SONARMSBRU-167 to follow the status.

IBM MobileFirst: Build scripts for Jenkins?

Are there any standard build scripts (For building adapters and Hybrid Apps) that I can use as base for creating my build process.
Thanks in advance!
/Amit
MobileFirst Platform does not officially support Jenkins and thus does not provide any 'standard build scripts'.
It could be that some customers would prefer to use Jenkins over other tools and methods.
The MFP user documentation suggests and provide instructions for using Apache Ant.

Resources