GitLab CI - running a task automatically only on scheduled pipelines

Solution 1:

You can set allow_failure conditionally using rules:. So, instead of setting the allow_faulure: key on the job, set it in any rule that causes the job to be 'manual'.

  rules:
    - changes:
      - scheduled
      when: always
    - when: manual
      allow_failure: true

Also, based on your description it would probably be best to use a rule like so:

myjob:
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"
      when: always
      allow_failure: false
    - when: manual
      allow_failure: true

Another alternative to prevent your pipeline being blocked by this job would be to have it run in the .post stage and use needs: [] to have it run immediately. That way, it'll never cause other jobs to wait on it.

myjob:
  needs: []
  stage: .post
  # ...