gitlab in docker
- 网上有很多现成的解决方案,本文仅作流程梳理,若不需要,可直接用gitlab官方提供的镜像
installation
Dockerfile
FROM registry.api.weibo.com/weibo_rd_algorithmplatform/suanec/centos_7_4_1708:wctr_mpk8r_jdk_yarn_install_without_conf_001
# FROM registry.api.weibo.com/weibo_rd_algorithmplatform/suanec/centos_7_4_1708:wctr_emr_yarn_weibox_0.0.0.4_001
MAINTAINER suanec <enzhao@staff.weibo.com>
RUN pip install redis
ADD ./localip.sh ./start_HTTPServer.sh /data0/
RUN wget https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh
RUN sh script.rpm.sh
RUN yum -y install gitlab-ci-multi-runner.x86_64
# WORKDIR /data0/control_center/weibox/weibox-docker/flink-check/
# ADD ./py-source /data0/control_center/weibox/weibox-docker/flink-check
# ENTRYPOINT ["/bin/python", "/data0/control_center/weibox/weibox-docker/flink-check/flink-illegal-watchdog.py"]
register
gitlab-runner register --config '/data0/develop-gitlab-ci/host-py-source/gitlab-config.toml' --url 'http://git.intra.mosaic.com/' --registration-token '8s2cbdazXftXNj-H8M7y' --name 'weiclient-docker-develop-gitlab-ci-bx-core.jpool.mosaic.cn' --tag-list 'python2.7,docker-develop-gitlab-ci' --executor 'shell' --non-interactive
running
#!/bin/bash
LOG_DIR=$1
if [ -z ${LOG_DIR} ]
then
export LOG_DIR="/data0/control_center/weibox/weibox_containers"
fi
source ./dockertag.sh
# REALPATH=`realpath .`
REALPATH="$( cd "$( dirname "$0" )" && pwd )"
DOCKER_CONTAINER_NAME_PREFIX="develop-base"
DOCKER_CONTAINER_NAME_PREFIX="${SUANEC_DOCKER_TAG}"
DOCKER_CONTAINER_NAME_SUFFIX=$(date +-%Y%m%d)
DOCKER_CONTAINER_NAME=${DOCKER_CONTAINER_NAME_PREFIX}${DOCKER_CONTAINER_NAME_SUFFIX}
docker kill ${DOCKER_CONTAINER_NAME};docker rm ${DOCKER_CONTAINER_NAME}
docker run -d
--net="host"
--name=${DOCKER_CONTAINER_NAME}
--restart=always
-v /etc/localtime:/etc/localtime:ro
-v ${REALPATH}/py-source:/data0/${DOCKER_CONTAINER_NAME_PREFIX}/host-py-source
"${SUANEC_DOCKER_REPO}${SUANEC_DOCKER_NAME}${SUANEC_DOCKER_TAG}"
gitlab-runner run -c /data0/${DOCKER_CONTAINER_NAME_PREFIX}/host-py-source/gitlab-config.toml
trouble-shooting
This job is stuck, because you don't have any active runners that can run this job.
Can run untagged jobs: no and you have a tag ansible for this runner.
1. add project tags for runner
2. set runner for can run with untag.