Commit 603d8721 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Descarta asignación de red, unifica ambos runners

No es necesario vincular a los runner generados a la red de gitlab.
Prueba a usar al mismo runner como local y remoto, registrándose en
ambos gitlab.
parent 8648efb5
Loading
Loading
Loading
Loading
+17 −39
Original line number Diff line number Diff line
@@ -61,18 +61,20 @@ deploy-gitlab-ce-dev:
    - dev
  when: manual

deploy-gitlab-runner-local:
deploy-gitlab-runner-dev:
  stage: deploy
  variables:
    DEPLOY_DIR_NAME: gitlab-runner
    SSH_REMOTE: ${DEV_SSH_REMOTE}
    STACK: gitlab
    SERVICES_TO_CHECK: gitlab_gitlab-runner-local
    SERVICES_TO_CHECK: gitlab_gitlab-runner
    IMAGE_TAG: alpine
    COMPOSE_FILE: docker-compose.gitlab-runner-local.tmpl.yml:docker-compose.gitlab-runner-local.dev.yml
    CI_SERVER_URL: http://gitlab_gitlab-ce
    REGISTRATION_TOKEN: ${OAGDEV_GITLAB_TOKEN}
    RUNNER_NAME: OAGDevLocal
    COMPOSE_FILE: docker-compose.tmpl.yml:docker-compose.dev.yml
    CI_SERVER_URL_REMOTE: https://gitlab.com
    REGISTRATION_TOKEN_REMOTE: ${GITLABCOM_GITLAB_TOKEN}
    CI_SERVER_URL_LOCAL: http://gitlab_gitlab-ce
    REGISTRATION_TOKEN_LOCAL: ${OAGDEV_GITLAB_TOKEN}
    RUNNER_NAME: OAG-dev
    RUNNER_TAG_LIST: oagdev
    CACHE_S3_SERVER_ADDRESS: minio.redmic.net
    CACHE_S3_ACCESS_KEY: ${MINIO_ACCESS_KEY}
@@ -80,41 +82,17 @@ deploy-gitlab-runner-local:
  script:
    - create-nets.sh gitlab-net
    - >
      deploy.sh IMAGE_TAG=${IMAGE_TAG} COMPOSE_FILE=${COMPOSE_FILE} CI_SERVER_URL="${CI_SERVER_URL}"
      REGISTRATION_TOKEN="${REGISTRATION_TOKEN}" RUNNER_NAME="${RUNNER_NAME}" RUNNER_TAG_LIST="${RUNNER_TAG_LIST}"
      CACHE_S3_SERVER_ADDRESS="${CACHE_S3_SERVER_ADDRESS}" CACHE_S3_ACCESS_KEY="${MINIO_ACCESS_KEY}"
      CACHE_S3_SECRET_KEY="${MINIO_SECRET_KEY}"
  environment:
    name: dev/gitlab-runner-local
  only:
    - dev
  when: manual

deploy-gitlab-runner-remote:
  stage: deploy
  variables:
    DEPLOY_DIR_NAME: gitlab-runner
    SSH_REMOTE: ${DEV_SSH_REMOTE}
    STACK: gitlab
    SERVICES_TO_CHECK: gitlab_gitlab-runner-remote
    IMAGE_TAG: alpine
    COMPOSE_FILE: docker-compose.gitlab-runner-remote.tmpl.yml:docker-compose.gitlab-runner-remote.dev.yml
    CI_SERVER_URL: https://gitlab.com
    REGISTRATION_TOKEN: ${GITLABCOM_GITLAB_TOKEN}
    RUNNER_NAME: OAGDevRemote
    RUNNER_TAG_LIST: oagdev
    CACHE_S3_SERVER_ADDRESS: minio.redmic.net
    CACHE_S3_ACCESS_KEY: ${MINIO_ACCESS_KEY}
    CACHE_S3_SECRET_KEY: ${MINIO_SECRET_KEY}
  script:
    - create-nets.sh gitlab-net
      deploy.sh IMAGE_TAG=${IMAGE_TAG} COMPOSE_FILE=${COMPOSE_FILE} CI_SERVER_URL="${CI_SERVER_URL_REMOTE}"
      REGISTRATION_TOKEN="${REGISTRATION_TOKEN_REMOTE}" RUNNER_NAME="${RUNNER_NAME}"
      RUNNER_TAG_LIST="${RUNNER_TAG_LIST}" CACHE_S3_SERVER_ADDRESS="${CACHE_S3_SERVER_ADDRESS}"
      CACHE_S3_ACCESS_KEY="${MINIO_ACCESS_KEY}" CACHE_S3_SECRET_KEY="${MINIO_SECRET_KEY}"
    - >
      deploy.sh IMAGE_TAG=${IMAGE_TAG} COMPOSE_FILE=${COMPOSE_FILE} CI_SERVER_URL="${CI_SERVER_URL}"
      REGISTRATION_TOKEN="${REGISTRATION_TOKEN}" RUNNER_NAME="${RUNNER_NAME}" RUNNER_TAG_LIST="${RUNNER_TAG_LIST}"
      CACHE_S3_SERVER_ADDRESS="${CACHE_S3_SERVER_ADDRESS}" CACHE_S3_ACCESS_KEY="${MINIO_ACCESS_KEY}"
      CACHE_S3_SECRET_KEY="${MINIO_SECRET_KEY}"
      deploy.sh IMAGE_TAG=${IMAGE_TAG} COMPOSE_FILE=${COMPOSE_FILE} CI_SERVER_URL="${CI_SERVER_URL_LOCAL}"
      REGISTRATION_TOKEN="${REGISTRATION_TOKEN_LOCAL}" RUNNER_NAME="${RUNNER_NAME}"
      RUNNER_TAG_LIST="${RUNNER_TAG_LIST}" CACHE_S3_SERVER_ADDRESS="${CACHE_S3_SERVER_ADDRESS}"
      CACHE_S3_ACCESS_KEY="${MINIO_ACCESS_KEY}" CACHE_S3_SECRET_KEY="${MINIO_SECRET_KEY}"
  environment:
    name: dev/gitlab-runner-remote
    name: dev/gitlab-runner
  only:
    - dev
  when: manual
+0 −2
Original line number Diff line number Diff line
@@ -7,11 +7,9 @@ RUNNER_LIMIT=2
RUNNER_REQUEST_CONCURRENCY=2
RUNNER_OUTPUT_LIMIT=40960
RUNNER_EXECUTOR=docker
RUNNER_DOCKER_HOST=gitlab-runner
RUNNER_DOCKER_IMAGE=alpine
RUNNER_DOCKER_TLS_VERIFY=false
RUNNER_DOCKER_PRIVILEGED=true
RUNNER_DOCKER_NETWORK_MODE=gitlab-net
RUNNER_DOCKER_DISABLE_CACHE=true
RUNNER_DOCKER_SHM_SIZE=1000000000
RUNNER_DOCKER_MEMORY=4g
+8 −0
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ version: '3.5'

volumes:
  etc-vol:
    name: gitlab-runner-remote-etc-vol
    name: gitlab-runner-etc-vol

  home-vol:
    name: gitlab-runner-remote-home-vol
    name: gitlab-runner-home-vol
+0 −23
Original line number Diff line number Diff line
version: '3.5'

services:
  gitlab-runner-local:
    deploy:
      mode: replicated
      replicas: 1
      restart_policy:
        delay: 30s
        window: 1m
      resources:
        limits:
          cpus: '0.5'
          memory: 128M
        reservations:
          memory: 103M

volumes:
  etc-vol:
    name: gitlab-runner-local-etc-vol

  home-vol:
    name: gitlab-runner-local-home-vol
+0 −48
Original line number Diff line number Diff line
version: '3.5'

services:
  gitlab-runner-local:
    image: gitlab/gitlab-runner:${IMAGE_TAG:-latest}
    entrypoint: /bin/sh
    command: >
      -c "
        gitlab-runner register ;
        gitlab-runner run --user=gitlab-runner --working-directory=/home/gitlab-runner"
    environment:
      - CONFIG_FILE
      - CI_SERVER_URL
      - REGISTRATION_TOKEN
      - REGISTER_NON_INTERACTIVE
      - REGISTER_LOCKED
      - REGISTER_RUN_UNTAGGED
      - RUNNER_NAME
      - RUNNER_TAG_LIST
      - RUNNER_LIMIT
      - RUNNER_REQUEST_CONCURRENCY
      - RUNNER_OUTPUT_LIMIT
      - RUNNER_EXECUTOR
      - CACHE_TYPE
      - CACHE_SHARED
      - CACHE_S3_SERVER_ADDRESS
      - CACHE_S3_ACCESS_KEY
      - CACHE_S3_SECRET_KEY
      - CACHE_S3_BUCKET_NAME
      - DOCKER_IMAGE=${RUNNER_DOCKER_IMAGE}
      - DOCKER_TLS_VERIFY=${RUNNER_DOCKER_TLS_VERIFY}
      - DOCKER_PRIVILEGED=${RUNNER_DOCKER_PRIVILEGED}
      - DOCKER_NETWORK_MODE=${RUNNER_DOCKER_NETWORK_MODE}
      - DOCKER_DISABLE_CACHE=${RUNNER_DOCKER_DISABLE_CACHE}
      - DOCKER_SHM_SIZE=${RUNNER_DOCKER_SHM_SIZE}
      - DOCKER_MEMORY=${RUNNER_DOCKER_MEMORY}
      - DOCKER_MEMORY_RESERVATION=${RUNNER_DOCKER_MEMORY_RESERVATION}
      - DOCKER_CPUS=${RUNNER_DOCKER_CPUS}
    networks:
      - gitlab-net
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - etc-vol:/etc/gitlab-runner
      - home-vol:/home/gitlab-runner

networks:
  gitlab-net:
    external: true
Loading