1

我正在使用 GitLab 托管我的静态页面!每次我配置 .gitlab-ci.yml 文件时,我都会收到以下错误:“无法找到 Gemfile”

这是cmd的输出 在此处输入图像描述

这里是 .gitlab-ci.yml 文件的 id

image: ruby:2.3


before_script:
- bundle install

job:
  script:
  - gem install jekyll
  - jekyll build

pages:
  stage: deploy
  script:
  - bundle install
  - bundle exec jekyll build -d public
  artifacts:
    paths:
    - public
  only:
  - master

test:
  stage: test
  script:
  - bundle install
  - bundle exec jekyll build -d test
  artifacts:
    paths:
    - test
  except:
  - master
4

1 回答 1

2

在您的配置中,我看到混合了不同的安装说明:

  • bundle install(在 before_script 中)
  • bundle install(同样,在页面部署脚本中)
  • gem install jekyll

该命令Gemfile是必需的bundle,它应该主要指定对 jekyll 的依赖(所以再次重复)

建议的解决方案:我建议您尝试使用gitlab pages 示例中的配置:

  • gitlab-ci.yml

    image: ruby:2.3
    
    variables:
      JEKYLL_ENV: production
    
    before_script:
      - bundle install
    
    test:
      stage: test
      script:
      - bundle exec jekyll build -d test
      artifacts:
        paths:
        - test
      except:
      - master
    
    pages:
      stage: deploy
      script:
      - bundle exec jekyll build -d public
      artifacts:
        paths:
        - public
      only:
      - master
    
  • 宝石文件

    source "https://rubygems.org"
    ruby RUBY_VERSION
    
    # This will help ensure the proper Jekyll version is running.
    gem "jekyll", "3.4.0"
    
    # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
    gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
    
于 2017-11-04T23:21:26.610 回答