Commit f776cd8b authored by Jan Kiene's avatar Jan Kiene
Browse files

pass ref as part of URL

parent 4285df3f
Loading
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ check-merged-ci-config-is-valid:

    # get the "baseline" yaml for comparison. this is always the thing we have on the MR target branch (usually main)
    - git checkout $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
    - target_sha=$(git rev-parse HEAD)
    - base_yml="base-$CI_MERGE_REQUEST_TARGET_BRANCH_NAME-ci.yml"
    # patch the yaml file to include the stuff we have locally in this branch
    - cp $test_yml $base_yml
@@ -52,9 +53,9 @@ check-merged-ci-config-is-valid:
    - cat $base_yml
    # lint patched yaml
    - |
      jq -n --arg yaml "$(<$base_yml)" --arg ref "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" '{ content: $yaml, ref: $ref }' \
      jq -n --arg yaml "$(<$base_yml)" '{ content: $yaml }' \
      | curl -sS -X POST \
             --url "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/ci/lint?include_merged_yaml=true" \
             --url "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/ci/lint?include_merged_yaml=true&ref=${target_sha}" \
             -H "Content-Type: application/json" \
             -H "PRIVATE-TOKEN: $CI_LINT_TOKEN" \
             --output $BASELINE_RESPONSE \
@@ -71,9 +72,9 @@ check-merged-ci-config-is-valid:

    # lint patched yaml
    - |
      jq -n --arg yaml "$(<$test_yml)" --arg ref "$CI_COMMIT_REF_NAME" '{ content: $yaml, ref: $ref }' \
      jq -n --arg yaml "$(<$test_yml)" '{ content: $yaml }' \
      | curl -sS -X POST \
             --url "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/ci/lint?include_merged_yaml=true" \
             --url "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/ci/lint?include_merged_yaml=true&ref=${CI_COMMIT_SHA}" \
             -H "Content-Type: application/json" \
             -H "PRIVATE-TOKEN: $CI_LINT_TOKEN" \
             --output $MERGED_RESPONSE \