Windows cloud

Build Status Jenkins Plugin Installs Join the chat at https://gitter.im/jenkinsci/windows-cloud-plugin

This plugin builds Windows agents to perform builds.

It has been tested on VMware virtual machines with Windows Server 2012 R2 and Windows Server 2016.

Table of Contents

Requirements

JNLP must be enabled on Jenkins.

Make sure you have WinRM configured on your server with NTLM or Basic authentication. See Microsoft documentation

Java must be installed on the server and included in Path environment variable.

WinRM Authorization Configuration

In a PowerShell terminal,

Check Winrm configuration :

PS C:\Users\admin> winrm get winrm/config
Config
(...)
    Service
        RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GR;;;IU)(A;;GX;;;RM)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
        MaxConcurrentOperations = 4294967295
        MaxConcurrentOperationsPerUser = 1500
        EnumerationTimeoutms = 240000
        MaxConnections = 300
        MaxPacketRetrievalTimeSeconds = 120
        AllowUnencrypted = false
        Auth
            Basic = false // --> NTLM or Basic must be enabled
            Kerberos = true
            Negotiate = true // --> NTLM or Basic must be enabled
            Certificate = false
            CredSSP = true
            CbtHardeningLevel = Relaxed
        DefaultPorts
            HTTP = 5985 // --> Port for http
            HTTPS = 5986 // --> Port for https
        IPv4Filter = *
        IPv6Filter = *
        EnableCompatibilityHttpListener = false
        EnableCompatibilityHttpsListener = false
        CertificateThumbprint
        AllowRemoteAccess = true
(...)

Verify PowerShell permissions :

PS C:\Users\admin> (Get-PSSessionConfiguration -Name Microsoft.PowerShell).Permission
NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators AccessAllowed, BUILTIN\Remote Management Users AccessAllo
wed

Then launch

PS C:\Users\admin> winrm configSDDL default

Add permission to "Remote Management User" by following steps :

  • Click on Add

  • Click on Locations

  • Select your computer

  • Click on Advanced

  • Click on Find Now

  • Select "Remote Management Users" and click on OK

  • Allow only Execute for "Remote Management Users"

Restart Winrm with the command :

PS C:\Users\admin> Restart-Service winrm

Plugin configuration

Global configuration

In the "Configure Clouds" section of Jenkins Nodes Configuration.

Add a new Windows cloud

Give a unique name to the cloud. Then click on "Cloud Details..."

In the Agent Properties section, fill the Jenkins URL. Then add a new Windows Host and click on "Host Details..."

Fill the fields like in the given example :

The Credential is an username and password type and the account used must be in Administrator group on the server.

Click on "Test Connection" to test the configuration. If it works, you should see the name of the windows computer and the user used to connect.

Web Socket

Since v1.0.1, Widows agents supports WebSocket.

The option is available in Windows Cloud settings :

Logs configuration

You can define a custom LOGGER to log every output of the plugin on the same place. To perform it, go to System logs in the Jenkins configuration :

Configure the Logger of the plugin :

Execution

After configuration, when you run a job with a Windows Cloud label, it will create a jenkins agent on the windows you setted as host and run the build on it.

You should see it on the home page of Jenkins :

Troubleshooting

The plugin was tested on a VMware virtual machine with 2 processors and 8GB Memory. The memory was wide, but the processor touched 100% many times.

When it happens, the creation of the agents can be slow or sometimes, it cannot be created before the timeout.

In this case, it is better to reduce the number of users allowed on the Host in the cloud configuration. If you really want to keep the max users, you can upgrade "Agent connection timeout", "Command timeout" in advanced properties of the host.

References

This project contains code under Apache-2.0 License from :

Team

Product Owner : Cloudehard

Developers : feirychris, mat1e

Microsoft expertise : Aelotmani

Contact

Any question ? You can ask it on the Gitter room or open an issue.