Установка Runners в Kubernetes / Minikube

Установка werf + kubectl

На хосте

$ curl -sSL https://werf.io/install.sh | bash -s -- --ci $ sudo apt-get update && sudo apt-get install -y apt-transport-https $ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - $ echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list $ sudo apt-get update $ sudo apt-get install -y kubectl

На хосте

$ kubectl get no $ sudo mkdir /home/gitlab-runner/.kube && $ sudo cp -i ~/.kube/config /home/gitlab-runner/.kube/config && $ sudo chown -R gitlab-runner:gitlab-runner /home/gitlab-runner/.kube

В контейнере

$ sudo gitlab-runner register --url https://gitlab.example.com --token sdfgdsgdsggsdg

На всех вопросах можно оставлять стандартные ответы, а на вопрос о выборе executor’а указать shell.

.gitlab-ci.yml

stages: - build - deploy - dismiss - cleanup before_script: - type trdl && . $(trdl use werf 1.2 stable) - type werf && source $(werf ci-env gitlab --as-file) Build and Publish: stage: build script: - werf build except: [schedules] tags: [werf] .base_deploy: stage: deploy script: - werf converge --require-built-images --set "env_url=$(echo ${CI_ENVIRONMENT_URL} | cut -d / -f 3)" except: [schedules] tags: [werf] Deploy to Production: extends: .base_deploy environment: name: production url: https://habrapp.zhbert.ru only: [main]