1

I am using GitLab to host my static page! every time I am configuring the .gitlab-ci.yml file I am getting the following error: "Could not locate Gemfile"

Here is the output of the cmd enter image description here

Here id the .gitlab-ci.yml file

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
Vasco
  • 297
  • 3
  • 16

1 Answers1

2

In your configuration I see a mixed of different install instructions:

  • bundle install (in the before_script)
  • bundle install (again, in the pages deploy script)
  • gem install jekyll

The Gemfile is required by the bundle command, and it should specify mainly the dependency on jekyll (so again a duplication)

PROPOSED SOLUTION: I suggest you to try with the configuration in the gitlab pages sample:

  • 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
    
  • Gemfile

    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]
    
Carlo Bellettini
  • 1,130
  • 11
  • 20