Giter Site home page Giter Site logo

windows-executor-gitlab-runner's Introduction

Dotnet + npm builder on windows containers

Configuration for building windows projects, no vs studio or other bloatware.

  • Windows Server 2022-ltsc
  • Install latest! VMware-tools via url if vmware vms, or pipeline fails on random time
Why? Building wpf or winforms on linux host/docker leeds to error: [Stackoverflow](https://stackoverflow.com/questions/58116849/can-i-compile-net-core-3-wpf-application-in-linux) [Github-issue](dotnet/wpf#48) and better isolation from runner vm

Installing Docker

You cannot install docker-desktop.exe on windows-server, use commands below

## No Hyper-V required!
# Open elevated admin Powershell and execute
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Set-ExecutionPolicy unrestricted 
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name DockerMsftProvider -Force
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
# Reboot
Restart-Computer -Force
docker pull mcr.microsoft.com/windows/servercore:ltsc2022-amd64

Installing Gitlab-Runner

mkdir C:\GitLab-Runner
cd C:\Gitlab-Runner
wget https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-windows-amd64.exe -O ./gitlab-runner.exe
./gitlab-runner.exe install
./gitlab-runner.exe start
./gitlab-runner.exe status ## gitlab-runner: Service is running
## edit config.toml concurrent to run multiple pipelines at the same time

# Registring runner to gitlab
.\gitlab-runner.exe register --non-interactive --url "https://gitlab.example.com" --registration-token "TOKEN_KEY" --executor "docker-windows" --docker-image mcr.microsoft.com/windows/servercore:ltsc2022-amd64 --description "docker_win_builder" --tag-list "docker_win_builder" --locked="true"
# Get token-key registration see below
## For a shared runner, have an administrator go to the GitLab Admin Area and click Overview > Runners
## For a group runner, go to Settings > CI/CD and expand the Runners section
## For a project-specific runner, go to Settings > CI/CD and expand the Runners section

Ready

docker build -t gitlab.example.com/library/builder:0.1 .
docker login -u "USER" -p "PASSWORD" gitlab.example.com
docker push gitlab.example.com/library/builder:0.1

Runner pulling images from private repo

For pulling images without 'docker login' use DOCKER_AUTH_CONFIG variable inside config.toml on runner

  shell = "powershell"
  environment = ["DOCKER_AUTH_CONFIG={\"auths\":{\"gitlab.example.com\":{\"auth\":\"YXBpOlByb2dldF9hcGlfa2\"}}}"]
  [runners.custom_build_dir]

Bash:

# Encode
echo -n "USER:PASSWORD" | base64
# Decode
echo -n "YXBpOlByb2dldF9hcGlfa2" | base64 -d

Powershell:

# Encode
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('USER:PASSWORD'))
# Decode
[Text.Encoding]::Utf8.GetString([Convert]::FromBase64String('YXBpOlByb2dldF9hcGlfa2'))

windows-executor-gitlab-runner's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.