Compare commits

..

2 commits

Author SHA1 Message Date
Neil Alexander
1f497d857f
Add news 2022-04-25 15:20:23 +01:00
Neil Alexander
3b47a279ca
Create additional labels when detecting Dendrite or Conduit homeservers in the rageshake body 2022-04-25 15:15:52 +01:00
6 changed files with 48 additions and 47 deletions

View file

@ -1,15 +0,0 @@
pipeline:
build-test:
image: golang
commands:
- go build
- go test
publish:
image: plugins/docker
settings:
username: realaravinth
password:
from_secret: DOCKER_TOKEN
repo: realaravinth/rageshake
tags: latest

View file

@ -1,23 +1,27 @@
ARG GO_VERSION=1.17
ARG DEBIAN_VERSION=11
ARG DEBIAN_VERSION_NAME=bullseye
## Build stage ##
FROM golang as builder
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:${GO_VERSION}-${DEBIAN_VERSION_NAME} AS builder
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o rageshake
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o rageshake
## Runtime stage, debug variant ##
FROM debian:bullseye as debug
COPY --from=builder /build/rageshake /rageshake/
FROM --platform=${TARGETPLATFORM} gcr.io/distroless/static-debian${DEBIAN_VERSION}:debug-nonroot AS debug
COPY --from=builder /build/rageshake /rageshake
WORKDIR /
EXPOSE 9110
ENTRYPOINT ["/rageshake/rageshake"]
ENTRYPOINT ["/rageshake"]
## Runtime stage ##
FROM debian:bullseye as rageshake
LABEL org.opencontainers.image.source https://git.batsense.net/mystiq/rageshake
RUN apt-get update && apt-get install -y ca-certificates
FROM --platform=${TARGETPLATFORM} gcr.io/distroless/static-debian${DEBIAN_VERSION}:nonroot
COPY --from=builder /build/rageshake /rageshake
WORKDIR /
COPY --from=builder /build/rageshake /rageshake/
EXPOSE 9110
ENTRYPOINT ["/rageshake/rageshake"]
ENTRYPOINT ["/rageshake"]

View file

@ -1,4 +1,3 @@
WOODPECKER: [![status-badge](https://ci.batsense.net/api/badges/mystiq/rageshake/status.svg)](https://ci.batsense.net/mystiq/rageshake)
# rageshake [![Build status](https://badge.buildkite.com/76a4362a20b12dcd589f9308a905ffcc537278b9c363c0b5f1.svg?branch=master)](https://buildkite.com/matrix-dot-org/rageshake)
Web service which collects and serves bug reports.

1
changelog.d/55.feature Normal file
View file

@ -0,0 +1 @@
Add Dendrite and Conduit labels when detected in the `server_version` field of the rageshake payload

BIN
rageshake

Binary file not shown.

View file

@ -695,14 +695,30 @@ func buildGenericIssueRequest(p payload, listingURL string) (title, body string)
return
}
func getAdditionalLabels(p payload) []string {
labels := []string{}
if serverVersion, ok := p.Data["server_version"]; ok {
// TODO: It seems only Element Android sends server_version right now and
// that Element iOS doesn't, so we should do something about that.
switch {
case strings.Contains(serverVersion, "Dendrite"):
labels = append(labels, "Dendrite")
case strings.Contains(serverVersion, "Conduit"):
labels = append(labels, "Conduit")
}
}
return labels
}
func buildGithubIssueRequest(p payload, listingURL string) github.IssueRequest {
title, body := buildGenericIssueRequest(p, listingURL)
labels := p.Labels
labels := append(p.Labels, getAdditionalLabels(p)...)
// go-github doesn't like nils
if labels == nil {
labels = []string{}
}
return github.IssueRequest{
Title: &title,
Body: &body,
@ -713,15 +729,11 @@ func buildGithubIssueRequest(p payload, listingURL string) github.IssueRequest {
func buildGitlabIssueRequest(p payload, listingURL string, labels []string, confidential bool) *gitlab.CreateIssueOptions {
title, body := buildGenericIssueRequest(p, listingURL)
if p.Labels != nil {
labels = append(labels, p.Labels...)
}
return &gitlab.CreateIssueOptions{
Title: &title,
Description: &body,
Confidential: &confidential,
Labels: labels,
Labels: append(p.Labels, getAdditionalLabels(p)...),
}
}