'Gitlab CI Jobs Not Using Latest Template Changes

I've written several pipeline templates that our development teams use in their projects and what I've found is that if I make a change in a template to fix a bug, when we "retry" a job it doesn't pick up the latest changes from the template. The only way the job will receive the latest reference to the template is if we push another commit to the developer's project.

Is there a flag or parameter we can set so that it always picks up the latest copy?

Here is what our gitlab yml looks like in the developer projects.

include:
  - project: 'ops/awesome-pipelines'
    file: 'pipelines/fresh_apps.yml'


Solution 1:[1]

Is there a flag or parameter we can set so that it always picks up the latest copy?

I think the functionality that you are trying is not possible.

Quoting the gitlab docs https://docs.gitlab.com/ee/ci/yaml/index.html#includefile

When the pipeline starts, the .gitlab-ci.yml file configuration included by all methods is evaluated. The configuration is a snapshot in time and persists in the database. GitLab does not reflect any changes to the referenced .gitlab-ci.yml file configuration until the next pipeline starts.

Solution 2:[2]

Template changes are only reflected in new pipelines. The benefit of this is that you can reliably retry jobs and assure that template changes won't change the behavior of a retry.

You don't necessarily need to push another commit, but you will have to start another pipeline (for example, manually running a new pipeline for a branch or MR).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tolis Gerodimos
Solution 2 sytech