Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
jobs:
analyze:
name: Analyze
runs-on: ubuntu-16.04
runs-on: ubuntu-latest

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is using latest here on purpose or an overlook?


strategy:
fail-fast: false
Expand Down
6 changes: 3 additions & 3 deletions .vsts-ci/linux-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ stages:
jobs:
- template: templates/ci-build.yml
parameters:
pool: ubuntu-16.04
pool: ubuntu-20.04
jobName: linux_build
displayName: linux Build

Expand All @@ -56,7 +56,7 @@ stages:
jobs:
- job: linux_test
pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-20.04
displayName: Linux Test

steps:
Expand Down Expand Up @@ -149,7 +149,7 @@ stages:
- job: CodeCovTestPackage
displayName: CodeCoverage and Test Packages
pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-20.04
steps:
- pwsh: |
Import-Module .\tools\ci.psm1
Expand Down
16 changes: 8 additions & 8 deletions .vsts-ci/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ stages:
jobs:
- template: templates/ci-build.yml
parameters:
pool: ubuntu-16.04
pool: ubuntu-20.04
jobName: linux_build
displayName: linux Build

Expand All @@ -62,42 +62,42 @@ stages:
- template: templates/nix-test.yml
parameters:
name: Linux
pool: ubuntu-16.04
pool: ubuntu-20.04
purpose: UnelevatedPesterTests
tagSet: CI

- template: templates/nix-test.yml
parameters:
name: Linux
pool: ubuntu-16.04
pool: ubuntu-20.04
purpose: ElevatedPesterTests
tagSet: CI

- template: templates/nix-test.yml
parameters:
name: Linux
pool: ubuntu-16.04
pool: ubuntu-20.04
purpose: UnelevatedPesterTests
tagSet: Others

- template: templates/nix-test.yml
parameters:
name: Linux
pool: ubuntu-16.04
pool: ubuntu-20.04
purpose: ElevatedPesterTests
tagSet: Others

- template: templates/verify-xunit.yml
parameters:
pool: ubuntu-16.04
pool: ubuntu-20.04

- stage: PackageLinux
displayName: Package Linux
dependsOn: ["BuildLinux"]
jobs:
- template: linux/templates/packaging.yml
parameters:
pool: ubuntu-16.04
pool: ubuntu-20.04

- stage: CodeCovTestPackage
displayName: CodeCoverage and Test Packages
Expand All @@ -106,7 +106,7 @@ stages:
- job: CodeCovTestPackage
displayName: CodeCoverage and Test Packages
pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-20.04
steps:
- pwsh: |
Import-Module .\tools\ci.psm1
Expand Down
2 changes: 1 addition & 1 deletion .vsts-ci/linux/templates/packaging.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
pool: 'ubuntu-16.04'
pool: 'ubuntu-20.04'
parentJobs: []
name: 'Linux'

Expand Down
2 changes: 1 addition & 1 deletion .vsts-ci/misc-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
displayName: Markdown and Common Tests

pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-20.04

variables:
- name: repoPath
Expand Down
12 changes: 12 additions & 0 deletions .vsts-ci/templates/nix-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ jobs:
displayName: Capture Environment
condition: succeededOrFailed()

- script: |
isUbuntu20=$(pwsh -c 'Import-Module ./build.psm1 -Force; $environment = Get-EnvironmentInformation; $environment.IsUbuntu -and $environment.IsUbuntu20')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
isUbuntu20=$(pwsh -c 'Import-Module ./build.psm1 -Force; $environment = Get-EnvironmentInformation; $environment.IsUbuntu -and $environment.IsUbuntu20')
isUbuntu20=pwsh -c 'Import-Module ./build.psm1 -Force; $environment = Get-EnvironmentInformation; $environment.IsUbuntu -and $environment.IsUbuntu20'

if [ "$isUbuntu20" == "True" ]; then
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
sudo locale-gen $LANG
sudo update-locale
fi

locale
displayName: Setup Language

- task: DownloadBuildArtifacts@0
displayName: 'Download build artifacts'
inputs:
Expand Down
6 changes: 3 additions & 3 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ function Start-PSPester {

if ($Unelevate)
{
$outputBufferFilePath = [System.IO.Path]::GetTempFileName()
$outputBufferFilePath = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))
}

$command += "Invoke-Pester "
Expand Down Expand Up @@ -1277,7 +1277,7 @@ function Start-PSPester {

$PSFlags = @("-noprofile")
if (-not [string]::IsNullOrEmpty($ExperimentalFeatureName)) {
$configFile = [System.IO.Path]::GetTempFileName()
$configFile = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))
$configFile = [System.IO.Path]::ChangeExtension($configFile, ".json")

## Create the config.json file to enable the given experimental feature.
Expand Down Expand Up @@ -1356,7 +1356,7 @@ function Start-PSPester {
{
if ($PassThru.IsPresent)
{
$passThruFile = [System.IO.Path]::GetTempFileName()
$passThruFile = Join-Path '~' $([System.IO.Path]::GetRandomFileName())
try
{
$command += "| Export-Clixml -Path '$passThruFile' -Force"
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/Windows/PSDiagnostics/PSDiagnostics.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function Enable-PSWSManCombinedTrace
[switch] $DoNotOverwriteExistingTrace
)

$provfile = [io.path]::GetTempFilename()
$provfile = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))

$traceFileName = [string][Guid]::NewGuid()
if ($DoNotOverwriteExistingTrace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Describe "Custom type conversion in parameter binding" -Tags 'Feature' {
}
}
'@
$asmFile = [System.IO.Path]::GetTempFileName() + ".dll"
$asmFile = (Join-Path '~' $([System.IO.Path]::GetRandomFileName() + ".dll"))
Add-Type -TypeDefinition $code -OutputAssembly $asmFile

## Helper function to execute script
Expand Down
4 changes: 2 additions & 2 deletions test/powershell/Language/Scripting/ScriptHelp.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Describe 'get-help HelpFunc1' -Tags "Feature" {
Describe 'get-help file' -Tags "CI" {
BeforeAll {
try {
$tmpfile = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), "ps1")
$tmpfile = Join-Path '~' $([IO.Path]::ChangeExtension([IO.Path]::GetRandomFileName(), "ps1"))
} catch {
return
}
Expand Down Expand Up @@ -233,7 +233,7 @@ Describe 'get-help file' -Tags "CI" {
Describe 'get-help other tests' -Tags "CI" {
BeforeAll {
try {
$tempFile = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), "ps1")
$tempFile = Join-Path '~' $([IO.Path]::ChangeExtension([IO.Path]::GetRandomFileName(), "ps1"))
} catch {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public class SMAAttributeTest$guid : PSCmdlet

## The assembly files cannot be removed once they are loaded, unless the current PowerShell session exits.
## If we use $TestDrive here, then Pester will try to remove them afterward and result in errors.
$TempPath = [System.IO.Path]::GetTempFileName()
$TempPath = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))
if (Test-Path $TempPath) { Remove-Item -Path $TempPath -Force -Recurse }
New-Item -Path $TempPath -ItemType Directory -Force > $null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ set-psbreakpoint -command foo
}

It "Fail to set psbreakpoints when script is a file of wrong type" {
$tempFile = [System.IO.Path]::GetTempFileName()
$tempFile = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))
$ErrorActionPreference = "Stop"
{
Set-PSBreakpoint -Script $tempFile -Line 1
Expand Down
2 changes: 1 addition & 1 deletion test/powershell/engine/Basic/Assembly.LoadFrom.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Describe "Assembly.LoadFrom Validation Test" -Tags "CI" {

## The assembly files cannot be removed once they are loaded, unless the current PowerShell session exits.
## If we use $TestDrive here, then Pester will try to remove them afterward and result in errors.
$TempPath = [System.IO.Path]::GetTempFileName()
$TempPath = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))
if (Test-Path $TempPath) { Remove-Item -Path $TempPath -Force -Recurse }
New-Item -Path $TempPath -ItemType Directory -Force > $null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Describe "Can load a native assembly" -Tags "CI" {
BeforeAll {
## The assembly files cannot be removed once they are loaded, unless the current PowerShell session exits.
## If we use $TestDrive here, then Pester will try to remove them afterward and result in errors.
$TempPath = [System.IO.Path]::GetTempFileName()
$TempPath = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))
if (Test-Path $TempPath) { Remove-Item -Path $TempPath -Force -Recurse }
New-Item -Path $TempPath -ItemType Directory -Force > $null

Expand Down
2 changes: 2 additions & 0 deletions test/powershell/engine/Help/HelpSystem.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ Describe "Validate about_help.txt under culture specific folder works" -Tags @('

$aboutHelpPath = Join-Path (GetCurrentUserHelpRoot) (Get-Culture).Name

Write-Verbose -Verbose "About help Path: $aboutHelpPath"

## If help content does not exist, update it first.
if (-not (Test-Path (Join-Path $aboutHelpPath "about_Variables.help.txt"))) {
UpdateHelpFromLocalContentPath -ModuleName 'Microsoft.PowerShell.Core' -Scope 'CurrentUser'
Expand Down
10 changes: 5 additions & 5 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1335,21 +1335,21 @@ function New-AfterScripts
Write-Verbose -Message "AfterScript Distribution: $Distribution" -Verbose

if ($Environment.IsRedHatFamily) {
$AfterInstallScript = [io.path]::GetTempFileName()
$AfterRemoveScript = [io.path]::GetTempFileName()
$AfterInstallScript = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))
$AfterRemoveScript = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))
$packagingStrings.RedHatAfterInstallScript -f "$Link", $Destination | Out-File -FilePath $AfterInstallScript -Encoding ascii
$packagingStrings.RedHatAfterRemoveScript -f "$Link", $Destination | Out-File -FilePath $AfterRemoveScript -Encoding ascii
}
elseif ($Environment.IsDebianFamily -or $Environment.IsSUSEFamily) {
$AfterInstallScript = [io.path]::GetTempFileName()
$AfterRemoveScript = [io.path]::GetTempFileName()
$AfterInstallScript = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))
$AfterRemoveScript = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))
$packagingStrings.UbuntuAfterInstallScript -f "$Link", $Destination | Out-File -FilePath $AfterInstallScript -Encoding ascii
$packagingStrings.UbuntuAfterRemoveScript -f "$Link", $Destination | Out-File -FilePath $AfterRemoveScript -Encoding ascii
}
elseif ($Environment.IsMacOS) {
# NOTE: The macos pkgutil doesn't support uninstall actions so we did not implement it.
# Handling uninstall can be done in Homebrew so we'll take advantage of that in the brew formula.
$AfterInstallScript = [io.path]::GetTempFileName()
$AfterInstallScript = (Join-Path '~' $([System.IO.Path]::GetRandomFileName()))
$packagingStrings.MacOSAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii
}

Expand Down