gitlab.com/jfprevost/gitlab-runner-notlscheck@v11.11.4+incompatible/docs/development/README.md (about) 1 # Development environment 2 3 ## 1. Install dependencies and Go runtime 4 5 ### For Debian/Ubuntu 6 ```bash 7 apt-get install -y mercurial git-core wget make 8 wget https://storage.googleapis.com/golang/go1.8.7.linux-amd64.tar.gz 9 sudo tar -C /usr/local -xzf go*-*.tar.gz 10 ``` 11 12 ### For OSX using binary package 13 ```bash 14 wget https://storage.googleapis.com/golang/go1.8.7.darwin-amd64.tar.gz 15 sudo tar -C /usr/local -xzf go*-*.tar.gz 16 ``` 17 18 ### For OSX if you have brew.sh 19 ``` 20 brew install go 21 ``` 22 23 ### For OSX using installation package 24 ``` 25 wget https://storage.googleapis.com/golang/go1.8.7.darwin-amd64.pkg 26 open go*-*.pkg 27 ``` 28 29 ### For FreeBSD 30 ``` 31 pkg install go-1.8.7 gmake git mercurial 32 ``` 33 34 ## 2. Install Docker Engine 35 36 The Docker Engine is required to create pre-built image that is embedded into runner and loaded when using docker executor. 37 38 Make sure that on machine that is running your Docker Engine you have a `binfmt_misc`. 39 This is required to be able to build ARM images that are embedded into GitLab Runner binary. 40 41 * For Debian/Ubuntu it's sufficient to execute: 42 43 ``` 44 apt-get install binfmt-support qemu-user-static 45 ``` 46 47 * For Docker for MacOS/Windows `binfmt_misc` is enabled by default. 48 49 * For CoreOS (but also works on Debian and Ubuntu) you need to execute the following script on system start: 50 51 ``` 52 #!/bin/sh 53 54 set -xe 55 56 /sbin/modprobe binfmt_misc 57 58 mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc 59 60 # Support for ARM binaries through Qemu: 61 { echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register; } 2>/dev/null 62 { echo ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb-static:' > /proc/sys/fs/binfmt_misc/register; } 2>/dev/null 63 ``` 64 65 [Install Docker Engine](https://docs.docker.com/engine/installation/) 66 67 ## 3. Configure Go 68 69 Add to `.profile` or `.bash_profile`: 70 71 ```bash 72 export GOPATH=$HOME/Go 73 export PATH=$PATH:$GOPATH/bin:/usr/local/go/bin 74 ``` 75 76 Create new terminal session and create $GOPATH directory: 77 78 ``` 79 mkdir -p $GOPATH 80 ``` 81 82 ## 4. Download runner sources 83 84 ``` 85 go get gitlab.com/gitlab-org/gitlab-runner 86 cd $GOPATH/src/gitlab.com/gitlab-org/gitlab-runner/ 87 ``` 88 89 ## 5. Install runner dependencies 90 91 This will download and restore all dependencies required to build runner: 92 ``` 93 make deps 94 ``` 95 96 **For FreeBSD use `gmake deps`** 97 98 ## 6. Run runner 99 100 Normally you would use `gitlab-runner`, in order to compile and run Go source use go toolchain: 101 102 ``` 103 make install 104 gitlab-runner run 105 ``` 106 107 You can run runner in debug-mode: 108 109 ``` 110 make install 111 gitlab-runner --debug run 112 ``` 113 114 ## 7. Compile and install runner binary as `gitlab-runner` 115 116 ``` 117 make install 118 ``` 119 120 ## 8. Run test suite locally 121 122 GitLab Runner test suite consists of "core" tests and tests for executors. 123 Tests for executors require certain binaries to be installed on your local 124 machine. Some of these binaries cannot be installed on all operating 125 systems. If a binary is not installed tests requiring this binary will be 126 skipped. 127 128 These are the binaries that you can install: 129 130 1. [VirtualBox](https://www.virtualbox.org/wiki/Downloads) and [Vagrant](https://www.vagrantup.com/downloads.html) 131 1. [kubectl](https://kubernetes.io/docs/user-guide/prereqs/) with 132 [Minikube](https://github.com/kubernetes/minikube) 133 1. [Parallels](http://www.parallels.com/products/desktop/download/) 134 1. [PowerShell](https://msdn.microsoft.com/en-us/powershell) 135 136 After installing the binaries run: 137 138 ``` 139 make development_setup 140 ``` 141 142 To execute the tests run: 143 144 ``` 145 make test 146 ``` 147 148 ## 9. Congratulations! 149 150 You can start hacking GitLab-Runner code. If you are interested you can use Intellij IDEA Community Edition with [go-lang-idea-plugin](https://github.com/go-lang-plugin-org/go-lang-idea-plugin) to edit and debug code. 151 152 ## Managing build dependencies 153 154 GitLab Runner uses [dep](https://github.com/golang/dep) to manage 155 its dependencies - they get checked into the repository under the `vendor/` directory, 156 with a manifest stored in `Godep.toml` and in `Godep.lock` lockfile. 157 158 If your contribution adds, removes or updates any dependencies to the runner, 159 please ensure the vendored copies is updated with the appropriate `dep ensure` command. 160 161 Don't add dependency from upstream master branch when version tags are available. 162 163 ## Troubleshooting 164 165 ### executor_docker.go missing Asset symbol 166 167 This error happens due to missing executors/docker/bindata.go file that is generated from docker prebuilts. 168 Which is especially tricky on Windows. 169 170 Try to execute: `make deps docker`, if it doesn't help you can do that in steps: 171 172 1. Execute `go get -u github.com/jteeuwen/go-bindata/...` 173 2. Download https://gitlab-runner-downloads.s3.amazonaws.com/master/docker/prebuilt-x86_64.tar.xz and save to out/docker/prebuilt-x86_64.tar.xz 174 3. Download https://gitlab-runner-downloads.s3.amazonaws.com/master/docker/prebuilt-arm.tar.xz and save to out/docker/prebuilt-arm.tar.xz 175 4. Execute `make docker` or check the Makefile how this command looks like