2

I'm currently trying to configure Jenkins in order to launch my Windows slave using EC2 plugin. However, my slave agent enters an infinite loop with the message:

Connecting to ip-10-180-10-223.ap-southeast-2.compute.internal(10.180.10.223) with WinRM as Waiting for WinRM to come up. Sleeping 10s.

I followed this post How to run Windows instance on EC2 from Jenkins? to troubleshoot my issue but to no avail. I configured for both the client and the server and used this command on the remote machine winrm identify -r:http://winrm_server:5985 -auth:basic -u:user_name -p:password -encoding:utf-8 as stated in this link http://www.gabrielmatteson.com/index.php/howto-configure-windows-remote-management-service-to-allow-http-and-basic-authentication/ but I got this message:

The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.

I followed this post here Connecting to remote server failed using WinRM from PowerShell to troubleshoot again but I still got the same message as above. For the EC2 instance, I modified the Security Group to allow all inbound and outbound traffic but it has not worked.

I don't know the issue why but my WinRM on the virtual server is up and running.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Lucas Bui
  • 23
  • 5

1 Answers1

0

WinRm need to be configured to allow remote server management.

Two ways to do this:

  1. Start your instance from aws and run these WinRm commands via the command line.
winrm quickconfig
winrm set winrm/config/client '@{AllowUnencrypted="true"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/client/Auth '@{Basic="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}'

then save the image of this instance (aws ui -> ec2 -> select the instance -> actions -> images and templates -> create an image) and use it for your jenkins slave.

  1. Put these commands in section "User Data" that you will find in the configurations of your jenkins agent (Jenkins UI -> Build Executor Status -> Configure Clouds).
<powershell>
winrm quickconfig
winrm set winrm/config/client '@{AllowUnencrypted="true"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/client/Auth '@{Basic="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}'
</powershell>

NOTE that 1024 is an example, you can allocate more memory if needed. In my case my jenkins job needed more memory and because i have an t3.Xlarge instance type (16Gib memory) i've allocated 8Gib (8192) to WinRm.

Sources:

  1. Jenkins Amazon EC2 plugin WinRM infinite loop
  2. https://issues.jenkins.io/browse/JENKINS-34610
Mickael Rahmine
  • 372
  • 1
  • 7