How to run a pipeline using specific tag in gitlab-ci

When my pipeline fails then i want to trigger certain jobs that will be created with the latest tag.
does something like only: refs: tags=$latest_tag works?