cloudpups / cloudpups/authenticated-scripts

Execute Powershell script with powershell instead of pwsh

オープン
#13 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
17
フォーク
6
PR マージ指標
30日以内にマージされた PR はありません

説明

While playing around with my [fork](https://github.com/InwaySystems/authenticated-lcs-scripts), I noticed that the task for Powershell scripts executes them with Powershell 7 (pwsh.exe) on a Windows runner.

The following implicates that this should only happen when the `pwsh` parameter is true.
https://github.com/cloudpups/authenticated-scripts/blob/86b99c2b89c3202b31b6bcf05ad6658e43f86510/tasks/powershell/task.json#L121-L129

I believe this is a bug that was copied over from https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/PowerShellV2/powershell.ts, since both that logic and https://github.com/cloudpups/authenticated-scripts/blob/main/tasks/powershell/execute-cli.ts do not make use of the `pwsh` parameter. The Microsoft task is not affected by that bug, because it uses https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/PowerShellV2/powershell.ps1 when the task is executed on a Windows runner. That script considers the `pwsh` parameter.

I made a [change](https://github.com/InwaySystems/authenticated-lcs-scripts/commit/be56147821beb15386f958bd3c8105f6ec0b7d23) on my fork to address that issue, but it would require some additional work to bring it over to this repo (mainly to add logic to check if the task is running on Windows or not).

If there is interest for that, I can try creating a pull request.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、tasks/powershell/task.json のリンク先のコマンド選択ロジックと tasks/powershell/execute-cli.ts を確認し、続いて Windows の動作を Microsoft の PowerShellV2 powershell.ps1 および powershell.ts と比較します。pwsh パラメーターと Windows の検出が実行にどのような影響を与えるべきかを検証し、Windows と非 Windows の両方のタスクパスが意図したとおりに動作することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
azure, powershell, typescript
領域
devops
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。