Gitlab CI fails with 0 jobs only on coworker's branches

I have a Gitlab CI script that only builds the application. I have 4 job when 3 of them should only be executed on the main branch.

Everytime my coworker’s pushes a commit, it fails the pipeline with the following message:

0 jobs for branchname
bug_gitlabci_0job

But when I push my commits on any branch or when I merge my coworker’s branch on main, the CI works perfectly.

I tried to look at my coworker’s gitlab CI file and it seems OK.That version of the file has worked before. Gitlab tells me it’s a valid YAML file when I open it. I’ll copy paste it below. The only job that should be running is build_service_32.

stages:
  - build

build_daemon_64:
  stage: build
  tags:
    - linux
  only:
    - main
  image: gcc
  before_script:
    - apt-get update -qq
    - apt-get install -y build-essential
    - apt-get install -y cmake
    - apt-get install -y libxtst-dev
  script:
    - cd daemon
    - ./build.sh    
  artifacts:
    paths:
      - daemon/cvpd    

build_daemon_32:
  stage: build
  tags:
    - linux
  only:
    - main
  image: i386/ubuntu
  before_script:
    - apt-get update -qq
    - apt-get install -y build-essential
    - apt-get install -y cmake
    - apt-get install -y libxtst-dev
  script:
    - cd daemon
    - ./build.sh
  artifacts:
    paths:
      - daemon/cvpd

build_service_32:
  stage: build
  before_script:
    - apt-get update -qq
    - apt-get install -y build-essential
    - apt-get install -y cmake  
    - apt-get install -y mingw-w64
  image: mmozeiko/mingw-w64
  script:
    - cd service
    - chmod +x build_win32.sh
    - ./build_win32.sh
  artifacts:
    paths:
      - service/_build/win32/src/cvps.exe
#SOURCES: https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/
#         https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Android.gitlab-ci.yml
build_app:
  stage: build
  variables:
    ANDROID_COMPILE_SDK: "22"
    ANDROID_BUILD_TOOLS: "22.0.1"
    ANDROID_SDK_TOOLS:   "7583922_latest"
  image: openjdk:11
  only:
    - main
  cache:
    key: ${CI_PROJECT_ID}
    paths:
      - .gradle/
  before_script:
    - apt-get update -qq
    - apt-get install -y wget tar unzip lib32stdc++6 lib32z1
    - export ANDROID_HOME=$PWD/android-sdk-linux
    - export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
    - wget --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}.zip
    - mkdir -p android-sdk-linux/cmdline-tools
    - unzip -d android-sdk-linux/cmdline-tools android-sdk.zip
    - mv android-sdk-linux/cmdline-tools/cmdline-tools android-sdk-linux/cmdline-tools/latest
    - echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}"
    - echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "platform-tools" 
    - echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" 
    # temporarily disable checking for EPIPE error and use yes to accept all licenses
    - set +o pipefail
    - yes | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager --licenses
    - set -o pipefail
    - export GRADLE_USER_HOME=$(pwd)/app/.gradle
    - chmod +x ./app/gradlew
  script:
    - cd app
    - ./gradlew assembleDebug
  artifacts:
    paths:
      - app/app/build/outputs/apk/debug/
2 Likes

we are facing the same issue

I have the same issue. Did you find any solution?