Add generation of announcements tables (#1355)

* Parse announcements from issues

* Minor fix

* Minor fix

* Reworked

* Minor fix

* Fix env variable name
This commit is contained in:
Vladimir Safonkin
2020-08-06 15:12:04 +03:00
committed by GitHub
parent 0f6fba462a
commit 75ac0436ed
7 changed files with 31 additions and 40 deletions

View File

@@ -9,8 +9,11 @@ source $HELPER_SCRIPTS/document.sh
WriteItem "<!--- DO NOT EDIT - This markdown file is autogenerated. -->" WriteItem "<!--- DO NOT EDIT - This markdown file is autogenerated. -->"
Announcements=$(cat $HELPER_SCRIPTS/announcements.md) if [ $ANNOUNCEMENTS ]; then
WriteItem $Announcements WriteItem $ANNOUNCEMENTS
WriteItem "***"
fi
AddTitle "$(lsb_release -ds)" AddTitle "$(lsb_release -ds)"
WriteItem "The following software is installed on machines with the $IMAGE_VERSION update." WriteItem "The following software is installed on machines with the $IMAGE_VERSION update."

View File

@@ -24,7 +24,8 @@
"image_version": "dev", "image_version": "dev",
"image_os": "ubuntu16", "image_os": "ubuntu16",
"github_feed_token": null, "github_feed_token": null,
"run_validation_diskspace": "false" "run_validation_diskspace": "false",
"announcements": "{{env `ANNOUNCEMENTS`}}"
}, },
"sensitive-variables": ["client_secret", "github_feed_token"], "sensitive-variables": ["client_secret", "github_feed_token"],
"builders": [ "builders": [
@@ -86,11 +87,6 @@
"source": "{{template_dir}}/scripts/helpers", "source": "{{template_dir}}/scripts/helpers",
"destination": "{{user `helper_script_folder`}}" "destination": "{{user `helper_script_folder`}}"
}, },
{
"type": "file",
"source": "{{template_dir}}/announcements.md",
"destination": "{{user `helper_script_folder`}}/announcements.md"
},
{ {
"type": "file", "type": "file",
"source": "{{template_dir}}/scripts/installers", "source": "{{template_dir}}/scripts/installers",
@@ -104,7 +100,8 @@
"environment_vars": [ "environment_vars": [
"IMAGE_VERSION={{user `image_version`}}", "IMAGE_VERSION={{user `image_version`}}",
"METADATA_FILE={{user `metadata_file`}}", "METADATA_FILE={{user `metadata_file`}}",
"HELPER_SCRIPTS={{user `helper_script_folder`}}" "HELPER_SCRIPTS={{user `helper_script_folder`}}",
"ANNOUNCEMENTS={{user `announcements`}}"
], ],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
}, },

View File

@@ -24,7 +24,8 @@
"image_version": "dev", "image_version": "dev",
"image_os": "ubuntu18", "image_os": "ubuntu18",
"github_feed_token": null, "github_feed_token": null,
"run_validation_diskspace": "false" "run_validation_diskspace": "false",
"announcements": "{{env `ANNOUNCEMENTS`}}"
}, },
"sensitive-variables": ["client_secret", "github_feed_token"], "sensitive-variables": ["client_secret", "github_feed_token"],
"builders": [ "builders": [
@@ -89,11 +90,6 @@
"source": "{{template_dir}}/scripts/helpers", "source": "{{template_dir}}/scripts/helpers",
"destination": "{{user `helper_script_folder`}}" "destination": "{{user `helper_script_folder`}}"
}, },
{
"type": "file",
"source": "{{template_dir}}/announcements.md",
"destination": "{{user `helper_script_folder`}}/announcements.md"
},
{ {
"type": "file", "type": "file",
"source": "{{template_dir}}/scripts/installers", "source": "{{template_dir}}/scripts/installers",
@@ -107,7 +103,8 @@
"environment_vars": [ "environment_vars": [
"IMAGE_VERSION={{user `image_version`}}", "IMAGE_VERSION={{user `image_version`}}",
"METADATA_FILE={{user `metadata_file`}}", "METADATA_FILE={{user `metadata_file`}}",
"HELPER_SCRIPTS={{user `helper_script_folder`}}" "HELPER_SCRIPTS={{user `helper_script_folder`}}",
"ANNOUNCEMENTS={{user `announcements`}}"
], ],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
}, },

View File

@@ -26,7 +26,8 @@
"github_feed_token": null, "github_feed_token": null,
"run_validation_diskspace": "false", "run_validation_diskspace": "false",
"go_default": "1.14", "go_default": "1.14",
"go_versions": "1.14" "go_versions": "1.14",
"announcements": "{{env `ANNOUNCEMENTS`}}"
}, },
"sensitive-variables": ["client_secret", "github_feed_token"], "sensitive-variables": ["client_secret", "github_feed_token"],
"builders": [ "builders": [
@@ -91,11 +92,6 @@
"source": "{{template_dir}}/scripts/helpers", "source": "{{template_dir}}/scripts/helpers",
"destination": "{{user `helper_script_folder`}}" "destination": "{{user `helper_script_folder`}}"
}, },
{
"type": "file",
"source": "{{template_dir}}/announcements.md",
"destination": "{{user `helper_script_folder`}}/announcements.md"
},
{ {
"type": "file", "type": "file",
"source": "{{template_dir}}/scripts/installers", "source": "{{template_dir}}/scripts/installers",
@@ -109,7 +105,8 @@
"environment_vars": [ "environment_vars": [
"IMAGE_VERSION={{user `image_version`}}", "IMAGE_VERSION={{user `image_version`}}",
"METADATA_FILE={{user `metadata_file`}}", "METADATA_FILE={{user `metadata_file`}}",
"HELPER_SCRIPTS={{user `helper_script_folder`}}" "HELPER_SCRIPTS={{user `helper_script_folder`}}",
"ANNOUNCEMENTS={{user `announcements`}}"
], ],
"execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'" "execute_command": "sudo sh -c '{{ .Vars }} {{ .Path }}'"
}, },

View File

@@ -31,7 +31,8 @@
"capture_name_prefix": "packer", "capture_name_prefix": "packer",
"image_version": "dev", "image_version": "dev",
"image_os": "win16", "image_os": "win16",
"github_feed_token": "{{env `GITHUB_FEED_TOKEN`}}" "github_feed_token": "{{env `GITHUB_FEED_TOKEN`}}",
"announcements": "{{env `ANNOUNCEMENTS`}}"
}, },
"sensitive-variables": ["install_password", "ssh_password", "client_secret", "github_feed_token"], "sensitive-variables": ["install_password", "ssh_password", "client_secret", "github_feed_token"],
"builders": [ "builders": [
@@ -84,11 +85,6 @@
"source": "{{ template_dir }}/scripts/SoftwareReport", "source": "{{ template_dir }}/scripts/SoftwareReport",
"destination": "{{user `image_folder`}}" "destination": "{{user `image_folder`}}"
}, },
{
"type": "file",
"source": "{{ template_dir }}/announcements.md",
"destination": "{{user `image_folder`}}/SoftwareReport/announcements.md"
},
{ {
"type": "file", "type": "file",
"source": "{{ template_dir }}/scripts/Tests", "source": "{{ template_dir }}/scripts/Tests",
@@ -667,7 +663,8 @@
"pwsh -File '{{user `image_folder`}}\\SoftwareReport\\SoftwareReport.Generator.ps1'" "pwsh -File '{{user `image_folder`}}\\SoftwareReport\\SoftwareReport.Generator.ps1'"
], ],
"environment_vars":[ "environment_vars":[
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}" "TOOLSET_JSON_PATH={{user `toolset_json_path`}}",
"ANNOUNCEMENTS={{user `announcements`}}"
] ]
}, },
{ {

View File

@@ -31,7 +31,8 @@
"capture_name_prefix": "packer", "capture_name_prefix": "packer",
"image_version": "dev", "image_version": "dev",
"image_os": "win19", "image_os": "win19",
"github_feed_token": "{{env `GITHUB_FEED_TOKEN`}}" "github_feed_token": "{{env `GITHUB_FEED_TOKEN`}}",
"announcements": "{{env `ANNOUNCEMENTS`}}"
}, },
"sensitive-variables": ["install_password", "ssh_password", "client_secret", "github_feed_token"], "sensitive-variables": ["install_password", "ssh_password", "client_secret", "github_feed_token"],
"builders": [ "builders": [
@@ -84,11 +85,6 @@
"source": "{{ template_dir }}/scripts/SoftwareReport", "source": "{{ template_dir }}/scripts/SoftwareReport",
"destination": "{{user `image_folder`}}" "destination": "{{user `image_folder`}}"
}, },
{
"type": "file",
"source": "{{ template_dir }}/announcements.md",
"destination": "{{user `image_folder`}}/SoftwareReport/announcements.md"
},
{ {
"type": "file", "type": "file",
"source": "{{ template_dir }}/scripts/Tests", "source": "{{ template_dir }}/scripts/Tests",
@@ -666,7 +662,8 @@
"pwsh -File '{{user `image_folder`}}\\SoftwareReport\\SoftwareReport.Generator.ps1'" "pwsh -File '{{user `image_folder`}}\\SoftwareReport\\SoftwareReport.Generator.ps1'"
], ],
"environment_vars":[ "environment_vars":[
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}" "TOOLSET_JSON_PATH={{user `toolset_json_path`}}",
"ANNOUNCEMENTS={{user `announcements`}}"
] ]
}, },
{ {

View File

@@ -10,9 +10,12 @@ Import-Module (Join-Path $PSScriptRoot "SoftwareReport.VisualStudio.psm1") -Disa
$markdown = "" $markdown = ""
$Announcements = Get-Content -Path $(Join-Path $PSScriptRoot "announcements.md") -Raw if ($env:ANNOUNCEMENTS) {
$markdown += $Announcements $markdown += $env:ANNOUNCEMENTS
$markdown += New-MDNewLine $markdown += New-MDNewLine
$markdown += "***"
$markdown += New-MDNewLine
}
$OSName = Get-OSName $OSName = Get-OSName
$markdown += New-MDHeader "$OSName" -Level 1 $markdown += New-MDHeader "$OSName" -Level 1