# 设置执行镜像 image: node 12 # 整个pipeline有两个stage stages: - build - test # 定义全局缓存,缓存的key来自分支信息,缓存位置是vendor文件夹 cache: key: ${CI_COMMIT_REF_SLUG} paths: - vendor/ before_script: - echo "Before script section" after_script: - echo "After script section" build1: stage: build script: - echo "将内容写入缓存" - echo "build" > vendor/hello.txt test1: stage: test script: - echo "从缓存读取内容" - cat vendor/hello.txt