diff --git a/images/linux/scripts/installers/preparemetadata.sh b/images/linux/scripts/installers/preparemetadata.sh index 3feee8571..8342cfe11 100644 --- a/images/linux/scripts/installers/preparemetadata.sh +++ b/images/linux/scripts/installers/preparemetadata.sh @@ -9,8 +9,11 @@ source $HELPER_SCRIPTS/document.sh WriteItem "" -Announcements=$(cat $HELPER_SCRIPTS/announcements.md) -WriteItem $Announcements +if [ $ANNOUNCEMENTS ]; then + WriteItem $ANNOUNCEMENTS + WriteItem "***" +fi + AddTitle "$(lsb_release -ds)" WriteItem "The following software is installed on machines with the $IMAGE_VERSION update." diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index c1bc26603..bef3faa46 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -24,7 +24,8 @@ "image_version": "dev", "image_os": "ubuntu16", "github_feed_token": null, - "run_validation_diskspace": "false" + "run_validation_diskspace": "false", + "announcements": "{{env `ANNOUNCEMENTS`}}" }, "sensitive-variables": ["client_secret", "github_feed_token"], "builders": [ @@ -86,11 +87,6 @@ "source": "{{template_dir}}/scripts/helpers", "destination": "{{user `helper_script_folder`}}" }, - { - "type": "file", - "source": "{{template_dir}}/announcements.md", - "destination": "{{user `helper_script_folder`}}/announcements.md" - }, { "type": "file", "source": "{{template_dir}}/scripts/installers", @@ -104,7 +100,8 @@ "environment_vars": [ "IMAGE_VERSION={{user `image_version`}}", "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 }}'" }, diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 7b7435162..3e46fe1f7 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -24,7 +24,8 @@ "image_version": "dev", "image_os": "ubuntu18", "github_feed_token": null, - "run_validation_diskspace": "false" + "run_validation_diskspace": "false", + "announcements": "{{env `ANNOUNCEMENTS`}}" }, "sensitive-variables": ["client_secret", "github_feed_token"], "builders": [ @@ -89,11 +90,6 @@ "source": "{{template_dir}}/scripts/helpers", "destination": "{{user `helper_script_folder`}}" }, - { - "type": "file", - "source": "{{template_dir}}/announcements.md", - "destination": "{{user `helper_script_folder`}}/announcements.md" - }, { "type": "file", "source": "{{template_dir}}/scripts/installers", @@ -107,7 +103,8 @@ "environment_vars": [ "IMAGE_VERSION={{user `image_version`}}", "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 }}'" }, diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index b83236a14..e8cd0ec45 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -26,7 +26,8 @@ "github_feed_token": null, "run_validation_diskspace": "false", "go_default": "1.14", - "go_versions": "1.14" + "go_versions": "1.14", + "announcements": "{{env `ANNOUNCEMENTS`}}" }, "sensitive-variables": ["client_secret", "github_feed_token"], "builders": [ @@ -91,11 +92,6 @@ "source": "{{template_dir}}/scripts/helpers", "destination": "{{user `helper_script_folder`}}" }, - { - "type": "file", - "source": "{{template_dir}}/announcements.md", - "destination": "{{user `helper_script_folder`}}/announcements.md" - }, { "type": "file", "source": "{{template_dir}}/scripts/installers", @@ -109,7 +105,8 @@ "environment_vars": [ "IMAGE_VERSION={{user `image_version`}}", "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 }}'" }, diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index ee4c5c7c9..a29928b86 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -31,7 +31,8 @@ "capture_name_prefix": "packer", "image_version": "dev", "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"], "builders": [ @@ -84,11 +85,6 @@ "source": "{{ template_dir }}/scripts/SoftwareReport", "destination": "{{user `image_folder`}}" }, - { - "type": "file", - "source": "{{ template_dir }}/announcements.md", - "destination": "{{user `image_folder`}}/SoftwareReport/announcements.md" - }, { "type": "file", "source": "{{ template_dir }}/scripts/Tests", @@ -667,7 +663,8 @@ "pwsh -File '{{user `image_folder`}}\\SoftwareReport\\SoftwareReport.Generator.ps1'" ], "environment_vars":[ - "TOOLSET_JSON_PATH={{user `toolset_json_path`}}" + "TOOLSET_JSON_PATH={{user `toolset_json_path`}}", + "ANNOUNCEMENTS={{user `announcements`}}" ] }, { diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 137b52562..44059d360 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -31,7 +31,8 @@ "capture_name_prefix": "packer", "image_version": "dev", "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"], "builders": [ @@ -84,11 +85,6 @@ "source": "{{ template_dir }}/scripts/SoftwareReport", "destination": "{{user `image_folder`}}" }, - { - "type": "file", - "source": "{{ template_dir }}/announcements.md", - "destination": "{{user `image_folder`}}/SoftwareReport/announcements.md" - }, { "type": "file", "source": "{{ template_dir }}/scripts/Tests", @@ -666,7 +662,8 @@ "pwsh -File '{{user `image_folder`}}\\SoftwareReport\\SoftwareReport.Generator.ps1'" ], "environment_vars":[ - "TOOLSET_JSON_PATH={{user `toolset_json_path`}}" + "TOOLSET_JSON_PATH={{user `toolset_json_path`}}", + "ANNOUNCEMENTS={{user `announcements`}}" ] }, { diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 7fefbf79b..2e69132e5 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -10,9 +10,12 @@ Import-Module (Join-Path $PSScriptRoot "SoftwareReport.VisualStudio.psm1") -Disa $markdown = "" -$Announcements = Get-Content -Path $(Join-Path $PSScriptRoot "announcements.md") -Raw -$markdown += $Announcements -$markdown += New-MDNewLine +if ($env:ANNOUNCEMENTS) { + $markdown += $env:ANNOUNCEMENTS + $markdown += New-MDNewLine + $markdown += "***" + $markdown += New-MDNewLine +} $OSName = Get-OSName $markdown += New-MDHeader "$OSName" -Level 1