Skip to content

Gitlab CI Cloud runner fails while local runner doesn't

Summary

Gitlab CI Cloud and local runners environments are not identical. Executing the same .gitlab-ci.yml CI definition produces different results depending on the type of runner used.

Steps to reproduce

build:
  image: centos:7
  script:
    # GIVEN
    - yum install -y git make gcc bison flex
    - mkdir /tmp/build
    - cd /tmp/build
    - git clone --depth 1 --no-single-branch https://github.com/kamailio/kamailio kamailio
    - cd kamailio
    - git checkout -b 5.1 origin/5.1
    # IF
    # 1. Doing meaningless substitution in the source files to create dependency on the custom variable MY_CUSTOM_FLAG
    - sed -i 's/if(unlikely(log_prefix_val/if(unlikely(MY_CUSTOM_FLAG/g' src/core/dprint.h
    # 2. Generating build config files
    - make Q=0 cfg PREFIX=/usr/local LOCALBASE=/usr/local cfg_prefix=/tmp doc_prefix=/tmp modules_dirs=modules group_include=standard 'include_modules=inesrp inkeepalive sanity json sctp htable avpops uac uac_redirect rtimer dialog tls' 'skip_modules=stun sipt rtpproxy auth_diameter msrp qos seas siptrace sipcapture xhttp xhttp_rpc acc_diameter call_control mediaproxy topoh topos nat_traversal sms smsops jsonrpcs ss7ops ctl dmq dmq_usrloc mqueue rtpengine malloc_test mangler nosip blst app_sqlang app_jsdt auth_xkeys cfg_rpc sca sctp evrexec exec sdpops sipdump nathelper path pike'
    # 3. Since MY_CUSTOM_FLAG variable is custom and is not set by default, injecting it into src/Makefile.defs
    - sed -i 's/C_DEFS=.*/&\n\o011 -DMY_CUSTOM_FLAG \\/' src/Makefile.defs
    - echo "============================================================="
    - cat src/Makefile.defs
    - echo "============================================================="
    # THEN - should succeed
    - make Q=0

Example Project

https://gitlab.com/ivan.ribakov/poc

Local build that is passing: https://gitlab.com/ivan.ribakov/poc/-/jobs/413233091

Note presence of -DMY_CUSTOM_FLAG in the gcc calls

Cloud build that is failing: https://gitlab.com/ivan.ribakov/poc/-/jobs/413214295

Note lack of -DMY_CUSTOM_FLAG in the gcc calls

What is the current bug behavior?

When running .gitlab-ci.yml configuration of the example project in the cloud runner, build fails. It succeeds when running in the local runner

What is the expected correct behavior?

Expecting to see identical behaviour irrespective of the CI runner used (it should either succeed or fail in both environments)

Output of checks

This bug happens on GitLab.com