Release-cli : The term 'release-cli' is not recognized as the name of a cmdlet

I am currently learning about CI/CD. My goal is to learn how to optimize and automate some of the daily tasks that I go through at my work. For example, creating a release everytime something is pushed to the repository with a new tag. I had some experience with Github actions and it was really easy to set it up. It only took a few minutes.

However I cannot get this to work on GitLab.

I have tried to setup self-managed runner. I have followed the steps below :

  1. Installed GitLab runner on windows. I have followed the following guide:
    Install GitLab Runner on Windows | GitLab

  2. I have started and registered runner. I can confirm that everything went fine because I can see active runner:
    image

My .gitlab-ci.yml file:


stages:          # List of stages for jobs, and their order of execution
  - release


release_job:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  rules:
    - if: $CI_COMMIT_TAG                 # Run this job when a tag is created
  script:
    - echo "running release_job"
  release:                               # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
    tag_name: '$CI_COMMIT_TAG'
    description: '$CI_COMMIT_TAG'

Issues that I have encountered along the way:

When I initially tried to run the job (I have created a tag) , I got some error about pwsh. Something like:

ERROR: Job failed (system failure): prepare environment: failed to start process: exec: "pwsh":

The error did not go away even after I have manually installed powershell using the following command line command:

winget install Microsoft.PowerShell

So I have decided change the shell from the “pswh” to “powershell” in my config.toml file as suggested in this stackoverflow post:

After this, I no longer get error regarding pwsh. I tried to run job again. This time, I am getting different error:

release-cli : The term 'release-cli' is not recognized as the name of a cmdlet, function, script file, or operable 
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:278 char:1

I have manually installed release-cli by following installation steps here:

I have added it to my user environment path and confirmed if I can use release-cli from the cmd and powershell:

However, even after manually installing release-cli and confirming that it works, I am still getting the same issue when I try to run job.

Questions:

  1. We use our own GitLab server so I assume using Runner SaaS is not an option for us, is that correct?

  2. What could be the reason that even after manually installing release-cli I still cannot get the job to run and return an error saying that it cannot run release-cli ?

I just had the same issue. After manually installing release-cli and adding it to PATH you need to restart gitlab-runner service for it to re-read system environment variables.
After restarting the service and restarting the failed “release” job, it succeeded.