I’m attempting to get a GitLab.com hosted running working to build a simple project under Windows. I’ve found several discussions about this, and a few examples that have helped get to the point that I’ve created a .gitlab-ci.yml file that can execute a Windows “dir” command, but that’s about it.
I need to be able to invoke the “dotnet” command and install some NuGet packages to accomplish what I’m trying to do. That command doesn’t appear to exist in the Windows container. Am I not seeing it, or is it not truly unavailable? Do I need to create a local runner environment for something this simple?
I’ve searched around quite a bit but the existing topics on this are fairly old and I’m hoping there’s some newer information or advice. I really don’t want to have to create local runners at this point.
The hosted runners run in a virtual machine, not containers, see the explanation in Hosted runners on Windows | GitLab Docs
The list of pre-installed software linked from the docs includes dotnet-core and nuget. cookbooks/preinstalled-software/attributes/default.rb · main · GitLab.org / Ops Sub-Department / shared-runners / images / gcp / windows-containers · GitLab
I’m curious which commands you have tried in your .gitlab-ci.yml configuration, can you share the content?
UPDATED
Hi Michael, and thanks for the response!
And for the clarification; I misused “container” in the problem report. Sorry, a lot of this stuff feels generically “containerized” when running in the cloud, but I do need to keep my terminology straight for clarity.
I’m using the hosted runner “saas-windows-medium-amd64”. I saw the pre-installed software list including “dotnetcore_version v3.1.426” and assumed that would have the “dotnet” environment.
I’ll also attach my .gitlab-ci.yml file below.
Thank you very much for looking at this! I’m sort of at my wit’s end.
From that list:
default[:languages] = {
'dotnetcore_version': '3.1.426',
'ruby_version': '3.1.3.1',
'go_version': '1.21.4',
'nodejs_version': '21.7.3',
'openjdk_version': '21.0.1',
'python3_version': '3.13.2'
}
My .gitlab-ci.yml as it is today. It appears that despite the allocation I got a Linux environment running in Docker(?).
Here are some snips from the latest build log:
.windows_job:
tags:
- saas-windows-medium-amd64, shared-windows
before_script:
- Set-Variable -Name "time" -Value (date -Format "%H:%m")
- echo ${time}
- echo "started by ${GITLAB_USER_NAME} / @${GITLAB_USER_LOGIN}"
stages:
- package
- deploy
variables:
PROJECT_FOLDER: "MyUiPathProject" # Change to your project folder name
OUTPUT_FOLDER: "output"
PACKAGE_NAME: "MyUiPathProject"
PACKAGE_VERSION: "1.0.${CI_PIPELINE_IID}"
before_script:
- dir
- echo $SHELL
- ls
- cmd
- dotnet
#- .windows_job
- echo "Installing UiPath CLI..."
- dotnet tool install --global uipcli
- export PATH="$PATH:$HOME/.dotnet/tools"
package:
stage: package
script:
- echo "Packaging UiPath project..."
- uipcli pack "$PROJECT_FOLDER" --output "$OUTPUT_FOLDER" --name "$PACKAGE_NAME" --version "$PACKAGE_VERSION"
artifacts:
paths:
- "$OUTPUT_FOLDER/${PACKAGE_NAME}.${PACKAGE_VERSION}.nupkg"
rules:
- if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "uat"'
deploy:
stage: deploy
script:
- echo "Authenticating to Orchestrator..."
- uipcli orchestrator login --cloud \
--client-id "$UIPATH_CLIENT_ID" \
--client-secret "$UIPATH_CLIENT_SECRET" \
--account-name "$UIPATH_ACCOUNT_NAME" \
--tenant-name "$UIPATH_TENANT_NAME"
- |
ENV_FOLDER = "uat"
if [ "$CI_COMMIT_BRANCH" == "main" ]; then
ENV_FOLDER="PROD"
elif [ "$CI_COMMIT_BRANCH" == "uat" ]; then
ENV_FOLDER="UAT"
else
echo "Unsupported branch for deployment: $CI_COMMIT_BRANCH"
exit 1
fi
- echo "Deploying package to Orchestrator environment folder:" + $ENV_FOLDER"
- uipcli orchestrator deploy \
--package "$OUTPUT_FOLDER/${PACKAGE_NAME}.${PACKAGE_VERSION}.nupkg" \
--process-name "$PACKAGE_NAME" \
--environment "$ENV_FOLDER"
rules:
- if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "uat"'
It looks like the problem is I’m not actually getting a Windows container. Here’s the log of the latest job run, where I made some newer changes to see what I was dealing with:
Running with gitlab-runner 17.10.0~pre.41.g5c23fd8e (5c23fd8e)
on blue-6.saas-linux-small-amd64.runners-manager.gitlab.com/default nN8vMRS9Z, system ID: s_a899fcd611a3
Resolving secrets
Preparing the "docker+machine" executor
00:21
Using Docker executor with image ruby:3.1 ...
Pulling docker image ruby:3.1 ...
Using docker image sha256:9981df1d883b246c27c62f8ccb9b57d3e07d14cee8092299e102b4a69c35ea61 for ruby:3.1 with digest ruby@sha256:91627f55e8969006aab67d15c92fb930500ff73948803da1330b8a853fecebb5 ...
Preparing environment
00:05
Running on runner-nn8vmrs9z-project-65348542-concurrent-0 via runner-nn8vmrs9z-s-l-s-amd64-1744814909-37772cfd...
Getting source from Git repository
00:01
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/digital6065724/uipath/scripts/Test_Garden/.git/
Created fresh repository.
Checking out 0b43f36f as detached HEAD (ref is uat)...
Skipping Git submodules setup
$ git remote set-url origin "${CI_REPOSITORY_URL}" || echo 'Not a git repository; skipping'
Executing "step_script" stage of the job script
00:01
Using docker image sha256:9981df1d883b246c27c62f8ccb9b57d3e07d14cee8092299e102b4a69c35ea61 for ruby:3.1 with digest ruby@sha256:91627f55e8969006aab67d15c92fb930500ff73948803da1330b8a853fecebb5 ...
$ dir
Main.xaml TestExcel.xaml project.json
$ echo $SHELL
/bin/bash
$ ls
Main.xaml
TestExcel.xaml
project.json
$ cmd
/usr/bin/bash: line 168: cmd: command not found
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 1
FYI - I’ve edited your posts to add code blocks that help readability and copy-paste, please keep these edits.
This job uses the default Linux runners with containers on GitLab.com - saas-linux-small-amd64 indicates that, and the docker image being ruby:... which is the default for GitLab Runners when nothing is specified in the .gitlab-ci.yml file or no runner tags are matching.
It looks like the job tags for the Windows runners do not match, or the job template .windows_job is never imported into existing jobs - I don’t see extends: [ .windows_job ] anywhere in your configuration.
- Job tags for Windows Runners Hosted runners on Windows | GitLab Docs
- Job templates with extends Optimize GitLab CI/CD configuration files | GitLab Docs
Modify the job template to only use this tag:
.windows_job:
tags:
- - saas-windows-medium-amd64, shared-windows
+ - saas-windows-medium-amd64
And then include it into a job, which runs in a new test stage.
stages:
- test
- package
- deploy
.windows_job:
tags:
- saas-windows-medium-amd64
before_script:
- Set-Variable -Name "time" -Value (date -Format "%H:%m")
- echo ${time}
- echo "started by ${GITLAB_USER_NAME} / @${GITLAB_USER_LOGIN}"
pre-info:
extends: [ .windows_job ]
stage: test
Wow, thank you very much! That certainly gets me started. Also, sorry I missed the code blocks when I originally posted.
I still have a lot to learn about the overall syntax. I’ll keep looking. Any pointers to documentation would be appreciated!
Thank you again!
– Sam