workflow: rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_PROJECT_ID == $CI_MERGE_REQUEST_PROJECT_ID' variables: PIPELINE_TYPE: 'internal' - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_PROJECT_ID != $CI_MERGE_REQUEST_PROJECT_ID' variables: PIPELINE_TYPE: 'external' check-access: image: alpine:latest script: - | if [ "${PIPELINE_TYPE}" = 'external' ]; then >&2 cat << EOF The user that initiated this pipeline does not have permissions to execute code within the Red Hat intranet. Please ask the package maintainer or another Red Hat employee to trigger the pipeline for you by clicking on the "Run pipeline" button on the "Pipelines" tab of the merge request. EOF exit 1 else exit 0 fi rules: - if: '$PIPELINE_TYPE == "external"' check-gitbz: image: quay.io/rhn-engineering-sgallagh/check_gitbz_experiments:latest tags: - redhat - gitbz script: - | echo "Checking for locked branch" if [[ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" == "c10s" ]] ; then echo -e "\e[41mThe c10s development is not yet open!\e[0m" echo "Please wait for the announcement and run a new pipeline once the development is active." exit 1 fi - | echo "Checking commits for approved ticket references" exit_code=0 /usr/local/bin/check_gitbz || exit_code=$? if [ $exit_code -eq 0 ]; then echo -e "\e[0;102mThis change is approved for merging\e[0m" elif [ $exit_code -eq 77 ]; then echo -e "\e[0;103mThis change is being allowed without approval during the active development phase\e[0m" else echo -e "\e[41mThis change does not have the requisite ticket approvals. See above for details\e[0m" fi - exit $exit_code allow_failure: exit_codes: - 77 artifacts: paths: - "debug.log" when: always expire_in: 1 week rules: - if: '$PIPELINE_TYPE == "internal"'