zoukankan      html  css  js  c++  java
  • Golang & GitLab-CI 详细实例步骤

    1、安装GitLab-Runner

      1)curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh | sudo bash

      2)yum install gitlab-ci-multi-runner

    2、注册Runner

      1)gitlab-ci-multi-runner register

      2)网页打开你的gitlab工程->Settings->CI/CD->Specific Runners->

      

      3) 输入你gitlab地址(上图箭头1)

      4) 输入token(上图箭头2)

       

    如下

    Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
    http://127.0.0.1
    Please enter the gitlab-ci token for this runner:
    Wa1_MyXCdfbXEXbciNsZ
    Please enter the gitlab-ci description for this runner:
    [sanguo.localdomain]: mhserver-test
    Please enter the gitlab-ci tags for this runner (comma separated):
    mhserver-test
    Whether to run untagged builds [true/false]:
    [false]: true
    Whether to lock Runner to current project [true/false]:
    [false]: true
    Registering runner... succeeded                     runner=Wa1_MyXC
    Please enter the executor: ssh, virtualbox, docker-ssh+machine, parallels, docker-ssh, shell, docker+machine, kubernetes, docker:
    shell
    

      完后就上面打开的页面出现新的Runner

    3、 写Makefile(这步骤根据需求)

      

    all: test
    
    test:
        go test -short $(go list ./... | grep -v /vendor/)

    4、在项目根目录写.gitlab-ci.yml

    stages:
      - test
    
    build:
      stage: test
      script:
        - cd static
        - make test
      only:
      - master
      - develop
    

    5、提交完就可以看到 网页$(GitLib_project)/ CI/CD ->Jobs里有任务在跑了

      

    * 重启服务 gitlab-ci-multi-runner run

  • 相关阅读:
    I can do more…
    在希望的田野上
    卓越管理培训笔记
    Python 学习小计
    谈谈“直抒己见”
    [更新]关于博客园不支持RSS全文输出的解决方案
    效率生活二三事
    个人阅读解决方案
    Oracle函数sys_connect_by_path 详解
    基础班-模板配置
  • 原文地址:https://www.cnblogs.com/mrblue/p/10192592.html
Copyright © 2011-2022 走看看