美文网首页
GitLab CI简介

GitLab CI简介

作者: 诺之林 | 来源:发表于2021-03-31 11:51 被阅读0次

    本文的主线 GitLab => GitLab Runner => Project => 问题

    GitLab

    wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/bionic/gitlab-ce_12.6.7-ce.0_amd64.deb/download.deb
    
    sudo EXTERNAL_URL="http://172.10.66.100" dpkg -i gitlab-ce_12.6.7-ce.0_amd64.deb
    

    GitLab Runner

    # Runner Executor基于Docker
    sudo apt install -y docker.io
    
    wget https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_amd64.deb
    
    sudo dpkg -i gitlab-runner_amd64.deb
    
    sudo gitlab-runner register
    # http://172.10.66.100/
    # 输入这里的token => http://172.10.66.100/admin/runners
    # docker
    # java:8-jdk
    

    Project

    vim .gitlab-ci.yml
    
    stages:
      - build
      - test
      - deploy
    
    build:
      stage: build
      image: java:8-jdk
      cache:
        key: ${CI_COMMIT_REF_SLUG}
        paths:
          - .gradle/wrapper
          - .gradle/caches
      before_script:
        - export GRADLE_USER_HOME=`pwd`/.gradle
      script:
        - ./gradlew assemble
      artifacts:
        paths:
          - build/libs/*.jar
    
    • 构建成功后下载artifacts.zip
    unzip artifacts.zip
    
    java -jar build/libs/java-demo-0.0.1-SNAPSHOT.jar
    

    问题

    相关文章

      网友评论

          本文标题:GitLab CI简介

          本文链接:https://www.haomeiwen.com/subject/hvmohltx.html