Commit fe54962d authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Merge branch 'dev' into 'master'

Dev

See merge request redmic-project/gitlab-runner!1
parents 82f15ad4 59e6ac34
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+131 −0
Original line number Diff line number Diff line
include:
  - project: 'redmic-project/gitlab-ci-templates'
    ref: master
    file: '/deployment.yml'

stages:
  - deploy

variables:
  PROJECT_PARENT_NAME: gitlab

.deploy:
  variables:
    STACK: ${PROJECT_PARENT_NAME}
    SERVICES_TO_CHECK: ${PROJECT_PARENT_NAME}_${CI_PROJECT_NAME}
    STATUS_CHECK_DELAY: 30

.deploy-development:
  variables:
    COMPOSE_FILE: docker-compose.${CI_PROJECT_NAME}.tmpl.yml:docker-compose.${CI_PROJECT_NAME}.dev.yml
  environment:
    name: dev/${CI_PROJECT_NAME}

.deploy-production:
  variables:
    COMPOSE_FILE: docker-compose.${CI_PROJECT_NAME}.tmpl.yml:docker-compose.${CI_PROJECT_NAME}.prod.yml
  environment:
    name: pro/${CI_PROJECT_NAME}

.deploy-registrar:
  variables: &deploy-registrar-variables
    SERVICES_TO_CHECK: ${PROJECT_PARENT_NAME}_${CI_PROJECT_NAME}-registrar

.deploy-registrar-development:
  extends: .deploy-development
  variables:
    COMPOSE_FILE: docker-compose.${CI_PROJECT_NAME}-registrar.tmpl.yml:docker-compose.${CI_PROJECT_NAME}-registrar.dev.yml
    <<: *deploy-registrar-variables

.deploy-registrar-grafcan-gitlab-es-development:
  extends: .deploy-registrar-development
  environment:
    name: dev/${CI_PROJECT_NAME}-registrar-grafcan-gitlab-es

.deploy-registrar-gitlab-com-development:
  extends: .deploy-registrar-development
  environment:
    name: dev/${CI_PROJECT_NAME}-registrar-gitlab-com

.deploy-registrar-production:
  extends: .deploy-production
  variables:
    COMPOSE_FILE: docker-compose.${CI_PROJECT_NAME}-registrar.tmpl.yml:docker-compose.${CI_PROJECT_NAME}-registrar.prod.yml
    <<: *deploy-registrar-variables

.deploy-registrar-grafcan-gitlab-es-production:
  extends: .deploy-registrar-production
  environment:
    name: pro/${CI_PROJECT_NAME}-registrar-grafcan-gitlab-es

.deploy-registrar-gitlab-com-production:
  extends: .deploy-registrar-production
  environment:
    name: pro/${CI_PROJECT_NAME}-registrar-gitlab-com

.deploy-registrar-support-branch: &deploy-registrar-support-branch
  rules:
    - if: $CI_MERGE_REQUEST_ID ||
          $CI_COMMIT_TAG ||
          $CI_PIPELINE_SOURCE == "schedule" ||
          $CI_COMMIT_BRANCH == "master"
      when: never
    - if: $CI_COMMIT_BRANCH
      when: manual
      allow_failure: true

deploy-registrar-grafcan-gitlab-es-support-branch-development:
  extends: .deploy-registrar-grafcan-gitlab-es-development
  <<: *deploy-registrar-support-branch

deploy-registrar-gitlab-com-support-branch-development:
  extends: .deploy-registrar-gitlab-com-development
  <<: *deploy-registrar-support-branch

.deploy-registrar-stable-branch: &deploy-registrar-stable-branch
  rules:
    - if: $CI_MERGE_REQUEST_ID ||
          $CI_COMMIT_TAG ||
          $CI_PIPELINE_SOURCE == "schedule"
      when: never
    - if: $CI_COMMIT_BRANCH == "master"
      when: manual
      allow_failure: true

deploy-registrar-grafcan-gitlab-es-stable-branch-development:
  extends: .deploy-registrar-grafcan-gitlab-es-development
  <<: *deploy-registrar-stable-branch

deploy-registrar-gitlab-com-stable-branch-development:
  extends: .deploy-registrar-gitlab-com-development
  <<: *deploy-registrar-stable-branch

deploy-registrar-grafcan-gitlab-es-stable-branch-production:
  extends: .deploy-registrar-grafcan-gitlab-es-production
  <<: *deploy-registrar-stable-branch

deploy-registrar-gitlab-com-stable-branch-production:
  extends: .deploy-registrar-gitlab-com-production
  <<: *deploy-registrar-stable-branch

.deploy-registrar-tag: &deploy-registrar-tag
  rules:
    - if: $CI_COMMIT_TAG
      when: manual
      allow_failure: true

deploy-registrar-grafcan-gitlab-es-tag-development:
  extends: .deploy-registrar-grafcan-gitlab-es-development
  <<: *deploy-registrar-tag

deploy-registrar-gitlab-com-tag-development:
  extends: .deploy-registrar-gitlab-com-development
  <<: *deploy-registrar-tag

deploy-registrar-grafcan-gitlab-es-tag-production:
  extends: .deploy-registrar-grafcan-gitlab-es-production
  <<: *deploy-registrar-tag

deploy-registrar-gitlab-com-tag-production:
  extends: .deploy-registrar-gitlab-com-production
  <<: *deploy-registrar-tag

LICENSE

0 → 100644
+21 −0
Original line number Diff line number Diff line
MIT License

Copyright (c) 2020 REDMIC Project

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
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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.
+25 −1
Original line number Diff line number Diff line
# GitLab Runner

Deployment of a service to run GitLab CI/CD workloads

## Deployment

At first time, you must deploy `gitlab-runner-registrar` to configure and register a new runner instance. Then, deploy `gitlab-runner` (launching default deployment jobs) to receive jobs to run.

## Delete old runners

Service will try to unregister old version of same runner being registered, before creating the new one.

When runners name change, you must delete old registrations manually. Go to a running gitlab-runner container shell and execute one of the following commands:

```sh
# Remove one runner, by GitLab instance URL and runner token
gitlab-runner unregister --url http://gitlab.example.com/ --token t0k3n

# Remove one runner, by runner name
gitlab-runner unregister --name test-runner

# Remove only broken runners
gitlab-runner verify --delete

# Remove all runners
gitlab-runner unregister --all-runners
```

deploy/.env

0 → 100644
+40 −0
Original line number Diff line number Diff line
IMAGE_NAME=gitlab/gitlab-runner
IMAGE_TAG=alpine
PLACEMENT_CONSTRAINTS_NODE_HOSTNAME=hostname

CONFIG_FILE=/etc/gitlab-runner/config.toml
CI_SERVER_URL=https://gitlab.com/
REGISTRATION_TOKEN=changeme
REGISTER_NON_INTERACTIVE=true
REGISTER_LOCKED=false
REGISTER_RUN_UNTAGGED=true
RUNNER_NAME=redmic-gitlab-runner
RUNNER_TAG_LIST=custom-runner
RUNNER_LIMIT=1
RUNNER_REQUEST_CONCURRENCY=3
RUNNER_OUTPUT_LIMIT=40960
RUNNER_EXECUTOR=docker
RUNNER_ENV=DOCKER_TLS_CERTDIR=

DOCKER_IMAGE=alpine
DOCKER_PRIVILEGED=true
DOCKER_DISABLE_CACHE=true
DOCKER_SHM_SIZE=1000000000
DOCKER_MEMORY=4g
DOCKER_MEMORY_RESERVATION=1g
DOCKER_CPUS=4
RUNNER_DOCKER_TLS_VERIFY=false

CACHE_TYPE=s3
CACHE_SHARED=true
CACHE_S3_SERVER_ADDRESS=minio:9000
CACHE_S3_INSECURE=true
CACHE_S3_ACCESS_KEY=changeme
CACHE_S3_SECRET_KEY=changeme
CACHE_S3_BUCKET_NAME=gitlab-runner-cache

CONFIG_VOL_NAME=gitlab-runner-config-vol
WORK_VOL_NAME=gitlab-runner-work-vol

GITLAB_NET_NAME=gitlab-net
GITLAB_NET_DRIVER=overlay
+15 −0
Original line number Diff line number Diff line
version: '3.5'

services:
  gitlab-runner-registrar:
    deploy:
      placement:
        constraints:
          - node.hostname == ${PLACEMENT_CONSTRAINTS_NODE_HOSTNAME}

volumes:
  config-vol:
    name: ${CONFIG_VOL_NAME}

  work-vol:
    name: ${WORK_VOL_NAME}
Loading