harness / gitness

Gitness is an Open Source developer platform with Source Control management, Continuous Integration and Continuous Delivery.

Home Page:https://gitness.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

【pipeline】使用pipeline示例模板或自定义模板为什么总是第一步要执行clone

geray-zsg opened this issue · comments

在尝试使用gitness执行流水线构建项目时,总是第一步执行clone,但是我没有在任何地方配置该步骤,这一步必须要拉取drone/git
镜像,我不知道这个有什么用,也没有找到任何地方可以取消这个步骤或者内网环境下怎么配置为个人的镜像仓库
image

我的pipeline文件如下:

name: kubeimooc-server-publish
kind: pipeline

environment:
  GOOS: linux
  GOARCH: amd64

steps:
# 第一阶段构建
- name: build
  image: plugins/docker
  volumes:
    - name: hosts
      path: /etc/hosts
    - name: docker-ca
      path: /etc/docker
    - name: dockersock
      path: /var/run/docker.sock
  settings:
    username: admin
    password:
      from_secret: harbor_password
    repo: harbor.geray.com/kubeimooc/kubeimooc-server
    registry: harbor.geray.com
    tags:
      - v1.0

# 第二阶段远程到远程机部署
- name: ssh commands
  image: appleboy/drone-ssh
  settings:
    host: 192.168.193.11
    username: root
    password:
      from_secret: ssh_password
    port: 22
    script:
    # 拉取镜像并重启  注意--需要提前在目标主完成docker login
      - if [ $(docker ps -a | grep kubeimooc-server | wc -l) -ge 1 ]; then docker stop kubeimooc-server && docker rm kubeimooc-server; fi
      - docker pull harbor.geray.com/kubeimooc/kubeimooc-server:v1.0
      - dockere run --name kubeimooc-server -d -p8082:8082 harbor.geray.com/kubeimooc/kubeimooc-server:v1.0

volumes:
  - name: hosts
    host:
      path: /etc/hosts
  - name: docker-ca
    host: 
      path: /etc/docker
  - name: dockersock
    host:
      path: /var/run/docker.sock

终于解决了这个问题不知道为什么drone/git:latest总是拉取不到,哪怕是我已经很费力的同步到私有镜像仓库,从私有镜像仓库拉取到宿主机也会卡主,我通过禁用默认的clone步骤,添加自己的步骤使用clone指定了其他版本可以正常运行了

name: kubeimooc-server-publish
kind: pipeline
type: docker

#environment:
 # GOOS: linux
  #GOARCH: amd64

clone:
  image: harbor.geray.com/drone/git:1.2.1
  disable: true
steps:

- name: clone
  image: harbor.geray.com/drone/git:1.2.1
# 第一阶段构建
...