Is multiple pages job in gitlab CI possible?
Asked Answered
A

2

7

I am using gitlab pages to deploy outputs from the jobs. I have 3 different jobs which produce html outputs. One job always runs. 2 other jobs are optional, thus they are manually run.

How is possible to deploy outputs of the manual jobs into pages in this situation? Can two different pages job be defined in gitlab ci?

Abirritant answered 31/1, 2018 at 11:13 Comment(0)
S
8

If you define two different pages in gitlab ci, the last entry will be seen as pages job. Therefore, you need to handle your work inside a single pages job.

Shortening answered 31/1, 2018 at 14:51 Comment(0)
S
2

In my experience you can have multiple pages jobs but with different names. It is important to have at least on job that is named exactly pages. Then you can have other jobs that just copy stuff to public and they will also be available.

Below is an example of my configuration:

pages:  # IMPORTANT! at least one job needs to be named "pages" otherwise the content will not be available
  stage: deploy
  script:
    # copy the pdf file into the public folder
    - mkdir -p public/First
    - cp My_File.pdf public/First
  artifacts:
    paths:
    - public  # instruct GitLab to keep the public folder

pages_2:
  stage: deploy
  script:
    # copy the pdf file into the public folder
    - mkdir -p public/Second/
    - cp My_File.pdf public/Second
  artifacts:
    paths: 
      - public  # instruct GitLab to keep the public folder

Also GitLab could release an interesting new feature in the future as discussed here: https://gitlab.com/gitlab-org/gitlab/-/issues/277351

Sancho answered 31/8, 2023 at 8:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.