The pages:deploy job should be in the same stage as the pages job
Hello,
I just implemented the pages
job in order to use GitLab pages. As stated in the documentation, the pages:deploy
job is a "magic" job that runs after the pages
job. Our pages
job is declared in a stage named publish that comes after the deploy stage.
It seems that the pages:deploy
job is (always?) mapped to the deploy
stage, regardless of the pages
job's stage. However that does not prevent the deployment of pages to occur, it's more a matter of understanding/maintenance mainly in "big" pipelines (with many jobs/stages). Also, I didn't test what would happen if the deploy stage does not exist at all...
Therefore, I would suggest the pages:deploy
job should be created at the same stage of the pages
job (publish in my case). Also the pages:deploy
job should also be allowed to fail if allow_failure
is true.
Here is a small part of my .gitlab-ci.yml
file to get a better idea of what happen:
stages:
- build
- test
- deploy
- validate
- publish
# ... many jobs in different stages
deploy-job:
stage: deploy
script: ...
pages:
stage: publish
needs: [deploy-job]
dependencies: [deploy-job]
allow_failure: true
script: ...
artifacts:
paths:
- public
# pages:deploy will be in stage deploy instead of publish
# pages:deploy should be allowed to fail
Let me know if that sounds a good idea or if any more information is needed.
Best regards, Cedric
Implementation guide
Use the stage from the original pages job in https://gitlab.com/gitlab-org/gitlab/blob/8c87749593710d4d7fd2c4de48a000286adc96dc/app/services/projects/update_pages_service.rb#L67