美文网首页
2019-10-07【Gitlab】cache vs artif

2019-10-07【Gitlab】cache vs artif

作者: 耕耘菜菜 | 来源:发表于2019-10-07 11:46 被阅读0次

    Cache

    Gitlab 的缓存不能用来存储build的结果,只能用来作为临时项目依赖的存储
    每个 Gitlab CI 任务要下载cache文件;然后解压;任务完成之后,再压缩上传新的同名cache

    # 全局缓存
    cache:
      key: ${CI_COMMIT_REF_SLUG}
      paths:
        - node_modules/
    
    
    stages:
      - build
      - test
    
    build website:
      stage: build
      image: node
      script:
        - npm install
        - npm install -g gatsby-cli
        - gtsby build
      artifacts:
        paths:
          - ./public
    
    test artifacts:
      image: alpine
      stage: test
      script: 
        - grep "Gasby" ./public/index.html
    

    Cache 可能由于多次上传下载导致差异不可用。需要在job任务栏清理cache

    Artifacts

    相关文章

      网友评论

          本文标题:2019-10-07【Gitlab】cache vs artif

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