Add additional agent info (#499)

* add agent additional info

* add agent additional info

* add agent additional info
This commit is contained in:
Aleksandr Chebotov
2020-03-08 17:41:55 +03:00
committed by GitHub
parent 531fe345a2
commit 42417eb98f
6 changed files with 109 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
#!/bin/bash
imagedata_file=$IMAGEDATA_FILE
image_version=$IMAGE_VERSION
os_name=$(lsb_release -ds | sed "s/ /\\\n/g")
image_label="ubuntu-$(lsb_release -rs)"
github_url="https://github.com/actions/virtual-environments/blob"
if [[ "$image_label" =~ "ubuntu-18" ]]; then
software_url="${github_url}/ubuntu18/${image_version}/images/linux/Ubuntu1804-README.md"
fi
if [[ "$image_label" =~ "ubuntu-16" ]]; then
software_url="${github_url}/ubuntu16/${image_version}/images/linux/Ubuntu1604-README.md"
fi
cat <<EOF > $imagedata_file
[
{
"group": "Operating System",
"detail": "${os_name}"
},
{
"group": "Virtual Environment",
"detail": "Environment: ${image_label}\nVersion: ${image_version}\nIncluded Software: ${software_url}"
}
]
EOF

View File

@@ -15,6 +15,7 @@
"private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}",
"image_folder": "/imagegeneration",
"commit_file": "/imagegeneration/commit.txt",
"imagedata_file": "/imagegeneration/imagedata.json",
"metadata_file": "/imagegeneration/metadatafile",
"installer_script_folder": "/imagegeneration/installers",
"helper_script_folder": "/imagegeneration/helpers",
@@ -107,6 +108,17 @@
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts":[
"{{template_dir}}/scripts/installers/preimagedata.sh"
],
"environment_vars": [
"IMAGE_VERSION={{user `image_version`}}",
"IMAGEDATA_FILE={{user `imagedata_file`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"inline": [

View File

@@ -15,6 +15,7 @@
"private_virtual_network_with_public_ip": "{{env `PRIVATE_VIRTUAL_NETWORK_WITH_PUBLIC_IP`}}",
"image_folder": "/imagegeneration",
"commit_file": "/imagegeneration/commit.txt",
"imagedata_file": "/imagegeneration/imagedata.json",
"metadata_file": "/imagegeneration/metadatafile",
"installer_script_folder": "/imagegeneration/installers",
"helper_script_folder": "/imagegeneration/helpers",
@@ -110,6 +111,17 @@
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"scripts":[
"{{template_dir}}/scripts/installers/preimagedata.sh"
],
"environment_vars": [
"IMAGE_VERSION={{user `image_version`}}",
"IMAGEDATA_FILE={{user `imagedata_file`}}"
],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
},
{
"type": "shell",
"inline": [

View File

@@ -19,6 +19,7 @@
"root_folder": "C:",
"image_folder": "C:\\image",
"commit_file": "C:\\image\\commit.txt",
"imagedata_file": "C:\\imagedata.json",
"metadata_file": "C:\\image\\metadata.txt",
"helper_script_folder": "C:\\Program Files\\WindowsPowerShell\\Modules\\",
"commit_url": "LATEST",
@@ -120,6 +121,16 @@
"setx ImageOS {{user `image_os` }} /m"
]
},
{
"type": "powershell",
"environment_vars": [
"IMAGE_VERSION={{user `image_version`}}",
"IMAGEDATA_FILE={{user `imagedata_file`}}"
],
"scripts":[
"{{ template_dir }}/scripts/Installers/Update-ImageData.ps1"
]
},
{
"type": "powershell",
"scripts":[

View File

@@ -19,6 +19,7 @@
"root_folder": "C:",
"image_folder": "C:\\image",
"commit_file": "C:\\image\\commit.txt",
"imagedata_file": "C:\\imagedata.json",
"metadata_file": "C:\\image\\metadata.txt",
"helper_script_folder": "C:\\Program Files\\WindowsPowerShell\\Modules\\",
"commit_id": "LATEST",
@@ -120,6 +121,16 @@
"setx ImageOS {{user `image_os` }} /m"
]
},
{
"type": "powershell",
"environment_vars": [
"IMAGE_VERSION={{user `image_version`}}",
"IMAGEDATA_FILE={{user `imagedata_file`}}"
],
"scripts":[
"{{ template_dir }}/scripts/Installers/Update-ImageData.ps1"
]
},
{
"type": "powershell",
"scripts":[

View File

@@ -0,0 +1,35 @@
$os = Get-CimInstance -ClassName Win32_OperatingSystem
$caption = $os.Caption
$osName = $caption.Substring(0, $caption.LastIndexOf(" "))
$osEdition = $caption.Substring($caption.LastIndexOf(" ")+1)
$osVersion = $os.Version
$imageVersion = $env:IMAGE_VERSION
$imageDataFile = $env:IMAGEDATA_FILE
$githubUrl="https://github.com/actions/virtual-environments/blob"
if ($caption -match "2019")
{
$imageLabel = "windows-2019"
$softwareUrl = "${githubUrl}/win19/${imageVersion}/images/win/Windows2019-Readme.md"
}
if ($caption -match "2016")
{
$imageLabel = "windows-2016"
$softwareUrl = "${githubUrl}/win16/${imageVersion}/images/win/Windows2016-Readme.md"
}
$json = @"
[
{
"group": "Operating System",
"detail": "${osName}\n${osVersion}\n${osEdition}"
},
{
"group": "Virtual Environment",
"detail": "Environment: ${imageLabel}\nVersion: ${imageVersion}\nIncluded Software: ${softwareUrl}"
}
]
"@
$json | Out-File -FilePath $imageDataFile