9

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?

2 Answers 2

9

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.

Sign up to request clarification or add additional context in comments.

Comments

4

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

1 Comment

This doesn't work as written. You need a needs block on pages pointing to pages_2 otherwise both jobs run in parallel and the output from pages_2 won't be saved before pages runs.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.