Skip to content

How is release-cli called from gitlab-runner shell (pwsh)?

Summary

release-cli is not recognized as a command within shell session (pwsh) from gitlab-runner. release-cli is able to be called separately when I personally open a PowerShell session since the path to release-cli is in my environment variable PATH.

Versions

os: Windows 10 Pro 21H2 (x64)
PowerShell: 7.2.4
git: 2.36.1.windows.1
GitLab: 13.3.2-ee
GitLab-Runner: 15.0.0 (windows/amd64)
release-cli: 0.11.0

I verified my paths matched exactly that of the documentation:

/c/GitLab-Runner/gitlab-runner-windows-amd64.exe
/c/GitLab/Release-CLI/bin/release-cli

My PATH environment variable (both for user and System):

...:/c/GitLab/Release-CLI/bin:...

Note: I build release-cli from source repo to test alternative to published executable since I saw previous Issue comments state they were capable of executing with newer golang versions (or something to that affect). However this is not make any change during my attempts. I was unable to build gitlab-runner (even though I have Chocolatey make and mingw64 for windows; won't bother to list that issue here since out of scope).

I know that my Path (PATH) environment variable is being read successfully since I included it in the yaml (before_script: ['echo $env:Path']). It prints out the location to release-cli.

I looked into creating environment variable in the config.toml file (environment = ["release-cli=$env:PATH"]). But decided to not look into this any further since the fix shouldn't be this complicated and the above PATH variable was read successfully.

Steps to reproduce

config.toml (within C:\GitLab-Runner):

[[runners]]
...
executor = "shell"
shell = "pwsh"

.gitlab-ci.yml

stages:
  - build
  - release
...
release-windows-using-binary-on-shell:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  script: ['echo "Creating release on windows shell executor"']
  release:
    name: 'Release $CI_COMMIT_TAG'
    description: 'copied from template'
    tag_name: '$CI_COMMIT_TAG'
    assets:
      links:
        - name: 'qorvo_mode_table'
          filepath: 'dist/ModeTable.exe' # optional
          link_type: 'other' # optional

Example Project

What is the current bug behavior?

release-cli is not being recognized even though it is within the PATH environment variable.

What is the expected correct behavior?

release-cli should execute.

Relevant logs and/or screenshots

Pipeline job:

Executing "step_release" stage of the job script
00:01
$ release-cli create --name "Release $CI_COMMIT_TAG" --description "copied from template" --tag-name "$CI_COMMIT_TAG"
Line |
 206 |  release-cli create --name "Release $CI_COMMIT_TAG" --description "cop .
     |  ~~~~~~~~~~~
     | The term 'release-cli' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit status 1

Output of checks

Possible fixes

Edited by Jaime Martinez