在Gitlab CI中使用缓存和更改

问题描述

我有一个project,其中有几个独立的子目录,每个子目录都包含一个内置的HTML页面一个母版页面

pages:
    stage: deploy
    tags:
        - shell
    script:
        - mkdir -p public/
        - if [ -d artifacts ]; then cp -r artifacts/* public/; fi
    cache:
        paths:
            - public
    artifacts:
        paths:
        - public
    only: # Only executed for this branch
        - master

mdstyle:
    stage: build
    tags:
        - shell
    script:
        - mkdir -p artifacts/MD-Style/templates
        - cd MD-Style; tar -zcvf ../artifacts/mdstyle.tar.gz *; cd ..
        - cp MD-Style/templates/*.css ./artifacts/MD-Style/templates; cd ..
    artifacts:
        paths:
            - artifacts/mdstyle.tar.gz
            - artifacts/MD-Style
    rules: 
        - if: $CI_COMMIT_BRANCH == "master"
          changes: 
            - MD-Style/**/*

intro-python:
    stage: build
    image: ....
    tags: 
        - docker
    script:
        - mkdir -p artifacts/TPs/Intro-Python
        # Get the style and build
        - cd Intro-Python; cp ../MD-Style/* . -rf; make clean all; cd ..
        # copy the built files
        - cp -r Intro-Python/build/*  ./artifacts/TPs/Intro-Python/
    artifacts:
        paths:
            - artifacts/TPs/Intro-Python
    rules: 
        - if: $CI_COMMIT_BRANCH == "master"
          changes: 
            - Intro-Python/**/*
            - MD-Style/**/*

我定义了这些规则,希望仅重新编译提交中已更改的子目录。

“仅需要重建”是可行的,但是不幸的是,有时我也会松开同样构建的其他子页面,好像cache: paths: public并不总是有效。有时确实如此,有时却没有。否则,我只会得到已被提交修改的子页面,其余部分被抑制。

我怀疑高速缓存是否存在,但是不确定。您对这个问题或追踪此问题的可能性有任何想法吗?我使用的是Gitlab社区版13.3.0。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...