Loading .gitlab-ci.yml +5 −4 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 \ Loading @@ -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 \ Loading Loading
.gitlab-ci.yml +5 −4 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 \ Loading @@ -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 \ Loading