How to trigger a job when tag is pushed to remote?

Hi there,

Say I have a perf test job, and I wanted to run this job manually when a new tag is pushed to remote.

Below is my full file and I have perf_manual_job for the tag.

No matter I use if: '$CI_PIPELINE_SOURCE == "push"' or only: - tags, the pipeline is not triggered at all.

And if I choose tu run the pipeline for the git tag, it throws:
Pipeline filtered out by workflow rules.

I tried normal push, it seems working.

So could someone help? The goal is to trigger either a manual job or auto job when a git tag is pushed to master.

My full yaml is like:

stages:
  - build
  - test
  - perf_test


build-job:
  stage: build
  script:
    - echo "Hello, $GITLAB_USER_LOGIN!"

test_job:
  stage: test
  script:
    - echo "This job tests something"
  only:
    - merge_requests


perf_test_mr_job:
  stage: perf_test
  needs: [test_job]
  allow_failure: true
  rules:
      - if: '$CI_MERGE_REQUEST_LABELS =~ /perf_test/'
  script:
    - echo $CI_MERGE_REQUEST_LABELS
    - echo "perf test for MR"
    - sleep 20

perf_manual_job:
  stage: perf_test
  allow_failure: true
  only:
    - tags
  script:
    - echo CI_COMMIT_TAG
    - echo "perf manual job"
    - sleep 5

perf_trigger_job:
  stage: perf_test
  allow_failure: true
  rules:
    - if: $CI_PIPELINE_TRIGGERED
  script:
    - echo $CI_PIPELINE_SOURCE
    - echo "triggered job."
    - sleep 10