How to preconfigure Azure Windows image with SSH to use with Jenkins Windows Agents on Azure Cloud - windows

I am trying to follow these instructions to us the Jenkins Plugin to create Jenkins agents with Azure Virtual Machines (via Azure ARM template).
Azure VM Agents plugin
Under Supported Features, it says:
Windows Agents on Azure Cloud using SSH and JNLP
For Windows images to launch via SSH, the image needs to be preconfigured with SSH.
I am a bit confused by this and I'm not sure what it means.
Does it mean that an SSH Client or Server should be installed on the Windows image?
There doesn't seem to be a option for setting up a Windows Azure VM with SSH access, as there is for a linux VM.
Please can anyone clarify what the set up process is?
(By the way, I have tried an unattended installation of cygwin on the Windows VM to try to run a SSH server, but I am running into a separate problem I am trying to solve. I'd like to know if this is not required.)

Answering my own question now I have got a bit deeper in. In the configuration section of the plugin, under Image Configuration, clicking the help on the launch method clarifies what's required.
It looks like a custom image needs to be custom-prepared with a SSH server pre-installed. However, it also looks like it is possible to launch an image with JNLP instead, so I will try that.
Update
I couldn't get JNLP to work (not sure why) but I did get SSH to work. Ticking the 'Pre-Install SSH in Windows Slave (Check when using Windows and SSH)' box does the trick. There's no need to pre-install on the custom image.

Related

How to create windows docker image with VS test agents?

I couldn't find any windows image with test agents at microsoft's public docker repo. How can i create a windows docker image with Visual Studio Tests agents to run codedui/mstest?
On a general note how to create a windows docker image with any gui based software pre-installed and pre-configured?
Note: This looks like a low research question, but i had to post it here because docker+windows is relatively new thing and there aren't much information available on net as well.
You could have a VM template with the Microsoft Agent Software already installed on the machine. All the GUI setup does is modify an XML, so you could effectively:
Have a VM container with the AGENT already installed.
Stop the TestAgent service
Modify the Agent Configuration XML
Restart the TestAgent service
This could probably be achieved with a PowerShell script or a custom console application.
If you need more help, we could figure this out together. Please feel free to contact me on LinkedIn.
https://www.linkedin.com/in/david-o-neill-8a1aa498/

Run normal Win32 applications in Docker for Windows

I'm a little bit confused about the concept of Docker for Windows.
Can I create a docker container for windows (and a windows host like Server 2016) and install a normal windows application into that container (simple: notepad.exe; advanced some more complex application programmed in Delphi)?
And can I run this container on every Docker enabled (windows) Host? Does the container starts automatically the application inside? Or can a windows docker container only provide service or webbased applications like an IIS website?
if you have Windows Server 2016, you will be able to launch Windows containers (and you will need a Linux server to launch Linux containers).
See those links
https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/manage_docker
https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/container_setup
https://msdn.microsoft.com/en-us/virtualization/windowscontainers/containers_welcome
In Windows, your Dockerfile will start with
FROM windowsservercore
instead of the more usual
FROM debian
or
FROM ubuntu
See some examples of IIS in (Windows) docker
https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/manage_docker
or a SQL Server in docker
http://26thcentury.com/2016/01/03/dockerfile-to-create-sql-server-express-windows-container-image/
The types of application that are candidates for docker are applications that do not have a UI.
Unlike a VM docker images are very slim having only enough codebase to service a particular use case. You can however create a docker image and use VNC to view a desktop like environment; but you have to go through hoops to configure it. Far easier to have a VM if you need a gui surface.
The strength of docker is to easily create containers of servers and DB back ends. You can even run email servers, or a stack of restful services.
On my laptop I had installed mysql, IIS and PHP. With docker I migrated all of these into an image. I spin it up when I need it and in less than 10 seconds i have a working db backend, an IIS server with PHP interface. I can maintain different versions of mysql, IIS and PHP for different iterations, they are all isolated from each other and run in their own container. When I upgrade my laptop I will not need to install any of these, just the image will work.
I know the topic is a bit old, but since I just tried I thought I'll add my 2ct.
No, you cannot start a Windows application inside a container and expect its windows to appear on your desktop.
While starting such an application is possible, in fact, it's of little use because you won't be able to see or interact with the UI.
For example, you can start notepad.exe in your Windows Core Server container and verify that the process is running (using tasklist instead of taskmanager, which cannot be seen as well).
But you cannot type anything into this notepad instance or access the menu.
Hth,
mav
No. Docker is essentially Linux. Yes, you can run Docker on Windows, but what it in fact does is to install VirtualBox and run a Linux VM inside it. Docker servers generally run on Linux VM's in the cloud. The programs you can put in a Docker container are Linux programs.

Is it possible to write a script to run an application on Windows VM from your mac?

I am using a RDC Connection from my mac to connect to an application (on windows box) in client network. Is that possible to write a script which does the following:
Open ur RDC. (i am using CoRD for this where my VM credentials are saved in .rdp files.
Login to VM with valid credentials from your .rdp file.
Open your app on that VM (for ex: IE explorer)
Following code in my shell script will connect me to my VM.(First two steps are working)
open rdp://[username[:password]#]hostname
How should I automate third step?
Is there any other way than shell script?
If you install Jenkins on your Mac, then install the Jenkins slave agent on the Windows machine, you can remotely run any command you like on the Windows box via the Jenkins web UI, and get back the results as well. In that scenario there's no need to use RDC at all.
For some more background, see: https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
This might be a simplistic answer, but AutoHotKey is something that will automate your 3rd step. Its free and pretty easy to script. You can have this in your start up routine for your VM, so when you log in, you can have this kick off your job.
I have used it before for testing some Java Swing components on Windows and its been pretty handy (Windows was running on a Virtualbox VM on my Mac).

How to ask a remote windows machine to automatically launch an application?

I have a windows server 2003 up in the internet.
But sometime I need to restart it.
After restart, I want one of the applications to run.
I want to do this all programatically.
I can now remotely restart the server.
But the question is how can I ask that piece of software to be executed (more precisely, I want to execute a .BAT file to ask a tomcat to run)?
Because I don't want to manually log in to the machine and start that application. That is time consuming. Is there any possible way, once the machine is started, my application will be run as well?
If you're developing an application that should always be running on the server, you probably need to implement it as a Windows service. For C#, see the classes in the System.ServiceProcess namespace -- you will need to inherit from ServiceBase.
Alternatively, you can set the program to be run as a scheduled task on boot. See the Task Scheduler API to do this.
You can install Cygwin and then do it the same way we'd do it on a Linux box: via ssh, using keys.
OpenSSH is not part of the default Cygwin install, so be sure to select it. It's in the Net category.
Then, after you've installed Cygwin and sshd, read /usr/share/doc/Cygwin/openssh.README to learn how to set up sshd as a service, so it will answer requests automatically, without you having to start the ssh daemon manually.
Finally, set up keys, as described in the link above.
Part of the ssh protocol is a way to ask a remote machine to launch a program. Setting it up with keys lets you do it without needing a password.
You could try xCmd, which is a freeware app to run a command on a remote machine.

Creating a virtual machine image as a continuous integration artifact?

I'm currently working on a server-side product which is a bit complex to deploy on a new server, which makes it an ideal candidate for testing out in a VM. We are already using Hudson as our CI system, and I would really like to be able to deploy a virtual machine image with the latest and greatest software as a build artifact.
So, how does one go about doing this exactly? What VM software is recommended for this purpose? How much scripting needs to be done to accomplish this? Are there any issues in particular when using Windows 2003 Server as the OS here?
Sorry to deny anyone an accepted answer here, but based on further research (thanks to your answers!), I've found a better solution and wanted to summarize what I've found.
First, both VirtualBox and VMWare Server are great products, and since both are free, each is worth evaluating. We've decided to go with VMWare Server, since it is a more established product and we can get support for it should we need. This is especially important since we are also considering distributing our software to clients as a VM instead of a special server installation, assuming that the overhead from the VMWare Player is not too high. Also, there is a VMWare scripting interface called VIX which one can use to directly install files to the VM without needing to install SSH or SFTP, which is a big advantage.
So our solution is basically as follows... first we create a "vanilla" VM image with OS, nothing else, and check it into the repository. Then, we write a script which acts as our installer, putting the artifacts created by Hudson on the VM. This script should have interfaces to copy files directly, over SFTP, and through VIX. This will allow us to continue distributing software directly on the target machine, or through a VM of our choice. This resulting image is then compressed and distributed as an artifact of the CI server.
Regardless of the VM software (I can recommend VirtualBox, too) I think you are looking at the following scenario:
Build is done
CI launches virtual machine (or it is always running)
CI uses scp/sftp to upload build into VM over the network
CI uses the ssh (if available on target OS running in VM) or other remote command execution facility to trigger installation in the VM environment
VMWare Server is free and a very stable product. It also gives you the ability to create snapshots of the VM slice and rollback to previous version of your virtual machine when needed. It will run fine on Win 2003.
In terms of provisioning new VM slices for your builds, you can simply copy and past the folder that contains the VMWare files, change the SID and IP of the new VM and you have a new machine. Takes 15 minutes depending on the size of your VM slice. No scripting required.
If you use VirtualBox, you'll want to look into running it headless, since it'll be on your server. Normally, VirtualBox runs as a desktop app, but it's possible to start VMs from the commandline and access the virtual machine over RDP.
VBoxManage startvm "Windows 2003 Server" -type vrdp
We are using Jenkins + Vagrant + Chef for this scenario.
So you can do the following process:
Version control your VM environment using vagrant provisioning scripts (Chef or Puppet)
Build your system using Jenkins/Hudson
Run your Vagrant script to fetch the last stable release from CI output
Save the VM state to reuse in future.
Reference:
vagrantup.com
I'd recommend VirtualBox. It is free and has a well-defined programming interface, although I haven't personally used it in automated build situations.
Choosing VMWare is currently NOT a bad choice.
However,
Just like VMWare gives support for VMWare server, SUN gives support for VirtualBOX.
You can also accomplish this task using VMWare Studio, which is also free.
The basic workflow is this:
1. Create an XML file that describes your virtual machine
2. Use studio to create the shell.
3. Use VMWare server to provision the virtual machine.

Resources