gitlab-ci not triggering builds for a branch

I am unable to trigger the pipeline on launch branch, as expected from the below config. The interesting facts are:

  • Exactly the same config is working on a different repo as expected (i.e. the build gets triggered on push done to launch branch, and docker image is built,tagged with launch tag, and deployment upgraded with new docker image.
  • If I change the only parameter to a different branch name (e.g. k8s-stores) , then it works as expected.

Attached is my .gitlab-ci.yaml file:

stages:
  - build
  - deploy

build_staging:
  stage: build
  # when: manual
  allow_failure: false
  only:
    - launch
  image: docker:18
  services:
    - docker:dind
  script:
    - docker login -u ${CONTAINER_REGISTRY_USER} -p ${CONTAINER_REGISTRY_PASSWORD} ${CI_REGISTRY}
    - docker build -t "${CI_REGISTRY}/myorg/myorg-helm/myorg-admin:${CI_COMMIT_REF_NAME}" .
    - docker push "${CI_REGISTRY}/myorg/myorg-helm/myorg-admin:${CI_COMMIT_REF_NAME}"

deploy_staging:
  stage: deploy
  allow_failure: false
  only:
    - launch
  image: dtzar/helm-kubectl:2.16.1
  environment:
    name: do-sfo2-myorg-api-dev
  script:
    - helm list
    - helm upgrade --debug --namespace staging myorg-admin-staging ./k8s/helm/myorg-admin --values ./k8s/helm/myorg-admin/values_staging.yaml

I checked the repo and other settings in gitlab portal also, but there seems to be nothing missing there.

Edited by tapanhalani