我有一个gitlab与gitlab ci和一个在CoreOs机器上运行良好的跑步者。
所有3项服务都使用以下dockerfiles服务文件和构建脚本运行:
构建脚本:
git submodule update --init
ls -la
mvn install
CI服务:
[Unit]
Description=CI
# Requirements
Requires=docker.service
Requires=db.service
Requires=gitlab.service
Requires=redis.service
# Dependency ordering
After=docker.service
After=db.service
After=gitlab.service
After=redis.service
[Service]
User=core
# Let the process take awhile to start up (for first run Docker containers)
TimeoutStartSec=0
# Get CoreOS environmental variables
EnvironmentFile=/etc/environment
# Pre-start and Start
## Directives with "=-" are allowed to fail without consequence
KillMode=none
Restart=always
RestartSec=2
ExecStartPre=-/usr/bin/docker kill ci
ExecStartPre=-/usr/bin/docker rm ci
ExecStartPre=/usr/bin/docker pull sameersbn/gitlab-ci:5.2.0
ExecStart=/usr/bin/docker run --name ci \
-e 'DB_TYPE=mysql' -e 'DB_HOST=${COREOS_PRIVATE_IPV4}' -e 'DB_NAME=***' -e 'DB_USER=***' -e 'DB_PASS=********'\
-e 'REDIS_HOST=${COREOS_PRIVATE_IPV4}' -e 'REDIS_PORT=6379'\
-e 'GITLAB_URL=http://${COREOS_PRIVATE_IPV4}:8081/'\
-e 'GITLAB_CI_HOST=${COREOS_PRIVATE_IPV4}'\
-e 'GITLAB_CI_PORT=8080'\
-e 'GITLAB_CI_HTTPS=true'\
-e 'GITLAB_CI_EMAIL=*****************'\
-e 'SMTP_USER=**********' -e 'SMTP_PASS=**********'\
-p 8080:80 \
sameersbn/gitlab-ci:5.2.0
# Stop
ExecStop=/usr/bin/docker stop ci
CI-runner服务:
[Unit]
Description=CI Runner Maven & Dart
# Requirements
Requires=docker.service
Requires=ci.service
Requires=db.service
Requires=gitlab.service
Requires=redis.service
# Dependency ordering
After=docker.service
After=ci.service
After=db.service
After=gitlab.service
After=redis.service
[Service]
User=core
# Let the process take awhile to start up (for first run Docker containers)
TimeoutStartSec=0
RemainAfterExit=yes
# Get CoreOS environmental variables
EnvironmentFile=/etc/environment
#Pre-start and Start
## Directives with "=-" are allowed to fail without consequence
ExecStartPre=-/usr/bin/docker kill ci-runner-maven-dart
ExecStartPre=-/usr/bin/docker rm ci-runner-maven-dart
ExecStartPre=/usr/bin/docker pull registry.globaleda.pt/globaleda/ci-runner-maven-dart:latest
ExecStart=/usr/bin/docker run --name ci-runner-maven-dart -d \
-v /data/ci-runner-maven-dart:/home/gitlab_ci_runner/data \
registry.globaleda.pt/globaleda/ci-runner-maven-dart:latest
# Stop
ExecStop=/usr/bin/docker stop ci-runner-maven-dart
Ci runner dockerfile:
FROM lemonbar/gitlab-runner-jdk-maven:1.0
MAINTAINER jrofurtado@gmail.com
RUN apt-get update
RUN apt-get install curl -y
# Install dartIn the dockerfile i added ENV MAVEN_OPTS -Djava.net.preferIPv4Stack=true
RUN apt-get install apt-transport-https -y
RUN sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
RUN sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
RUN apt-get update
RUN apt-get install dart -y
ENV DART_HOME /usr/lib/dart
RUN apt-get -y install ca-certificates curl
ADD globaleda.crt /usr/local/share/ca-certificates/
RUN update-ca-certificates
RUN git config --global http.sslverify false
RUN apt-get update
RUN curl -sSL https://get.docker.com/ubuntu/ | sudo sh
ENV DOCKER_HOST tcp://*************
ADD .dockercfg /
RUN rm -f /app/init
ADD init /app/
RUN chmod 777 /app/init
Ci dockerfile是sameersbn / gitlab-ci的未修改版本:5.2.0。
当我编译maven项目(使用mvn install)时,它开始下载所需的工件并且下载挂起,如果我一遍又一遍地重试下载它设法完全下载问题我需要立即下载所有中断(它设法继续导致我将所有下载存储在映射的卷上)
观察:
- 我在本地计算机而不是服务器上部署了Ci runner容器并链接到gitlab ci,问题仍然存在。
- 如果你进入容器(使用docker-enter脚本或docker exec容器bash)并在终端上运行mvn install,它会按原样下载所有内容,尽管在它挂起的构建版本中下载它。
-i尝试在CI-Runner的dockerfile上使用设置MAVEN_OPTS到-Djava.net.preferIPv4Stack = true,我也尝试将它包含在CI-Runner的构建脚本中以强制使用此变量:
- 在调试模式下运行(-e)或读取日志我唯一的信息是:下载超时
答案 0 :(得分:0)
更新:Maven实际上没有挂起,构建成功完成。但是跑步者没有与gitlab ci通信,说由于响应错误导致其工作成功:500。
> 2015-01-02 18:37:54 +0000 | Submitting build 439 to coordinator...response error: 500
> 2015-01-02 18:38:02 +0000 | Submitting build 439 to coordinator...response error: 500
> 2015-01-02 18:38:06 +0000 | Completed build 439, success.
> 2015-01-02 18:38:06 +0000 | Submitting build 439 to coordinator...response error: 500
> 2015-01-02 18:38:15 +0000 | Submitting build 439 to coordinator...response error: 500
> 2015-01-02 18:38:18 +0000 | Completed build 439, success.
> 2015-01-02 18:38:18 +0000 | Submitting build 439 to coordinator...response error: 500
> 2015-01-02 18:38:27 +0000 | Submitting build 439 to coordinator...response error: 500
> 2015-01-02 18:38:30 +0000 | Completed build 439, success.
> 2015-01-02 18:38:30 +0000 | Submitting build 439 to coordinator...response error: 500
> 2015-01-02 18:38:39 +0000 | Submitting build 439 to coordinator...response error: 500
答案 1 :(得分:0)
我来这里是在用谷歌搜索同样的问题。阅读下面的评论后 OP
<块引用>好像是网络权限/防火墙问题。
我记得我使用的是 VPN 连接。关闭 VPN 解决了我的问题。