title: Gitlab CI pipeline - continue to next stage only on a certain condition
body: <p>I am trying to build a Gitlab pipeline that is made up of 4 jobs. The stages I have are:</p>
  
  <pre><code>stages:
  - compare
  - build
  - test
  - deploy
  </code></pre>
  
  <p>The compare stage is taking a dump from an API on another server, comparing it to the same dump from the last successful pipeline run (it's made available as an artifact) then comparing the two.
  If there is any difference I would like the pipeline to move onto the next stage, if there is no difference then I would like it to exit gracefully. </p>
  
  <p>I have it working but rather than exiting gracefully if there are no differences it fails and the pipeline is marked as failed, here is how it looks.</p>
  
  <p><a href="https://i.stack.imgur.com/KoiSm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KoiSm.png" alt="enter image description here"></a></p>
  
  <p>Here is the important code from my .gitlab-ci.yaml (with some identifying information removed )</p>
  
  <pre><code>Get_inventory_dump:
    stage: compare  
    only:
      - schedules
    script: 
      - 'curl -k --output "previous-inventory.json" --header "PRIVATE-TOKEN: $user_token" "https://url/to/get/artifact/from/last/successful/run"'
      - python3 auto_config_scripts/dump_device_inventory_api_to_json.py -p $pass -o /inventory.json -u https://url/for/inventory/dump -y
      - /usr/bin/cmp previous-inventory.json inventory.json &amp;&amp; echo "No Change in inventory since last successful run" &amp;&amp; exit 1 || echo "Inventory has changed since last run, continue" &amp;&amp; exit 0
    artifacts:
      when: on_success
      expire_in: 4 weeks
      paths:
       - inventory.json
  
  Generate_icinga_config:
    stage: build
    only:
      - schedules
    when: on_success
    script: 
  </code></pre>
  
  <p>Everything is behaving as I would expect but I feel like there is a better way to do this. </p>
  
  <p>Is there a way, if the comparison is the same to simply skip the next stages of the pipeline but still have the pipeline completed as 'passed' rather than 'failed'?</p>