Pipeline not executed after commit

Hi everyone,

I have a gitlab instance who is self-hosted on a Cent-OS 7 VM.
I have also created a repository and a docker runner configured on the same machine.

I have created a pipeline but the problem is that when I push my local changes to the gitlab repository, the pipeline isn’t executed.
The only way the pipeline is executed is when i commit from the pipeline editor in Gitlab.

I have tried several solutions, such as creating a rule to execute the pipeline if there is a commit but that doesn’t change anything.
I should point out that the problem occurs even with a simple basic pipeline, so i’dont think the pipeline is the problem.
At this stage, i have no idea why this is happening. Am i missing something ?

This is my .gitlab-ci.yml :

    - build
    - deploy
    stage: build
    # Use the official docker image
    image: docker:stable
      # Use docker-dind let the gitlab-runner to execute his own docker command (and then isolate it from host)
      - name: docker:20-dind
        alias: docker
        command: [ "--tls=false" ]
      # Docker runner configuration (include host address, driver and not need of TLS)
      DOCKER_HOST       : tcp://docker:2375
      DOCKER_DRIVER     : overlay2
      # Name of the Gitlab project (use for name of docker image)
      # ID of CI/CD Gitlab Job (use for tag of docker image)
      # docker login to Artifactory
      - docker login -u $JFROG_USER -p $JFROG_PASS $JFROG_REPO
      # docker build image with tag <image:tag>
      - DOCKER_BUILDKIT=1 docker build --pull -t $PROJECT_NAME:$PROJECT_TAG /builds/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME/docker-image/
      - cd /usr/local/bin/
      # docker tag image : <image:tag> <JFROG_REPO/image:tag>
      # Docker push : <JFROG_REPO/image:tag>
      - echo "LOG -> docker push $JFROG_REPO/$PROJECT_NAME:$PROJECT_TAG"
      - exists:
    stage: deploy

      name: alpine/helm:latest
      entrypoint: [""] 
      # Kubernetes cluster configuration variables
      K8_CLUSTER  : dev-cluster-bcu
      K8_USER     : dev-cluster-bcu
      K8_TOKEN    : [MY_TOKEN]
      K8_NAMESPACE: kube-bs
      K8_CONTEXT  : kube-bs
      # Name of the Gitlab project (use for name of docker image)
      # ID of CI/CD Gitlab Job (use for tag of docker image)
      # Install docker
      - apk add --no-cache docker
      # Install kubectl
      - curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
      - chmod +x ./kubectl
      - mv ./kubectl /usr/bin/kubectl
      # Docker login to Container Registry (Artifactory)
      - docker login -u $JFROG_USER -p $JFROG_PASS $JFROG_REPO
      # Kubernetes cluster login (Rancher)
      # Config cluster, credential, contexte
      - kubectl config set-cluster $K8_CLUSTER --insecure-skip-tls-verify=true --server=$K8_SERVER
      - kubectl config set-credentials $K8_USER --token=$K8_TOKEN 
      - kubectl config set-context $K8_CONTEXT --cluster=$K8_CLUSTER --user=$K8_USER --namespace=$K8_NAMESPACE
      - kubectl config use-context $K8_CONTEXT
      # Upgrade Helm Chart with image from CR
      - cd /builds/$CI_PROJECT_NAMESPACE/$PROJECT_NAME/kubernet-chart/Helm
      - echo "LOG -> helm upgrade --install $PROJECT_NAME $PROJECT_NAME --set container.image=$JFROG_REPO/$PROJECT_NAME,container.tag=$PROJECT_TAG"
      - helm upgrade --install $PROJECT_NAME $PROJECT_NAME --set container.image=$JFROG_REPO/$PROJECT_NAME,container.tag=$PROJECT_TAG
      - exists:


Hi @dcanton

By “commit to the repository” you mean you push your local changes to GitLab, right?

Hi @balonik ,

Yes, exactly, I meant “when I push my local changes to the gitlab repository”.

@dcanton Whats the version of the GitLab and Runner please?

Gitlab version is GitLab Community Edition 14.9.3
And gitlab-runner is : 15.10.0

Officially, different major versions between GitLab and Runner are not supported. Even if it works most of the time.

I remember a long time ago there were some reports that pipeline were not starting when pushed to Gitlab and only when the commit was coming from the WebIDE editor. Your version of Gitlab is quite old, hard to investigate possible issues.

I suppose you see the commits in the project under Repository → Commits and they don’t have the Pipeline icon next to short SHA. This is usually when there are no valid Jobs according to rules or workflow.

Probably unrelated, but the rules in the provided .gitlab-ci.yml are set that unless you have a file in your repository which matches the value of $CI_COMMIT_REF_NAME those jobs won’t get executed ever (because exists is looking for a file). If you want to check if variable is present you just need to do:

    - if: "$CI_COMMIT_REF_NAME"

Is the issue visible even if you have something really simple like?

  - test

  stage: test
  - echo "hello"

Yes, I see all the commits in the project but they don’t have the pipeline icon.

First I tried to run a basic pipeline but the problem is the same, then I tried with rules, and in my last attempt I added the rules in order to check if there is a commit.
But it seems to me that even if you create a pipeline without any rules, the default behavior is to be executed every time, isn’t it?

Indeed, I realize that the Gitlab and runner versions are quite far apart, so I’m going to try to align the 2 versions.