Is it possible to run a batch file on windows from gitlab runner?

Hy guys I am a beginner to continuous integration I am trying to set set up ci which will run a .bat script. I have set up the following:

  1. Self-hosted gitlab on a docker container
  2. Gitlab runner on Windows.
  3. The runner is connected to my project which is on the gitlab docker container.

And I want to know if the following is possible or not:

  1. When someone commits to the project the gitlab runner on windows should trigger the .bat script.
  2. The .bat script is in the same Windows environment with gitlab runner not in the gitlab repository.
  3. After running the script it should perform the define tasks in the .bat script and shows the build output on gitlab.
1 Like

Hello Dean, I have the same issue of trying to start a Jenkins Build with Windows-Batch file from a GitLab-CI runner, running on the same machine as jenkins.
Have you already found a solution?
Beste regards

Hey,
sad that no one is interested in answering this for so long.
You can do this for example:
variables:
cmd_gradle: C:\gradle\bin\gradle.bat
...
script:
- '& $cmd_gradle -q installDist -p $service_path -PprojVersion="$env:CI_COMMIT_TAG"'

Or did you find a better solution?

In my case this fails unfortunately for the ProjectVersion.
Everything else works

Regards…

Edit: Tag variable expansion fixed

1 Like