Using Jenkins Container to build Delphi applications - docker

I wish to setup Jenkins using Docker to build different projects, some are in Delphi, some in node.js + AngularJS.
For the node.js and Angular, I think it can be done with a Linux container, but for what concerns the Delphi I think I have to use a Windows container or an agent build on windows container.
I've tried googling around but I've not found any docker container build on windows and Jenkins agent.
Anyone has got a similar need and found a clean and easy way to set up such an enviorment?
Thanks

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 start docker containers using shell commands in Jenkins

I'm trying to start two containers (each with different image) using Jenkins shell commands. I tried installing docker extension in Jenkins and/or setting docker in global configuration tools. I am also doing all this in a pipeline. After executing docker run... I'm getting Docker: not found error in Jenkins console output.
I am also having a hard time finding a guide on the internet that describes exactly what I wish to accomplish. If it is of any importance, I'm trying to start a Selenium Grid and a Selenium Chrome Node and then using maven (that is configured and works correctly) send a test suite on that node.
If u have any experience with something similiar to what I wish to accomplish, please share your thoughts as what the best approach is to this situation.
Cheers.
That's because docker images that you probably create within your pipeline cannot also run (become containers) within the pipeline environment, because that environment isn't designed to also host applications.
You need to find a hosting provider for your docker images (e.g. Azure or GCP). Once you set up the hosting part, you need to add a step to your pipeline to upload/push the image to that provider's docker registry or to the free public Docker Hub. Then, finally, add a step to your pipeline to send a command to your hosting, to download the image from whichever docker registry you chose, and to launch the image into a container (this last part of download and launch is covered by docker run). Only at that point you have a running app.
Good luck.
Somewhat relevant (maybe it'll help you understand how some of those things work):
Command docker build is comparable to the proces of producing an installer package such as MSI.
Docker image is comparable to an installation package (e.g. MSI).
Command docker run is comparable to running an installer package with the goal of installing an app. So, using same analogy, running an MSI installs an app.
Container is comparable to installed application. Just like an app, docker container can run or be in stopped state. This depends on the environment, which I referred to as "hosting" above.
Just like you can build an MSI package on one machine and run it on other machines, you build docker images on one machine (pipeline host, in your case), but you need to host them in environments that support that.

Build SSIS projects in a docker container

Currently we use devenv to compile SSIS projects and to create an ispac file.
I'm trying to acheive the same using a docker container. I tried installing VS 2017 in docker using commandline but running devenv just hangs and does not produce any output.
Different to the above issue, our acutal SSIS projects are built on legacy VS2013 and haven't been moved to 2017 yet. Is there a way of achieving this in docker container? Does anyone have experience of this?
From what I understand this is not currently supported and from Microsoft side there are no plans yet to support SSIS running on Docker.
On Docker side, the issue to support SSIS is still open as well

How to debug .net Core project with Docker support, using Visual Studio on a remote docker server

There are many similar questions like this, but my scenario is slightly different.
I use Visual Studio Enterprise 2017, dotnet Core app 2.0, on a Windows 10 Pro machine, where is running docker for windows.
I can run and debug my applications in my local machine's docker server, but now I would like to configure visual studio, for my current project only, to run the application in another docker server.
So in practice instead of running commands such as docker run, docker build and so on, I would like it to use docker --tls -H={theotherdockerserver} build ...
I could not find so far any parameter or configuration section that allows me to do so.
You need to have all your files accessible from remote server. One way to do this is to put your code in GitHub repository and run command: docker --tls -H={dockerserver} build https://github.com/{user}/{repository}.git
Documentation for GitHub build.
Do you need an option without GitHub repository?

Install Jenkins as a Service or Run it behind Apatche

I understand that there are two ways of installing Jenkins:
1) Running Jenkins behind Apache (Using the War file)
2) Installing Jenkins as a Windows Service(using the windows Installer)
I am in the process of creating a CI, Auto-Deployment and Scheduled Automation runs for my project. So in this case which kind of installation should be better. I just do not want to choose the wrong one and end up recreating jobs to the other kind.
I have few questions:
1) If I choose to install as a Windows service( using the windows installer), do I still have to install an web server like IIS or Apatche for accessing my Jenkins URL, or does Jenkins have something inbuilt in it and I do not have to add an web server for accessing Jenkins?
2)If Jenkins as a Windows Service(using the windows Installer) needs IIS, I have steps in my project in which I have to restart IIS manually to generate NCover reports. In such cases, would Jenkins also be down?
3) Jenkins website states the following: "In situations where you have existing web sites on your server, you may find it useful to run Jenkins (or the servlet container that Jenkins runs in) behind Apache, so that you can bind Jenkins to the part of a bigger website that you may have.".
I would be hosting our application locally using IIS, in that case, should I chose to use the WAR installer instead of the windows installer.
I do not run Jenkin's on Windows but I believe its the same as other platforms...
No if you install Jenkins with the installer you will not need IIS or Apache
See the answer to 1, If you don't use IIS to run Jenkins restarting it won't bring down Jenkins
It sounds like you want to run your existing site under IIS and leave Jenkins running on its own. I think the windows installer for Jenkins will do exactly this.
I have run Jenkins on Windows and Unix environment.
Just wanted to add more to Ben's answer:
Windows if you install as windows service you will not need anything and for this following wiki should be more than enough:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+as+a+Windows+service
To add more to 3rd point:
Normally web sites are hosted behind Apache httpd server. If you are using one then you can configure both IIS web server and Jenkins accordingly.
In my previous company, we was running Jenkins as a service (with the solution proposed by Vinay above).
It worked well and you don't have to install an application server like Apache.
The only thing you have to take care is the user which launch the Windows service.
If your Jenkins server needs to access some ressource on the network, maybe you have to use a LDAP user to launch your service instead of using the "local system account".

Resources