Skip to content

[temurin-compliance] - Reconfigure Windows 11 Jenkins Machine For Exclusive Use In TCK

Summary

In order to automate the TCK GUI testing using project Arctic, we need a windows machine set up in such a fashion to allow the jenkins user to disconnect, and attach to the system console ( this is fairly common with windows GUI based testing automation. )

Running GUI tests without EITHER a user session logged in and actively watching the desktop, or having a session connected to the console, causes the automation of GUI tests to fail.

The following guide, is how I have prototyped a working automation machine..

  1. Login to windows as Admin, Add Jenkins User To Admnistrators Group ( Admin & Powershell )

Add-LocalGroupMember -Group Administrators -Member jenkins -ErrorAction Stop

  1. Login as Jenkins user, start Jenkins agent from command line, and minimise command prompt window

  2. Disconnect Jenkins user using TSCONcan ( Admin / Powershell ), create a powershell script to run the below, and run from the desktop as a shortcut, to ensure that a window isn't left behind.

# Get all sessions where the user is 'jenkins' and the session state is 'Active'
$sessions = qwinsta | ForEach-Object {
  ($_ -replace '\s{2,}', ',') -replace '^\s+','' # normalize spacing and trim
} | ConvertFrom-Csv -Header 'SessionName','Username','ID','State','Type','Device' | `
  Where-Object { $_.Username -eq 'jenkins' -and $_.State -eq 'Active' }
if ($sessions.Count -eq 0) {
  Write-Output "No active session found for user 'jenkins'."
  exit 1
}
# If multiple sessions, take the first one (or modify logic as needed)
$sessionId = $sessions[0].ID
# Run tscon to disconnect the session to the console
try {
  tscon $sessionId /dest:console
  Write-Output "Successfully disconnected session ID $sessionId for user 'jenkins'."
} catch {
  Write-Output "Failed to disconnect session ID $sessionId. $_"
}
  1. As Admin, Remove Jenkins User From Administrators Group ( Admin & Powershell ) Remove-LocalGroupMember -Group Administrators -Member jenkins -ErrorAction Stop

This would need to be done everytime the machine gets rebooted, but limits the admin permissions of the jenkins user, for just the one session thats running...

Priority

  • Urgent
  • High
  • Medium
  • Low

Severity

  • Blocker
  • Major
  • Normal
  • Low

Impact

(What is the impact of this issue? Is it blocking a release? Are there any time constraints?, for example: "We have a release tomorrow")m

Edited by Pawel Stankiewicz