PatPanda
PatPanda

Reputation: 5070

Rename "pages" job in GitLab

I am following this guide in order to create a webpage from GitLab CI.

My job looks like this:

pages:
  image: maven:3.9.5-sapmachine-21
  stage: pages
  script:
    - mvn clean install site
    - mkdir public
    - mv target/site/* public/
  artifacts:
    paths:
      - public

and it is working, as I am able to see the website.

However, the job name is "pages". I would like to rename it to "documentation"

I tried changing to this:

documentation:
  image: maven:3.9.5-sapmachine-21
  stage: documentation

However, it is not working.

It seems GitLab requires this stage/job to be called "pages" specifically. How to rename it?

Upvotes: 1

Views: 463

Answers (2)

Jeanot Zubler
Jeanot Zubler

Reputation: 1383

This is now possible with GitLab 17.6.

You need to add the property pages: true to your job. Your job can now look like this:

documentation:
  image: maven:3.9.5-sapmachine-21
  stage: documentation
  pages: true
  script:
    ...

Old Answer:

It is not possible. There is currently an open issue in their issue tracker.

[...] in the Gitlab Pages case it [renaming jobs] doesn't [work] as the job has to be named "pages". [...]

As the issue does not seem to be prioritized very highly, you just will have to live with a job called "pages".

Upvotes: 2

RoM
RoM

Reputation: 84

I had a similar issue with an inherited job included via a template. Until now, GitLab still doesn't support job renaming. So I solved the problem with a workaround:

# define the origin job explicitly again and set it not to run
oldJobName:
    rules:
        - when: never

# define child job with the name of your choice
newJobName:
    extends:
        - oldJobName

Upvotes: -1

Related Questions