Add support for variable for pages.expire_in

What does this MR do and why?

Currently pages.expire_in does not support variables and because of which we can not pass rule based different values for it. So this MR is to add support for variable for pages.expire_in.

Related: #492289 (closed)

Changelog: added

References

Screenshots or screen recordings

Before After

How to set up and validate locally

This is a simple example. The DURATION variable can have different values based on different rules.

  1. Create a GitLab Pages website from a project template and in step 3 of template selection, select Pages/Plain HTML template.
  2. Update .gitlab-ci.yml file with below configuration:
review-pages:
  image: busybox
  stage: deploy
  script:
    - echo "The site will be deployed to $CI_PAGES_URL"
  pages: 
    publish: public
    expire_in: $DURATION
  variables:
    DURATION: 7d
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  1. Run New pipeline and it should succeed with having pages:deploy job.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Naman Jagdish Gala

Merge request reports

Loading