我正在使用GitLab CI / CD管道来构建和部署jekyll网站。当我未激活缓存时,以下设置将起作用。
image: ruby:2.6
# Cache gems in between builds
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- vendor/ruby
before_script:
- gem install bundler
#- ruby -v # Print out ruby version for debugging
#- apt-get update -q && apt-get install nodejs -yqq
#- bundle install --path vendor # Install dependencies into ./vendor/ruby
- bundle install
build:
stage: build
script:
- bundle exec jekyll build -d public
artifacts:
paths:
- public
only:
- master
- develop
master-deploy:
stage: deploy
before_script:
# Install ssh client
- apt-get update
- apt-get install openssh-client
# Set up keys
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
# Set up known hosts
- echo "$KNOWN_HOST" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
# Install rsync
- apt-get update -qy
- apt-get install -y rsync
# Transfer files
...
# Backup old versions
...
only:
- master
develop-deploy:
stage: deploy
before_script:
# Install ssh client
- apt-get update
- apt-get install openssh-client
# Set up keys
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
# Set up known hosts
- echo "$KNOWN_HOST" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
# Install rsync
- apt-get update -qy
- apt-get install -y rsync
# Transfer files
...
# Backup old version
...
only:
- develop
一旦我激活缓存build install --path vendor
,就会出现以下错误:
Liquid Exception: Liquid syntax error (line 8): Unknown tag 'when' in vendor/ruby/2.6.0/gems/liquid-4.0.3/lib/liquid/locales/en.yml
jekyll 3.8.6 | Error: Liquid syntax error (line 8): Unknown tag 'when'
我已经删除了GitLab上的缓存(CI / CD->管道->清除流道缓存),但没有成功。感谢您的帮助