...
 
Commits (54)
......@@ -21,7 +21,13 @@ testsdefinitions.txt
/.testoutput/
/.cover/
/.vagrant/
codeclimate.json
# Ignore Visual Studio Code internals
/.vscode
/debug
# Ignore the generated binary
/gitlab-runner
/gitlab-runner*
......@@ -248,10 +248,8 @@ integration windows:
- cmd /c mklink /D $target_path $current_path
- cd $GODIR\gitlab-runner
script:
- $packages = (go list ./... | findstr -v "\/vendor\/" | Out-String | %{$_ -replace "\r\n"," "})
- $testCommand = "go test $packages"
- Invoke-Expression $testCommand
- if ( $LASTEXITCODE -ne 0 ) { exit $LASTEXITCODE }
- $script = Join-Path -Path "ci" -ChildPath "test_windows.ps1"
- Invoke-Expression $script
allow_failure: true
only:
- /.*/@gitlab-org/gitlab-runner
......
......@@ -18,14 +18,15 @@
version = "v0.25.0"
[[projects]]
digest = "1:03a488e7484b135ddd9c05360fce30ad74ff7513823fc7dcbda1801d66d553d0"
branch = "master"
digest = "1:c7fe86f3f0c5dec0516cf2f139e91c61fa96742a3f3c983f325f4e6d630e748f"
name = "github.com/Azure/go-ansiterm"
packages = [
".",
"winterm",
]
pruneopts = "N"
revision = "19f72df4d05d31cbe1c56bfc8045c96babff6c7e"
revision = "d6e3b3328b783f23731bc4d058875b0371ff8109"
[[projects]]
digest = "1:c522948b37859d83d8cc338d81cd2f4e838ee351ab8c23b41c1afa9bf7f80351"
......@@ -588,7 +589,7 @@
revision = "cbeaeb16a013161a98496fad62933b1d21786672"
[[projects]]
digest = "1:ae3b843d6ecc9177b15a9445ac68efc37e12ecd7c36819f86c50a13120cf48f5"
digest = "1:af816109ede76072cf29dd2116e0cc386668690b81e5a4fc05ae10dfac22aee4"
name = "github.com/stretchr/testify"
packages = [
"assert",
......@@ -596,8 +597,8 @@
"require",
]
pruneopts = "N"
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
version = "v1.2.2"
revision = "ffdc059bfe9ce6a4e144ba849dbedead332c6053"
version = "v1.3.0"
[[projects]]
digest = "1:0e6bfd9ff4db873948cf1fe1a3727f893eb776440dd1085759bd6e8aa7f045e0"
......@@ -704,7 +705,8 @@
revision = "ef147856a6ddbb60760db74283d2424e98c87bff"
[[projects]]
digest = "1:53dfde12c05b3ffca6f4bb6dd2d45677a7b4e00df35b1d0b883a2e44dfbc4fdc"
branch = "master"
digest = "1:fbbff2513bab05594f48e08eec4d00a9971b6d978eacb237887d2b20016c3197"
name = "golang.org/x/sys"
packages = [
"unix",
......@@ -715,7 +717,7 @@
"windows/svc/mgr",
]
pruneopts = "N"
revision = "042a8f53ce82bbe081222da955159491e32146a0"
revision = "a457fd036447854c0c02e89ea439481bdcf941a2"
[[projects]]
digest = "1:3909e11965ccf1e7555e340338296d95fea9e8db2e6c873ee53a60b72916a33b"
......
......@@ -94,7 +94,7 @@ ignored = ["test", "appengine"]
[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.2"
version = "1.3.0"
[[constraint]]
# branch = "master"
......@@ -158,10 +158,6 @@ ignored = ["test", "appengine"]
name = "github.com/Azure/go-autorest"
revision = "d4e6b95c12a08b4de2d48b45d5b4d594e5d32fab"
[[override]]
name = "github.com/Azure/go-ansiterm"
revision = "19f72df4d05d31cbe1c56bfc8045c96babff6c7e"
[[override]]
name = "github.com/Microsoft/go-winio"
revision = "ce2922f643c8fd76b46cadc7f404a06282678b34"
......@@ -178,10 +174,6 @@ ignored = ["test", "appengine"]
name = "github.com/docker/docker-credential-helpers"
revision = "b7c53e02cd1a9a01500a58f22d83c6e964bc59db"
[[override]]
name = "github.com/docker/engine-api"
revision = "4290f40c056686fcaa5c9caf02eac1dde9315adf"
[[override]]
name = "github.com/docker/spdystream"
revision = "449fdfce4d962303d702fec724ef0ad181c92528"
......@@ -276,10 +268,6 @@ ignored = ["test", "appengine"]
name = "golang.org/x/oauth2"
revision = "ef147856a6ddbb60760db74283d2424e98c87bff"
[[override]]
name = "golang.org/x/sys"
revision = "042a8f53ce82bbe081222da955159491e32146a0"
[[override]]
name = "golang.org/x/text"
version = "v0.3.0"
......
The MIT License (MIT)
Copyright (c) 2015-2018 GitLab B.V.
Copyright (c) 2015-2019 GitLab B.V.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
......@@ -20,7 +20,3 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
---
All Documentation content that resides under the docs/ directory of this
repository is licensed under Creative Commons: CC BY-SA 4.0.
Copyright (c) 2015-2017 GitLab B.V.
With regard to the GitLab Software:
The MIT License (MIT)
Copyright (c) 2015-2019 GitLab B.V.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
......@@ -20,6 +22,13 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
---
For all third party components incorporated into the GitLab Software, those
components are licensed under the original license provided by the owner of the
applicable component.
---
All Documentation content that resides under the docs/ directory of this
repository is licensed under Creative Commons: CC BY-SA 4.0.
......@@ -96,10 +96,8 @@ Visit the [Changelog](CHANGELOG.md) to view recent changes.
## Author
```
2014 - 2015 : [Kamil Trzciński](mailto:ayufan@ayufan.eu)
2015 - now : GitLab Inc. team and contributors
```
- 2014 - 2015 : [Kamil Trzciński](mailto:ayufan@ayufan.eu)
- 2015 - now : GitLab Inc. team and contributors
## License
......
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure('2') do |config|
config.vm.define 'win10' do |cfg|
cfg.vm.box = 'StefanScherer/windows_10'
cfg.vm.communicator = 'winrm'
cfg.vm.synced_folder '.', 'C:\Go\src\gitlab.com\gitlab-org\gitlab-runner'
cfg.vm.provision 'shell', path: 'ci/vagrant.ps1'
end
config.vm.provider 'virtualbox' do |vb|
vb.gui = false
vb.memory = '2048'
vb.cpus = 1
vb.linked_clone = true
end
end
param([string]$testOpts = "")
$failed = @()
go list ./... | Select-String -Pattern "gitlab.com/gitlab-org/gitlab-runner/vendor/" -NotMatch | ForEach-Object {
$pkg = %{$_ -replace "\r\n", "" }
$testCmd = "go test $testOpts $pkg"
Invoke-Expression $testCmd
if ( $LASTEXITCODE -ne 0 ) { $failed += $pkg }
}
if ($failed.count -ne 0) {
Write-Host "Failed packages"
$failed | Out-String | Write-Host
exit 1
}
$goVersion = "1.8"
$gitVersion = "2.18.0"
$srcFolder = "C:\Go\src\gitlab.com\gitlab-org\gitlab-runner"
function Main
{
[environment]::SetEnvironmentVariable("RUNNER_SRC", $srcFolder, "Machine")
Install-Go($goVersion)
Install-Git($gitVersion)
Install-SSH
}
function Install-Go([string]$version)
{
$file = 'go' + $version +'.windows-amd64.msi'
$url = 'https://storage.googleapis.com/golang/' + $file
$dest = Download -Url $url
Write-Host "installing go $version..."
$logFile = Log-File -App 'go'
$MSIArguments = @(
"/i"
('"{0}"' -f $dest)
"/qn"
"/norestart"
"/L*v"
$logFile
)
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow
Write-Host "done"
Remove-Item $dest
}
function Install-Git([string]$version)
{
$releaseVersion = 'v' + $version + '.windows.1'
$file = 'Git-' + $version +'-64-bit.exe'
$url = GitHubRelease -Project 'git-for-windows/git' -Version $releaseVersion -File $file
$dest = Download -Url $url
Write-Host "installing git $version..."
$logFile = Log-File -App 'git'
$InstallArguments = @(
"/VERYSILENT"
('/LOG="{0}"' -f $logFile)
)
Start-Process $dest -ArgumentList $InstallArguments -Wait -NoNewWindow
Write-Host "done"
Remove-Item $dest
}
function Install-SSH
{
Write-Host "Enable Developer Mode"
# Create AppModelUnlock if it doesn't exist, required for enabling Developer Mode
$RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
if (-not(Test-Path -Path $RegistryKeyPath)) {
New-Item -Path $RegistryKeyPath -ItemType Directory -Force
}
# Add registry value to enable Developer Mode
New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1
$cap = Get-WindowsCapability -Online | ? Name -like "OpenSSH.Server*"
if (($cap.count -ne 0) -and ($cap[0].State -ne "Installed")) {
Write-Host "Install OpenSSH Server"
# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Install the OpenSSHUtils helper module, which is needed to fix the ACL for ths host keys.
# Install-Module -Force OpenSSHUtils
Write-Host "Enable OpenSSH Server"
Start-Service sshd
Write-Host "Open OpenSSH Server port on firewall"
# Open firewall port
New-NetFirewallRule -Protocol TCP -LocalPort 22 -Direction Inbound -Action Allow -DisplayName SSH
}
}
function GitHubRelease([string]$Project, [string]$Version = 'latest', [string]$File) {
'https://github.com/' + $Project + '/releases/download/' + $Version + '/' + $File
}
function Download([string]$Url) {
$dest = [System.IO.Path]::GetTempFileName()
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11"
Write-Host "downloading $Url"
# Create client, set its info, and download
$wc = New-Object System.Net.WebClient
$wc.UseDefaultCredentials = $true
$wc.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f")
$wc.DownloadFile($Url, $dest)
Write-Host "$url downloaded as $dest"
$dest
}
function Log-File($App)
{
$timestamp = get-date -Format yyyyMMddTHHmmss
$logFile = '{0}-{1}.log' -f $App,$timestamp
$vagrantFolder = Join-Path -Path $srcFolder -ChildPath ".vagrant"
Join-Path -Path $vagrantFolder -ChildPath $logFile
}
Main
......@@ -35,16 +35,15 @@ func (c *CacheExtractorCommand) getClient() *CacheClient {
return c.client
}
func checkIfUpToDate(path string, resp *http.Response) (bool, time.Time) {
fi, _ := os.Lstat(path)
date, _ := time.Parse(http.TimeFormat, resp.Header.Get("Last-Modified"))
return fi != nil && !date.After(fi.ModTime()), date
}
func (c *CacheExtractorCommand) download() (bool, error) {
os.MkdirAll(filepath.Dir(c.File), 0700)
file, err := ioutil.TempFile(filepath.Dir(c.File), "cache")
if err != nil {
return false, err
}
defer file.Close()
defer os.Remove(file.Name())
resp, err := c.getClient().Get(c.URL)
if err != nil {
return true, err
......@@ -59,13 +58,19 @@ func (c *CacheExtractorCommand) download() (bool, error) {
return retry, fmt.Errorf("Received: %s", resp.Status)
}
fi, _ := os.Lstat(c.File)
date, _ := time.Parse(http.TimeFormat, resp.Header.Get("Last-Modified"))
if fi != nil && !date.After(fi.ModTime()) {
upToDate, date := checkIfUpToDate(c.File, resp)
if upToDate {
logrus.Infoln(filepath.Base(c.File), "is up to date")
return false, nil
}
file, err := ioutil.TempFile(filepath.Dir(c.File), "cache")
if err != nil {
return false, err
}
defer os.Remove(file.Name())
defer file.Close()
logrus.Infoln("Downloading", filepath.Base(c.File), "from", url_helpers.CleanURL(c.URL))
_, err = io.Copy(file, resp.Body)
if err != nil {
......@@ -73,6 +78,11 @@ func (c *CacheExtractorCommand) download() (bool, error) {
}
os.Chtimes(file.Name(), time.Now(), date)
err = file.Close()
if err != nil {
return false, err
}
err = os.Rename(file.Name(), c.File)
if err != nil {
return false, err
......@@ -93,7 +103,7 @@ func (c *CacheExtractorCommand) Execute(context *cli.Context) {
logrus.Fatalln(err)
}
} else {
logrus.Infoln("No URL provided, cache will be not downloaded from shared cache server. Instead a local version of cache will be extracted.")
logrus.Infoln("No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.")
}
err := archives.ExtractZipFile(c.File)
......
......@@ -396,12 +396,13 @@ concurrent = 50 # All registered Runners can run up to 50 concurrent jobs
"engine-registry-mirror=http://10.11.12.13:12345" # Docker Machine is using registry mirroring
]
[runners.cache]
Type = "s3" # The Runner is using a distributed cache with Amazon S3 service
ServerAddress = "s3-eu-west-1.amazonaws.com"
AccessKey = "AMAZON_S3_ACCESS_KEY"
SecretKey = "AMAZON_S3_SECRET_KEY"
BucketName = "runners"
Insecure = false
Type = "s3"
[runners.cache.s3]
ServerAddress = "s3-eu-west-1.amazonaws.com"
AccessKey = "AMAZON_S3_ACCESS_KEY"
SecretKey = "AMAZON_S3_SECRET_KEY"
BucketName = "runner"
Insecure = false
```
Note that the `MachineOptions` parameter contains options for the `digitalocean`
......
---
last_updated: 2017-11-24
last_updated: 2019-01-11
---
> **[Article Type](https://docs.gitlab.com/ee/development/writing_documentation.html#types-of-technical-articles):** Admin guide ||
......@@ -31,6 +31,11 @@ NOTE: **Note:**
A familiarity with Amazon Web Services (AWS) is required as this is where most
of the configuration will take place.
TIP: **Tip:**
We suggest a quick read through docker machine [`amazonec2` driver
documentation](https://docs.docker.com/machine/drivers/aws/) to familiarize
yourself with the parameters we will set later in this article.
Your GitLab instance is going to need to talk to the Runners over the network,
and that is something you need think about when configuring any AWS security
groups or when setting up your DNS configuration.
......@@ -231,9 +236,10 @@ Here's an example of the `runners.machine` section:
"amazonec2-region=us-central-1",
"amazonec2-vpc-id=vpc-xxxxx",
"amazonec2-subnet-id=subnet-xxxxx",
"amazonec2-zone=x",
"amazonec2-use-private-address=true",
"amazonec2-tags=runner-manager-name,gitlab-aws-autoscaler,gitlab,true,gitlab-runner-autoscale,true",
"amazonec2-security-group=docker-machine-scaler",
"amazonec2-security-group=xxxxx",
"amazonec2-instance-type=m4.2xlarge",
]
```
......@@ -252,9 +258,10 @@ under `MachineOptions`. Below you can see the most common ones.
| `amazonec2-region=eu-central-1` | The region to use when launching the instance. You can omit this entirely and the default `us-east-1` will be used. |
| `amazonec2-vpc-id=vpc-xxxxx` | Your [VPC ID](https://docs.docker.com/machine/drivers/aws/#vpc-id) to launch the instance in. |
| `amazonec2-subnet-id=subnet-xxxx` | The AWS VPC subnet ID. |
| `amazonec2-zone=x` | If not specified, the [availability zone is `a`](https://docs.docker.com/machine/drivers/aws/#environment-variables-and-default-values), it needs to be set to the same availability zone as the specified subnet, for example when the zone is `eu-west-1b` it has to be `amazonec2-zone=b` |
| `amazonec2-use-private-address=true` | Use the private IP address of Docker Machines, but still create a public IP address. Useful to keep the traffic internal and avoid extra costs.|
| `amazonec2-tags=runner-manager-name,gitlab-aws-autoscaler,gitlab,true,gitlab-runner-autoscale,true` | AWS extra tag key-value pairs, useful to identify the instances on the AWS console. The "Name" tag is set to the machine name by default. We set the "runner-manager-name" to match the Runner name set in `[[runners]]`, so that we can filter all the EC2 instances created by a specific manager setup. Read more about [using tags in AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html). |
| `amazonec2-security-group=docker-machine-scaler` | AWS VPC security group name, see [AWS security groups](#aws-security-groups). |
| `amazonec2-security-group=xxxx` | AWS VPC security group name, see [AWS security groups](#aws-security-groups). |
| `amazonec2-instance-type=m4.2xlarge` | The instance type that the child Runners will run on. |
TIP: **Tip:**
......
......@@ -122,7 +122,7 @@ disabled.
Additionally, Kubernetes service account can be overwritten on `.gitlab-ci.yml` file, by using the variable
`KUBERNETES_SERVICE_ACCOUNT_OVERWRITE`.
This approach allow you to specify a service account that is attached to the namespace, usefull when dealing
This approach allow you to specify a service account that is attached to the namespace, useful when dealing
with complex RBAC configurations.
``` yaml
variables:
......
This diff is collapsed.
......@@ -84,7 +84,9 @@ Docker container.
gitlab/gitlab-runner:latest
```
1. [Register the Runner](../register/index.md#docker)
1. Register the runner you just launched by following the instructions in the
[Docker section of Registering Runners](../register/index.md#docker).
The runner won't pick up any jobs until it's registered.
Make sure that you read the [FAQ](../faq/README.md) section which describes
some of the most common problems with GitLab Runner.
......@@ -115,7 +117,7 @@ docker run -d --name gitlab-runner --restart always \
NOTE: **Note:**
You need to use the same method for mounting you data volume as you
did originally (`-v /srv/gitlab-runner/config:/etc/gitlab-runner` or
`--volumes-from gitlab-runner`).
`--volumes-from gitlab-runner-config`).
## Reading GitLab Runner logs
......
......@@ -66,7 +66,7 @@ To install the Runner:
be done manually or automatically - will be done using the same source:
>
```bash
cat > /etc/apt/preferences.d/pin-gitlab-runner.pref <<EOF
cat <<EOF | sudo tee /etc/apt/preferences.d/pin-gitlab-runner.pref
Explanation: Prefer GitLab provided packages over the Debian native ones
Package: gitlab-runner
Pin: origin packages.gitlab.com
......
......@@ -76,7 +76,7 @@ S3-compatible caching server:
1. Read the Access and Secret Key of minio and use it to configure the Runner:
```
sudo cat /.minio/config.json
sudo cat /export/.minio.sys/config/config.json | grep Key
```
You can now proceed and
......
......@@ -16,18 +16,22 @@ With GitLab Runner 10, the executable was renamed to `gitlab-runner`. If you
want to install a version prior to GitLab Runner 10, [visit the old docs](old.md).
1. Create a folder somewhere in your system, ex.: `C:\GitLab-Runner`.
1. Download the binary for [x86][] or [amd64][] and put it into the folder you
1. Download the binary for [x86][] or [amd64][] and put it into the folder you
created. Rename the binary to `gitlab-runner.exe`.
You can download a binary for every available version as described in
[Bleeding Edge - download any other tagged release](bleeding-edge.md#download-any-other-tagged-release).
1. Run an [`Administrator`/elevated command prompt][prompt] (<kbd>WindowsKey</kbd>, search for "cmd", right click and run as admin).
[Bleeding Edge - download any other tagged
release](bleeding-edge.md#download-any-other-tagged-release).
1. Run an [elevated command prompt][prompt]:
1. Press <kbd>Windows</kbd> key or click **Start** button.
1. Type `PowerShell`.
1. Right-click `Windows PowerShell`, and then select `Run as administrator`.
1. [Register the Runner](../register/index.md).
1. Install the Runner as a service and start it. You can either run the service
using the Built-in System Account (recommended) or using a user account.
**Run service using Built-in System Account**
```bash
```powershell
gitlab-runner install
gitlab-runner start
```
......@@ -37,7 +41,7 @@ want to install a version prior to GitLab Runner 10, [visit the old docs](old.md
You have to enter a valid password for the current user account, because
it's required to start the service by Windows:
```bash
```powershell
gitlab-runner install --user ENTER-YOUR-USERNAME --password ENTER-YOUR-PASSWORD
gitlab-runner start
```
......@@ -55,9 +59,9 @@ Logs are stored in Windows Event Log.
## Update
1. Stop the service (you need elevated command prompt as before):
1. Stop the service (you need [elevated command prompt][prompt] as before):
```bash
```powershell
cd C:\GitLab-Runner
gitlab-runner stop
```
......@@ -68,15 +72,15 @@ Logs are stored in Windows Event Log.
1. Start the service:
```bash
```powershell
gitlab-runner start
```
## Uninstall
From elevated command prompt:
From [elevated command prompt][prompt]:
```bash
```powershell
cd C:\GitLab-Runner
gitlab-runner stop
gitlab-runner uninstall
......@@ -91,7 +95,7 @@ some of the most common problems with GitLab Runner.
If you encounter an error like _The account name is invalid_ try to add `.\` before the username:
```shell
```powershell
gitlab-runner install --user ".\ENTER-YOUR-USERNAME" --password "ENTER-YOUR-PASSWORD"
```
......@@ -107,4 +111,4 @@ on Microsoft's support website.
[x86]: https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-windows-386.exe
[amd64]: https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-windows-amd64.exe
[prompt]: https://www.tenforums.com/tutorials/2790-elevated-command-prompt-open-windows-10-a.html
[prompt]: https://docs.microsoft.com/en-us/powershell/scripting/setup/starting-windows-powershell#at-the-command-prompt
......@@ -23,14 +23,14 @@ To register a Runner under GNU/Linux:
1. Enter your GitLab instance URL:
```
```text
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
https://gitlab.com
```
1. Enter the token you obtained to register the Runner:
```
```text
Please enter the gitlab-ci token for this runner
xxx
```
......@@ -38,21 +38,21 @@ To register a Runner under GNU/Linux:
1. Enter a description for the Runner, you can change this later in GitLab's
UI:
```
```text
Please enter the gitlab-ci description for this runner
[hostame] my-runner
```
1. Enter the [tags associated with the Runner][tags], you can change this later in GitLab's UI:
```
```text
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag,another-tag
```
1. Enter the [Runner executor](../executors/README.md):
```
```text
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
docker
```
......@@ -60,7 +60,7 @@ To register a Runner under GNU/Linux:
1. If you chose Docker as your executor, you'll be asked for the default
image to be used for projects that do not define one in `.gitlab-ci.yml`:
```
```text
Please enter the Docker image (eg. ruby:2.1):
alpine:latest
```
......@@ -77,14 +77,14 @@ To register a Runner under macOS:
1. Enter your GitLab instance URL:
```
```text
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
https://gitlab.com
```
1. Enter the token you obtained to register the Runner:
```
```text
Please enter the gitlab-ci token for this runner
xxx
```
......@@ -92,21 +92,21 @@ To register a Runner under macOS:
1. Enter a description for the Runner, you can change this later in GitLab's
UI:
```
```text
Please enter the gitlab-ci description for this runner
[hostame] my-runner
```
1. Enter the [tags associated with the Runner][tags], you can change this later in GitLab's UI:
```
```text
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag,another-tag
```
1. Enter the [Runner executor](../executors/README.md):
```
```text
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
docker
```
......@@ -114,7 +114,7 @@ To register a Runner under macOS:
1. If you chose Docker as your executor, you'll be asked for the default
image to be used for projects that do not define one in `.gitlab-ci.yml`:
```
```text
Please enter the Docker image (eg. ruby:2.1):
alpine:latest
```
......@@ -132,14 +132,14 @@ To register a Runner under Windows:
1. Enter your GitLab instance URL:
```
```text
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
https://gitlab.com
```
1. Enter the token you obtained to register the Runner:
```
```text
Please enter the gitlab-ci token for this runner
xxx
```
......@@ -147,21 +147,21 @@ To register a Runner under Windows:
1. Enter a description for the Runner, you can change this later in GitLab's
UI:
```
```text
Please enter the gitlab-ci description for this runner
[hostame] my-runner
```
1. Enter the [tags associated with the Runner][tags], you can change this later in GitLab's UI:
```
```text
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag,another-tag
```
1. Enter the [Runner executor](../executors/README.md):
```
```text
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
docker
```
......@@ -169,7 +169,7 @@ To register a Runner under Windows:
1. If you chose Docker as your executor, you'll be asked for the default
image to be used for projects that do not define one in `.gitlab-ci.yml`:
```
```text
Please enter the Docker image (eg. ruby:2.1):
alpine:latest
```
......@@ -189,14 +189,14 @@ To register a Runner under FreeBSD:
1. Enter your GitLab instance URL:
```
```text
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
https://gitlab.com
```
1. Enter the token you obtained to register the Runner:
```
```text
Please enter the gitlab-ci token for this runner
xxx
```
......@@ -204,21 +204,21 @@ To register a Runner under FreeBSD:
1. Enter a description for the Runner, you can change this later in GitLab's
UI:
```
```text
Please enter the gitlab-ci description for this runner
[hostame] my-runner
```
1. Enter the [tags associated with the Runner][tags], you can change this later in GitLab's UI:
```
```text
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag,another-tag
```
1. Enter the [Runner executor](../executors/README.md):
```
```text
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
docker
```
......@@ -226,32 +226,42 @@ To register a Runner under FreeBSD:
1. If you chose Docker as your executor, you'll be asked for the default
image to be used for projects that do not define one in `.gitlab-ci.yml`:
```
```text
Please enter the Docker image (eg. ruby:2.1):
alpine:latest
```
## Docker
These instructions are meant to be followed after [Run GitLab Runner in a container](../install/docker.md).
In this section, you will launch an ephemeral `gitlab-runner` container to
register the container that you created during install. After you finish
registration, the resulting configuration will be written to your chosen config
volume (e.g. `/srv/gitlab-runner/config`), and will be automatically loaded by
the runner using that config volume.
To register a Runner using a Docker container:
1. Run the following command which will mount the Runner's config directory
under `/path/to/config`:
1. Run the register command:
```sh
docker run --rm -t -i -v /path/to/config:/etc/gitlab-runner --name gitlab-runner gitlab/gitlab-runner register
docker run --rm -t -i -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register
```
NOTE: **Note:**
If you used a config volume other than `/srv/gitlab-runner/config` during
install, then you should update the command with the correct volume.
1. Enter your GitLab instance URL:
```
```text
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
https://gitlab.com
```
1. Enter the token you obtained to register the Runner:
```
```text
Please enter the gitlab-ci token for this runner
xxx
```
......@@ -259,21 +269,21 @@ To register a Runner using a Docker container:
1. Enter a description for the Runner, you can change this later in GitLab's
UI:
```
```text
Please enter the gitlab-ci description for this runner
[hostame] my-runner
```
1. Enter the [tags associated with the Runner][tags], you can change this later in GitLab's UI:
```
```text
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag,another-tag
```
1. Enter the [Runner executor](../executors/README.md):
```
```text
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
docker
```
......@@ -281,7 +291,7 @@ To register a Runner using a Docker container:
1. If you chose Docker as your executor, you'll be asked for the default
image to be used for projects that do not define one in `.gitlab-ci.yml`:
```
```text
Please enter the Docker image (eg. ruby:2.1):
alpine:latest
```
......@@ -317,7 +327,7 @@ If you're running the Runner in a Docker container, the `register` command would
look like:
```sh
docker run --rm -t -i -v /path/to/config:/etc/gitlab-runner --name gitlab-runner gitlab/gitlab-runner register \
docker run --rm -t -i -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register \
--non-interactive \
--executor "docker" \
--docker-image alpine:3 \
......
......@@ -2,7 +2,6 @@ package docker
import "time"
const DockerAPIVersion = "1.18"
const dockerLabelPrefix = "com.gitlab.gitlab-runner"
const prebuiltImageName = "gitlab/gitlab-runner-helper"
......
......@@ -1155,7 +1155,7 @@ func (e *executor) overwriteEntrypoint(image *common.Image) []string {
}
func (e *executor) connectDocker() (err error) {
client, err := docker_helpers.New(e.Config.Docker.DockerCredentials, DockerAPIVersion)
client, err := docker_helpers.New(e.Config.Docker.DockerCredentials, "")
if err != nil {
return err
}
......
......@@ -17,7 +17,6 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-runner/common"
"gitlab.com/gitlab-org/gitlab-runner/executors/docker"
"gitlab.com/gitlab-org/gitlab-runner/helpers"
"gitlab.com/gitlab-org/gitlab-runner/helpers/docker"
)
......@@ -210,8 +209,7 @@ func TestDockerCommandDisableEntrypointOverwrite(t *testing.T) {
}
func isDockerOlderThan17_07(t *testing.T) bool {
client, err := docker_helpers.New(
docker_helpers.DockerCredentials{}, docker.DockerAPIVersion)
client, err := docker_helpers.New(docker_helpers.DockerCredentials{}, "")
require.NoError(t, err, "should be able to connect to docker")
types, err := client.Info(context.Background())
......@@ -736,7 +734,7 @@ func getDockerCredentials(id string) (credentials docker_helpers.DockerCredentia
}
func waitForDocker(credentials docker_helpers.DockerCredentials) error {
client, err := docker_helpers.New(credentials, docker.DockerAPIVersion)
client, err := docker_helpers.New(credentials, "")
if err != nil {
return err
}
......
......@@ -7,6 +7,7 @@ import (
"time"
"gitlab.com/gitlab-org/gitlab-runner/common"
"gitlab.com/gitlab-org/gitlab-runner/helpers/dns"
)
func machineFormat(runner string, template string) string {
......@@ -17,7 +18,7 @@ func machineFormat(runner string, template string) string {
}
func machineFilter(config *common.RunnerConfig) string {
return machineFormat(config.ShortDescription(), config.Machine.MachineName)
return machineFormat(dns.MakeRFC1123Compatible(config.ShortDescription()), config.Machine.MachineName)
}
func matchesMachineFilter(name, filter string) bool {
......
package machine
import (
"testing"
"github.com/stretchr/testify/assert"
"gitlab.com/gitlab-org/gitlab-runner/common"
"testing"
dns_test "gitlab.com/gitlab-org/gitlab-runner/helpers/dns/test"
)
func TestMachineNewName(t *testing.T) {
func TestNewMachineName(t *testing.T) {
testCases := map[string]struct {
token string
}{
"DNS-1123 compatible token": {
token: "token-of",
},
"non DNS-1123 compatible token": {
token: "ToK3_?OF",
},
}
for name, testCase := range testCases {
t.Run(name, func(t *testing.T) {
config := &common.RunnerConfig{
RunnerCredentials: common.RunnerCredentials{
Token: testCase.token,
},
RunnerSettings: common.RunnerSettings{
Machine: &common.DockerMachine{
MachineName: "test-machine-%s",
},
},
}
name := newMachineName(config)
dns_test.AssertRFC1123Compatibility(t, name)
})
}
}
func TestNewMachineNameIsUnique(t *testing.T) {
config := &common.RunnerConfig{
RunnerSettings: common.RunnerSettings{
Machine: &common.DockerMachine{
......
......@@ -20,6 +20,7 @@ import (
"gitlab.com/gitlab-org/gitlab-runner/common"
"gitlab.com/gitlab-org/gitlab-runner/executors"
"gitlab.com/gitlab-org/gitlab-runner/helpers/dns"
terminalsession "gitlab.com/gitlab-org/gitlab-runner/session/terminal"
)
......@@ -394,7 +395,7 @@ type dockerConfigEntry struct {
}
func (s *executor) projectUniqueName() string {
return makeDNS1123Compatible(s.Build.ProjectUniqueName())
return dns.MakeRFC1123Compatible(s.Build.ProjectUniqueName())
}
func (s *executor) setupCredentials() error {
......
......@@ -20,7 +20,6 @@ import (
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-runner/session"
api "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
......@@ -30,6 +29,8 @@ import (
"gitlab.com/gitlab-org/gitlab-runner/common"
"gitlab.com/gitlab-org/gitlab-runner/executors"
"gitlab.com/gitlab-org/gitlab-runner/helpers"
dns_test "gitlab.com/gitlab-org/gitlab-runner/helpers/dns/test"