-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make windows gradle check server using proper amount of memory in WinRM #242
Merged
peterzhuamazon
merged 1 commit into
opensearch-project:main
from
peterzhuamazon:adding-100g-windows
Feb 14, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ | ||
"variables": { | ||
"name-base":"Jenkins-Agent-Windows2019-X64", | ||
"os-version": "Windows2019", | ||
"build-region":"us-east-1", | ||
"build-vpc":"vpc-<>", | ||
"build-subnet":"subnet-<>", | ||
"build-secgrp":"sg-<>", | ||
"build-time":"{{isotime \"2006-01-02T03-04-05Z\"}}", | ||
"aws_ami_region":"us-east-1" | ||
}, | ||
"builders": [ | ||
{ | ||
"name":"{{user `name-base`}}-{{user `build-time`}}" , | ||
"ami_description":"{{user `name-base`}}", | ||
"type":"amazon-ebs", | ||
"encrypt_boot":"false", | ||
"region":"{{user `build-region`}}", | ||
"ami_regions":"{{user `aws_ami_region`}}", | ||
"instance_type":"c5.24xlarge", | ||
"ami_name":"{{user `name-base`}}-{{user `build-time`}}", | ||
"vpc_id":"{{user `build-vpc`}}", | ||
"subnet_id":"{{user `build-subnet`}}", | ||
"security_group_ids":"{{user `build-secgrp`}}", | ||
"source_ami_filter": { | ||
"filters": { | ||
"virtualization-type":"hvm", | ||
"architecture":"x86_64", | ||
"name": "Windows_Server-2019-English-Full-Base-20*", | ||
"block-device-mapping.volume-type":"gp2", | ||
"root-device-type":"ebs" | ||
}, | ||
"owners": [ | ||
"amazon" | ||
], | ||
"most_recent":true | ||
}, | ||
"user_data_file":"scripts/windows/userdata.ps1", | ||
"associate_public_ip_address":true, | ||
"communicator":"winrm", | ||
"winrm_username":"Administrator", | ||
"winrm_timeout":"40m", | ||
"windows_password_timeout":"30m", | ||
"winrm_insecure":true, | ||
"tags": { | ||
"Name": "{{user `name-base`}}-{{user `build-time`}}", | ||
"OS_Version":"{{user `os-version`}}", | ||
"User":"Packer", | ||
"Encrypted_AMI":"False", | ||
"Created":"{{user `build-time`}}" | ||
}, | ||
"launch_block_device_mappings": [ | ||
{ | ||
"device_name":"/dev/sda1", | ||
"volume_size":100, | ||
"delete_on_termination":true, | ||
"volume_type":"gp3" | ||
} | ||
] | ||
} | ||
], | ||
"provisioners": [ | ||
{ | ||
"type": "file", | ||
"source": "scripts/windows/winrm_max_memory.ps1", | ||
"destination": "C:\\Users\\Administrator\\jenkins\\winrm_max_memory.ps1" | ||
}, | ||
{ | ||
"type":"powershell", | ||
"inline": [ | ||
"C:\\Users\\Administrator\\jenkins\\winrm_max_memory.ps1 190" | ||
] | ||
}, | ||
{ | ||
"type":"powershell", | ||
"scripts": [ | ||
"scripts/windows/smb-setup-2019-plus.ps1", | ||
"scripts/windows/longpath-setup.ps1", | ||
"scripts/windows/scoop-setup.ps1", | ||
"scripts/windows/scoop-install-commons.ps1", | ||
"scripts/windows/pip-install.ps1" | ||
], | ||
"max_retries": 3 | ||
}, | ||
{ | ||
"type": "windows-restart" | ||
}, | ||
{ | ||
"type":"powershell", | ||
"inline": [ | ||
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\InitializeInstance.ps1 -Schedule", | ||
"C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SysprepInstance.ps1 -NoShutdown" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# Copyright OpenSearch Contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
echo "Enable Long Path" | ||
set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled -Type DWORD -Value 1 -Force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright OpenSearch Contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# The OpenSearch Contributors require contributions made to | ||
# this file be licensed under the Apache-2.0 license or a | ||
# compatible open source license. | ||
|
||
$memorygb = [int]$args[0] | ||
$memorygb | ||
|
||
if ($memorygb) { | ||
$memorymb = $memorygb * 1024 | ||
} | ||
else { | ||
$memorymb = 30 * 1024 | ||
} | ||
cmd /c winrm set "winrm/config/winrs" "@{MaxMemoryPerShellMB=\`"$memorymb\`"}" | ||
cmd /c winrm get winrm/config | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain this? What it is trying to do?
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is trying to get user input in GB and convert to MB and apply to WinRM max memory allocation during Jenkins agent node communications.
When Jenkins communicate with Windows node through WinRM it can only allocate the max number of memory in MBs that WinRM allows it to allocate.
This make sure the value is assigned dynamically based on the AMI requirements. Thanks.