Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/build-push-cauldron-github-consumer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: GitHub Consumer (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-github-consumer:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-github-consumer:latest
ghcr.io/${{ github.repository }}/cauldron-github-consumer:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: GitHub Group Consumer (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-github-consumer-group:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-github-consumer-group:latest
ghcr.io/${{ github.repository }}/cauldron-github-consumer-group:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
9 changes: 8 additions & 1 deletion .github/workflows/build-push-cauldron-gitlab-consumer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: GitLab Consumer (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-gitlab-consumer:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-gitlab-consumer:latest
ghcr.io/${{ github.repository }}/cauldron-gitlab-consumer:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: GitLab Group Consumer (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-gitlab-consumer-group:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-gitlab-consumer-group:latest
ghcr.io/${{ github.repository }}/cauldron-gitlab-consumer-group:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
9 changes: 8 additions & 1 deletion .github/workflows/build-push-cauldron-migrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Migrator (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-migrator:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-migrator:latest
ghcr.io/${{ github.repository }}/cauldron-migrator:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
9 changes: 8 additions & 1 deletion .github/workflows/build-push-cauldron-webhookserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Cauldron (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-webhook-server:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-webhook-server:latest
ghcr.io/${{ github.repository }}/cauldron-webhook-server:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
9 changes: 8 additions & 1 deletion .github/workflows/stg-cauldron-github-consumer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Staging - GitHub Consumer (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-stg-github-consumer:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-stg-github-consumer:latest
ghcr.io/${{ github.repository }}/cauldron-stg-github-consumer:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
9 changes: 8 additions & 1 deletion .github/workflows/stg-cauldron-github-group-consumer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Staging - GitHub Group Consumer (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-stg-github-consumer-group:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-stg-github-consumer-group:latest
ghcr.io/${{ github.repository }}/cauldron-stg-github-consumer-group:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
9 changes: 8 additions & 1 deletion .github/workflows/stg-cauldron-gitlab-consumer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Staging - GitLab Consumer (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-stg-gitlab-consumer:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-stg-gitlab-consumer:latest
ghcr.io/${{ github.repository }}/cauldron-stg-gitlab-consumer:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
9 changes: 8 additions & 1 deletion .github/workflows/stg-cauldron-gitlab-group-consumer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Staging - GitLab Group Consumer (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-stg-gitlab-consumer-group:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-stg-gitlab-consumer-group:latest
ghcr.io/${{ github.repository }}/cauldron-stg-gitlab-consumer-group:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
9 changes: 8 additions & 1 deletion .github/workflows/stg-cauldron-migrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Staging - Migrator (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-stg-migrator:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-stg-migrator:latest
ghcr.io/${{ github.repository }}/cauldron-stg-migrator:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
9 changes: 8 additions & 1 deletion .github/workflows/stg-cauldron-webhookserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Staging - Cauldron (build-push)

on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to build (e.g. v1.2.3)'
required: false
type: string

jobs:
build-image:
Expand All @@ -28,6 +33,8 @@ jobs:
platforms: linux/amd64
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/cauldron-stg-webhook-server:latest
tags: |
ghcr.io/${{ github.repository }}/cauldron-stg-webhook-server:latest
ghcr.io/${{ github.repository }}/cauldron-stg-webhook-server:${{ inputs.tag || github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ linters:
- utils
- tools
- models
- name: nested-structs
disabled: true

Comment on lines +143 to 144
formatters:
enable:
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.25.5

require (
github.com/IBM/sarama v1.47.0
github.com/buger/jsonparser v1.1.1
github.com/golang-migrate/migrate/v4 v4.19.1
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v5 v5.8.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=
github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI=
github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M=
github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"log/slog"
"strconv"
"strings"

"github.com/IBM/sarama"
"github.com/buger/jsonparser"
"github.com/devchain-network/cauldron/internal/cerrors"
"github.com/devchain-network/cauldron/internal/kafkacp"
"github.com/devchain-network/cauldron/internal/transport/http/httphandler"
Expand Down Expand Up @@ -108,16 +108,31 @@ func (h Handler) Handle(ctx *fasthttp.RequestCtx) {
return
}

senderLogin, err := jsonparser.GetString(ctx.PostBody(), "sender", "login")
if err != nil {
h.Logger.Error("senderLogin jsonparser.GetString error", "error", err)
var payload struct {
Sender struct {
Login string `json:"login"`
ID int64 `json:"id"`
} `json:"sender"`
}

if err := json.Unmarshal(ctx.PostBody(), &payload); err != nil {
h.Logger.Error("json.Unmarshal error", "error", err)
ctx.SetStatusCode(fasthttp.StatusBadRequest)

return
}

senderLogin := payload.Sender.Login
if senderLogin == "" {
h.Logger.Error("sender login not found in payload")
ctx.SetStatusCode(fasthttp.StatusBadRequest)

return
}
senderID, err := jsonparser.GetInt(ctx.PostBody(), "sender", "id")
if err != nil {
h.Logger.Error("senderID jsonparser.GetInt error", "error", err)

senderID := payload.Sender.ID
if senderID == 0 {
h.Logger.Error("sender id not found in payload")
ctx.SetStatusCode(fasthttp.StatusBadRequest)

return
Expand Down
Loading
Loading