在Git Lab Runner上解决远程起源已存在的错误

时间:2019-03-26 14:36:00

标签: continuous-integration gitlab devops gitlab-ci-runner cd

我在git labrunner终端上的错误

fatal: remote origin already exists.
warning: failed to remove code/ecom_front_proj/dist/sections: Permission denied
ERROR: Job failed: exit status 1

我正在尝试通过gitRunner使用CI CD将项目部署到AWS服务器。第一次代码成功部署。如果我第二次提交,则显示上述错误。

如果我删除跑步者并创建一个新跑步者,则说明它已成功部署。 我不知道如何删除已经存在的远程原始文件。

我的Git.yml

image: docker
> 
> services:
>   - docker:dind
> 
> stages:
>   - test
>   - deploy
> 
> test:   stage: test   only:
>     - master
>       script:
>     - echo run tests in this section
> 
> step-deploy-prod:   stage: deploy   only:
>     - master   script:
>    
>     - sudo docker system prune -f
>     - sudo docker volume prune -f
>     - sudo docker image prune -f
>     - sudo docker-compose build --no-cache
>     - sudo docker-compose up -d   environment: development

我的Docker文件

FROM node:6 LABEL Aathi <aathi@techardors.com>
> 
> RUN apk update && apk add git RUN apk add nodejs  RUN apk add nginx
> RUN set -x ; \   addgroup -g 82 -S www-data ; \   adduser -u 82 -D -S
> -G www-data www-data && exit 0 ; exit 1
> 
> COPY ./nginx.conf     /etc/nginx/nginx.conf
> #COPY ./localhost.crt /etc/nginx/localhost.crt
> #COPY ./localhost.key /etc/nginx/localhost.key COPY ./code/ecom_front_proj /sections WORKDIR sections RUN npm install RUN
> npm install -g @angular/cli RUN ng build --prod

我的Docker撰写文件

version: '2'
> 
> services:   web:
>     container_name: nginx
>     build: .
>     ports:
>       - "4200:4200"
>     command: nginx -g "daemon off";
>     volumes:
>       - ./code/ecom_front_proj/dist/sections:/www:ro

我的nginx文件

user www-data; worker_processes 1; pid /run/nginx.pid;
> 
> events {  worker_connections 768;     # multi_accept on; }
> 
> http {    sendfile off;   tcp_nopush on;  tcp_nodelay on;
>   keepalive_timeout 65;   types_hash_max_size 2048;
> 
>   include /etc/nginx/mime.types;  default_type
> application/octet-stream;
> 
>   #access_log /var/log/nginx/access.log;  #error_log
> /var/log/nginx/error.log;
> 
>   gzip on;    gzip_disable "msie6";
> 
>       server {        #listen 8443 ssl;       listen 4200;        #server_name 
> localhost;
> 
>       #ssl_certificate      localhost.crt;        #ssl_certificate_key 
> localhost.key;
> 
>       location / {
>             root  /sections/dist/sections;
>             index index.html;
>          }
>       
>       } }

1 个答案:

答案 0 :(得分:0)

好像您运行的是gitlab-runner版本11.9.0,它具有bug

或者,您的gitlab-runner安装了特权,不允许其更改上述路径中的文件结构,考虑使用reinstalling或添加这些特权。