Commit f63b1462 authored by sagnowski's avatar sagnowski
Browse files

Add instructions

parent c61dc1ff
Loading
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -406,17 +406,35 @@ clang-format-check:
    - .rules-merge-request
  variables:
    ARTIFACT_NAME: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--formatting-fix.patch"
    INSTRUCTIONS_GITLAB: "To fix formatting issues:\n
      - download the diff patch available as artifact of this job\n
      - unzip the artifact and place the patch file in the root directory of your local IVAS repo\n
      - run: git apply $ARTIFACT_NAME
      - commit new changes"
    INSTRUCTIONS_README: "To fix formatting issues:\n
      - place the patch file in the root directory of your local IVAS repo\n
      - run: git apply $ARTIFACT_NAME
      - commit new changes"
  stage: validate
  needs: []
  timeout: "5 minutes"
  script:
    - scripts/check-format.sh -af -p 8 || format_problems=$?
    - if [ $format_problems == 0 ] ; then exit 0; fi
    - git diff > formatting-fix.patch

    - mkdir tmp-formatting
    - git diff > "tmp-formatting/$ARTIFACT_NAME"

    # Print instructions to job output
    - echo $INSTRUCTIONS_GITLAB

    # Include readme in the artifact, in case someone misses the job printout (e.g. getting the artifact via MR interface)
    - echo $INSTRUCTIONS_README > "tmp-formatting/readme.txt"

    - exit $format_problems
  artifacts:
    paths:
      - formatting-fix.patch
      - tmp-formatting/
    when: on_failure
    name: $ARTIFACT_NAME
    expose_as: 'formatting patch'