Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Gitlab CI: why do I get an error when I try to define the pages stage?

I’m trying to publish a create-react-app on Gitlab, using its CI.

This is my .gitlab-ci.yml file:

stages:
  - build
  - pages

build:
  image: node:16
  stage: build
  script:
    - npm install
    - npm build
  artifacts:
    paths:
      - build/

pages:
  image: alpine:latest
  stage: deploy
  variables:
    GIT_STRATEGY: none        # Do not clone git repo
  script:
    - mv build public         
  artifacts:
    paths:
      - public  
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

But unfortunately I get this error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

This GitLab CI configuration is invalid: pages job: chosen stage does not exist; available stages are .pre, build, pages, .post.

What’s wrong with my configuration?

>Solution :

You need to change your stages.

You have:

stages:
  - build
  - pages

but define:

pages:
  image: alpine:latest
  stage: deploy

The stage needs to match:

stages:
  - build
  - deploy <-------
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading