Skip to content

Conversation

@KirkMunro
Copy link
Contributor

PR Summary

Cleanup of workflow code that has been deprecated. In particular:

  • deprecation of workflow keyword
  • deprecation of parallel keyword (used for parallel activities in workflow)
  • deprecation of sequence keyword (used for sequential activities in workflow)
  • deprecation of inlinescript activity (used for activities outside of workflow)
  • removal of some related methods
  • removal of deprecated resource strings
  • updates to non-deprecated resource strings
  • removal of the use of "workflow" in many comments

The keywords in question have been preserved, but will now generate parser errors because they are deprecated.

PR Context

See issue #9570.

PR Checklist


return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-macos
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /Users/vsts/agent/2.155.1/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /Users/vsts/agent/2.155.1/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty


return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-windows
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\PowerShellGet\PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\PowerShellGet\PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty


return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-linux
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /home/vsts/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /home/vsts/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty

@KirkMunro
Copy link
Contributor Author

KirkMunro commented Aug 8, 2019

@SteveL-MSFT The two Pester errors that occur on each platform happen because Fabrikam-ServerScript in www.poshtestgallery.com defines a workflow. Since workflow does not parse with this PR in place, and since PowerShellGet wasn't designed with deprecated features that generate parse errors in mind, there's a chicken-and-egg problem with these tests.

Since I can use Find-Script in the same PowerShellGet module in a build with this PR to find the script and pull script metadata, which includes workflows that are in the script, we could update PowerShellGet to check for the presence of workflow as part of Install-Script (the information is obviously retrievable, and if workflow is found), and prevent the installation from continuing since it is not supported on 7.0+. We could then update the failing tests to verify that scenario fails properly, and to test that installing a different script that does not have workflow works. This will allow the Pester tests to pass.

Longer term, we could also update PowerShellGet to recognize parser errors about deprecated keywords. The parser error that is being generated by the parser in this PR is very specific, and clearly identifies when a keyword is deprecated. The keyword token also has a flag indicating that it is deprecated. In the case where a deprecated keyword is found, PowerShellGet could simply ignore that error since it shouldn't care.

You can see both the descriptive error id and the keyword Deprecated flag in the output below:

PS C:\> $tokens = $null
>> $errors = $null
>> [System.Management.Automation.Language.Parser]::ParseInput(
>>     'workflow foo {''bar''}; Get-Date',
>>      [ref]$tokens,
>>      [ref]$errors)

Attributes         : {}
UsingStatements    : {}
ParamBlock         :
BeginBlock         :
ProcessBlock       :
EndBlock           : workflow foo {'bar'}; Get-Date
DynamicParamBlock  :
ScriptRequirements :
Extent             : workflow foo {'bar'}; Get-Date
Parent             :


PS C:\> $errors | fl *

Extent          : workflow
ErrorId         : DeprecatedKeywordNotAllowed
Message         : The 'workflow' keyword has been deprecated and is no longer supported.
IncompleteInput : False


PS C:\> $tokens

Text       : workflow
TokenFlags : Keyword, Deprecated
Kind       : Workflow
HasError   : False
Extent     : workflow

Text       : foo
TokenFlags : CommandName
Kind       : Identifier
HasError   : False
Extent     : foo

Text       : {
TokenFlags : ParseModeInvariant
Kind       : LCurly
HasError   : False
Extent     : {

Value      : bar
Text       : 'bar'
TokenFlags : ParseModeInvariant
Kind       : StringLiteral
HasError   : False
Extent     : 'bar'

Text       : }
TokenFlags : ParseModeInvariant
Kind       : RCurly
HasError   : False
Extent     : }

Text       : ;
TokenFlags : ParseModeInvariant
Kind       : Semi
HasError   : False
Extent     : ;

Value      : Get-Date
Text       : Get-Date
TokenFlags : CommandName
Kind       : Generic
HasError   : False
Extent     : Get-Date

Text       :
TokenFlags : ParseModeInvariant
Kind       : EndOfInput
HasError   : False
Extent     :


PS C:\>

Please let me know how you would like to proceed.

@PaulHigin
Copy link
Contributor

/cc @SteveL-MSFT
I am not sure if it is worth the effort. Perhaps we should continue with other workflow cleanup.

@KirkMunro
Copy link
Contributor Author

KirkMunro commented Aug 9, 2019

If we do want these keywords deprecated, the simple solution for PowerShellGet is to check if a script/module has workflow in it before installing it, and prevent that installation from happening if that is the case in PowerShell 7+. That's logical, necessary, and the right thing to do. Users can still save the script, which does not do any parsing checks, and that is the most they would want to do in a version of PowerShell that doesn't support workflow anyway. They shouldn't be able to install a script that is incompatible even with -Force (why would I be able to install something I can't use -- installers prevent such things, and rightly so). Since that change should probably happen regardless, and since that change fixes these issues, we could move forward with little effort with that change plus splitting the tests in question into two, so that they test for success and failure when it comes to workflow.

@iSazonov
Copy link
Collaborator

iSazonov commented Aug 9, 2019

Today the cleanup is not critical and we could do not break PowerShellGet in the PR. Although we need an understanding of how to proceed in future

@SteveL-MSFT
Copy link
Member

For now, perhaps we should have an issue opened in PowerShellGet repo to produce an error if a script is incompatible. For this PR, we can wait on this since it's desirable, but not critical.

@KirkMunro
Copy link
Contributor Author

Issue PowerShell/PowerShellGet#528 has been logged so that the issue can be fixed in PowerShellGet.


return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-macos
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /Users/vsts/agent/2.155.1/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /Users/vsts/agent/2.155.1/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty


return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-linux
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /home/vsts/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /home/vsts/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty


return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-windows
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\PowerShellGet\PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\PowerShellGet\PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty

@iSazonov
Copy link
Collaborator

I set WIP until we PowerShellGet issue will be resolved.

@iSazonov iSazonov changed the title Deprecate workflow-related keywords (workflow, sequence, parallel, and inlinescript) WIP: Deprecate workflow-related keywords (workflow, sequence, parallel, and inlinescript) Aug 24, 2019

return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-linux
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /home/vsts/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /home/vsts/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty


return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-windows
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\PowerShellGet\PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\PowerShellGet\PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty


return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-macos
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /Users/runner/runners/2.158.0/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /Users/runner/runners/2.158.0/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty

Copy link
Contributor

@PaulHigin PaulHigin left a comment

Choose a reason for hiding this comment

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

These changes look good to me, as long as all tests continue to pass. Since these include a lot of parser/token changes I would like @daxian-dbw to also review them.

@TravisEz13 TravisEz13 added this to the 7.1.0-preview.1 milestone Nov 23, 2019
@adityapatwardhan adityapatwardhan added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Feb 20, 2020
@ghost ghost added the Stale label Mar 24, 2020

return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-linux
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /home/vsts/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /home/vsts/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty


return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-macos
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /Users/runner/runners/2.165.2/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, /Users/runner/runners/2.165.2/work/1/s/test/powershell/Modules/PowerShellGet/PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty


return completionResults;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@KirkMunro, your last commit had 2 failures in PowerShell-CI-windows
PowerShellGet - Script tests (Admin).Should install a script correctly to the required location with AllUsers scope

Expected a value, but got $null or empty.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\PowerShellGet\PowerShellGet.Tests.ps1: line 234
234:         $installedScriptInfo | Should -Not -BeNullOrEmpty

PowerShellGet - Script tests.Should install a script correctly to the required location with default CurrentUser scope

Expected a value, but got $null or empty.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\PowerShellGet\PowerShellGet.Tests.ps1: line 207
207:         $installedScriptInfo | Should -Not -BeNullOrEmpty

@adityapatwardhan adityapatwardhan added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Apr 24, 2020
@adityapatwardhan
Copy link
Member

@KirkMunro Please fix CI issues and remove WIP from title when ready.

@TravisEz13 TravisEz13 removed this from the 7.1.0-preview.4 milestone May 22, 2020
@ghost ghost added the Stale label Jun 6, 2020
@ghost
Copy link

ghost commented Jun 6, 2020

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment.

@KirkMunro
Copy link
Contributor Author

@adityapatwardhan Here are the problems with this PR:

  1. This PR was dependent on another issue (issue PowerShell/PowerShellGet#528). That issue disappeared. I didn't delete it, so how do we find out what happened to that???
  2. Assuming that issue gets recovered (or relogged), this PR can't be finished until that issue is addressed (which obviously won't happen if the issue that was logged was deleted).

That is why this was marked WIP: because it is dependent on an issue that I just discovered is missing. I'd like to know what happened to that issue, because issues should not be deleted.

@ghost ghost removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept Stale labels Jun 13, 2020
@ghost ghost added the Review - Needed The PR is being reviewed label Jun 20, 2020
@ghost
Copy link

ghost commented Jun 20, 2020

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Mainainer, Please provide feedback and/or mark it as Waiting on Author

@adityapatwardhan
Copy link
Member

@alerickson - Can you have a look why the issue in PowerShellGet disappeared?

@ghost ghost removed the Review - Needed The PR is being reviewed label Jun 29, 2020
@alerickson
Copy link
Member

@adityapatwardhan @KirkMunro the name of the PSGet repository for versions below 3 is now called PowerShellGetv2, the issue is still there though: PowerShell/PowerShellGetv2/issues/528. We won't address non-security related issues in that repo, but I'll transfer the issue over to the new repo so we can check before installing scripts in v3.

@ghost ghost added the Review - Needed The PR is being reviewed label Jul 7, 2020
@ghost
Copy link

ghost commented Jul 7, 2020

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@adityapatwardhan
Copy link
Member

@KirkMunro I guess we will have to wait till the version of PSGet that fixes the issue is included in PowerShell release.
@alerickson Is the fix for the issue going to be part of PSGet v3? or does it not repro in v3 at all?

@ghost ghost removed the Review - Needed The PR is being reviewed label Jul 21, 2020
@ghost ghost added the Review - Needed The PR is being reviewed label Jul 28, 2020
@ghost
Copy link

ghost commented Jul 28, 2020

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@KirkMunro
Copy link
Contributor Author

Closing. See #10238 (comment).

@KirkMunro KirkMunro closed this Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants