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?

Shnkc
  • 2,108
  • 1
  • 27
  • 35

2 Answers2

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.

0

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 there could an interesting new feature in teh future as discussed here: https://gitlab.com/gitlab-org/gitlab/-/issues/277351

TVK
  • 1,042
  • 7
  • 21