updatecli: Cannot execute pwsh as shell commands

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

TARGETS
========

default
-------

**Dry Run enabled**

The shell 🐚 command "pwsh -File ./updatecli/updatecli.d/test.ps1 2.344" exited on error (exit code 64) with the following output:
----

Usage: pwsh[.exe] [-Login] [[-File] <filePath> [args]]
                  [-Command { - | <script-block> [-args <arg-array>]
                                | <string> [<CommandParameters>] } ]
                  [-ConfigurationName <string>] [-CustomPipeName <string>]
                  [-EncodedCommand <Base64EncodedCommand>]
                  [-ExecutionPolicy <ExecutionPolicy>] [-InputFormat {Text | XML}]
                  [-Interactive] [-MTA] [-NoExit] [-NoLogo] [-NonInteractive] [-NoProfile]
                  [-OutputFormat {Text | XML}] [-SettingsFile <filePath>] [-SSHServerMode] [-STA]
                  [-Version] [-WindowStyle <style>] [-WorkingDirectory <directoryPath>]

       pwsh[.exe] -h | -Help | -? | /?

PowerShell Online Help https://aka.ms/powershell-docs

All parameters are case-insensitive.
----

command stderr output was:
----
The argument './updatecli/updatecli.d/test.ps1' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

----
ERROR: Something went wrong in target "default" :
ERROR: Shell command exited on error.

Expected Behavior

Runs the powershell script πŸ˜…

Steps To Reproduce

---
scms:
  github:
    kind: github
    spec:
      user: "{{ .github.user }}"
      email: "{{ .github.email }}"
      owner: "{{ .github.owner }}"
      repository: "{{ .github.repository }}"
      token: "{{ requiredEnv .github.token }}"
      username: "{{ .github.username }}"
      branch: "{{ .github.branch }}"

sources:
  jenkinsWeekly:
    name: Get Last Jenkins Weekly Version
    kind: jenkins
    spec:
      release: weekly
      github:
        token: "{{ requiredEnv .github.token }}"
        username: "{{ .github.username }}"
conditions:
  jenkinsWeekly:
    name: Test if Jenkins weekly published
    kind: maven
    spec:
      url: "repo.jenkins-ci.org"
      repository: "releases"
      groupid: "org.jenkins-ci.main"
      artifactid: "jenkins-war"
targets:
  default:
    name: 'Update weekly version'
    sourceid: jenkinsWeekly
    kind: shell
    spec:
      command: pwsh -File ./updatecli/updatecli.d/test.ps1
    scmid: github

Environment

OS: Ubuntu 20.04
updatecli: v0.23.2

Anything else?

I would like to use powershell as it has a decent way of interacting with XML while #336 #371 is still WIP

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

Again my confusion is that updatecli for the shell command uses the tmp folder as a working directory. Which is quite confusing when developing a new script that has not been committed.

Maybe we need an option to run on the current git clone that assumes dry run. So you can test the updatecli behavior.

I think we can close this issue and link to #465

I have verified I am able to perform powershell scripts over here: https://github.com/jenkinsci/bom/pull/1279

FYI updatecli and the powershell script is really useful for managing pinned version.

You may send him a beer or two to motivate him πŸ˜‰

@dduportal has not setup his GitHub sponsor πŸ˜…

Maybe we need an option to run on the current git clone that assumes dry run. So you can test the updatecli behavior.

That’s part of @dduportal refactoring with https://github.com/updatecli/updatecli/issues/465

## New flag that ensures that the target is applied locally but the "actions" are not applied
$ updatecli apply --config manifest.yaml --values values.yaml --no-actions # Or --actions=false

You may send him a beer or two to motivate him πŸ˜‰