harness / gitness

Gitness is an Open Source developer platform with Source Control management, Continuous Integration and Continuous Delivery.
https://gitness.com
Apache License 2.0
32.09k stars 2.8k forks source link

Pipelines are not being triggered when gitness is deployed behind reverse proxy #3395

Closed MarioGK-AutoSystem closed 10 months ago

MarioGK-AutoSystem commented 11 months ago

Hello, i started moving away all my repositories from github and github actions to gitness.

I have a VPS running gitness inside a docker container using the following docker compose file:

version: '3.3'
services:
  gitness:
    ports:
      - '3000:3000'
    volumes:
      - '/var/run/docker.sock:/var/run/docker.sock'
      - './data:/data'
    container_name: gitness
    restart: always
    image: harness/gitness
    environment:
      GITNESS_USER_SIGNUP_ENABLED: false
      GITNESS_NESTED_SPACES_ENABLED: true
      GITNESS_URL_BASE: https://$DOMAIN
      GITNESS_URL_GIT: https://$DOMAIN/git
      GITNESS_URL_API: https://$DOMAIN/api
      GITNESS_URL_UI: https://$DOMAIN
      GITNESS_HTTP_PROTO: https
      GITNESS_CI_PARALLEL_WORKERS: 4

OBS: replaced my actual domain name with $DOMAIN

The gitnes is being served behind a caddy reverse proxy:

$DOMAIN {
        reverse_proxy localhost:3000
}

The pipeline:

version: 1
kind: pipeline
spec:
  stages:
    - name: build
      type: ci
      spec:
        steps:
          - name: build
            type: run
            spec:
              container: mcr.microsoft.com/dotnet/sdk:8.0
              envs:
                SLEET_FEED_CONNECTIONSTRING: ${{secrets.get("SLEET_FEED_CONNECTIONSTRING")}}
                SLEET_FEED_CONTAINER: ${{secrets.get("SLEET_FEED_CONTAINER")}}
                SLEET_FEED_TYPE: ${{secrets.get("SLEET_FEED_TYPE")}}
              script: |-
                dotnet nuget add source https://$DOMAIN/sleet/index.json --name sleet
                dotnet tool install -g sleet
                export PATH="$PATH:/root/.dotnet/tools"
                export NUGET_VERSION=$(date --utc '+%Y.%m.%d.%H%M' | sed 's/\.\(0*\)/./g')
                echo $NUGET_VERSION
                dotnet pack ./src/AutoSystem.Devops/AutoSystem.Devops.csproj -p:PackageVersion=$NUGET_VERSION -o ./nuget
                sleet push ./nuget --skip-existing

Using the UI, API, cloning projects and running pipelines manually are all working correctly, but when i commit something the pipelines are not being triggered, am i missing a configuration about webhooks or something?

johannesHarness commented 11 months ago

Hey @MarioGK-AutoSystem, it's great to hear you are moving your repos to Gitness!!

The pipeline you are talking about, did you create a trigger that reacts on Branch Updated events? The default trigger only handles pullreq_XXX related events.

You can find a pipeline's triggers under pipeline / Pipeline Settings / Triggers:

image

In case you already did that, there are few more things to check:

MarioGK-AutoSystem commented 10 months ago

Hey @MarioGK-AutoSystem, it's great to hear you are moving your repos to Gitness!!

The pipeline you are talking about, did you create a trigger that reacts on Branch Updated events? The default trigger only handles pullreq_XXX related events.

You can find a pipeline's triggers under pipeline / Pipeline Settings / Triggers:

image

In case you already did that, there are few more things to check:

  • does the pipeline exist on the branch you are committing to?
  • if you create a webhook, is it being triggered on a commit?

Yeah you are correct, the events were not selected by default i had to select them, thanks for the help and sorry for the delay, it would be great to change this setting with enviroment variables or a config file though