Compare commits
2 commits
master
...
neilalexan
Author | SHA1 | Date | |
---|---|---|---|
1f497d857f | |||
3b47a279ca |
|
@ -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
|
|
24
Dockerfile
24
Dockerfile
|
@ -1,23 +1,27 @@
|
||||||
|
ARG GO_VERSION=1.17
|
||||||
|
ARG DEBIAN_VERSION=11
|
||||||
|
ARG DEBIAN_VERSION_NAME=bullseye
|
||||||
|
|
||||||
## Build stage ##
|
## Build stage ##
|
||||||
FROM golang as builder
|
FROM --platform=${BUILDPLATFORM} docker.io/library/golang:${GO_VERSION}-${DEBIAN_VERSION_NAME} AS builder
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN go build -o rageshake
|
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o rageshake
|
||||||
|
|
||||||
## Runtime stage, debug variant ##
|
## Runtime stage, debug variant ##
|
||||||
FROM debian:bullseye as debug
|
FROM --platform=${TARGETPLATFORM} gcr.io/distroless/static-debian${DEBIAN_VERSION}:debug-nonroot AS debug
|
||||||
COPY --from=builder /build/rageshake /rageshake/
|
COPY --from=builder /build/rageshake /rageshake
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
EXPOSE 9110
|
EXPOSE 9110
|
||||||
ENTRYPOINT ["/rageshake/rageshake"]
|
ENTRYPOINT ["/rageshake"]
|
||||||
|
|
||||||
## Runtime stage ##
|
## Runtime stage ##
|
||||||
FROM debian:bullseye as rageshake
|
FROM --platform=${TARGETPLATFORM} gcr.io/distroless/static-debian${DEBIAN_VERSION}:nonroot
|
||||||
LABEL org.opencontainers.image.source https://git.batsense.net/mystiq/rageshake
|
COPY --from=builder /build/rageshake /rageshake
|
||||||
RUN apt-get update && apt-get install -y ca-certificates
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
COPY --from=builder /build/rageshake /rageshake/
|
|
||||||
EXPOSE 9110
|
EXPOSE 9110
|
||||||
ENTRYPOINT ["/rageshake/rageshake"]
|
ENTRYPOINT ["/rageshake"]
|
||||||
|
|
|
@ -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)
|
# 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.
|
Web service which collects and serves bug reports.
|
||||||
|
|
1
changelog.d/55.feature
Normal file
1
changelog.d/55.feature
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Add Dendrite and Conduit labels when detected in the `server_version` field of the rageshake payload
|
54
submit.go
54
submit.go
|
@ -81,31 +81,31 @@ type jsonLogEntry struct {
|
||||||
type genericWebhookPayload struct {
|
type genericWebhookPayload struct {
|
||||||
payload
|
payload
|
||||||
// If a github/gitlab report is generated, this is set.
|
// If a github/gitlab report is generated, this is set.
|
||||||
ReportURL string `json:"report_url"`
|
ReportURL string `json:"report_url"`
|
||||||
// Complete link to the listing URL that contains all uploaded logs
|
// Complete link to the listing URL that contains all uploaded logs
|
||||||
ListingURL string `json:"listing_url"`
|
ListingURL string `json:"listing_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stores information about a request made to this server
|
// Stores information about a request made to this server
|
||||||
type payload struct {
|
type payload struct {
|
||||||
// A unique ID for this payload, generated within this server
|
// A unique ID for this payload, generated within this server
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
// A multi-line string containing the user description of the fault.
|
// A multi-line string containing the user description of the fault.
|
||||||
UserText string `json:"user_text"`
|
UserText string `json:"user_text"`
|
||||||
// A short slug to identify the app making the report
|
// A short slug to identify the app making the report
|
||||||
AppName string `json:"app"`
|
AppName string `json:"app"`
|
||||||
// Arbitrary data to annotate the report
|
// Arbitrary data to annotate the report
|
||||||
Data map[string]string `json:"data"`
|
Data map[string]string `json:"data"`
|
||||||
// Short labels to group reports
|
// Short labels to group reports
|
||||||
Labels []string `json:"labels"`
|
Labels []string `json:"labels"`
|
||||||
// A list of names of logs recognised by the server
|
// A list of names of logs recognised by the server
|
||||||
Logs []string `json:"logs"`
|
Logs []string `json:"logs"`
|
||||||
// Set if there are log parsing errors
|
// Set if there are log parsing errors
|
||||||
LogErrors []string `json:"logErrors"`
|
LogErrors []string `json:"logErrors"`
|
||||||
// A list of other files (not logs) uploaded as part of the rageshake
|
// A list of other files (not logs) uploaded as part of the rageshake
|
||||||
Files []string `json:"files"`
|
Files []string `json:"files"`
|
||||||
// Set if there are file parsing errors
|
// Set if there are file parsing errors
|
||||||
FileErrors []string `json:"fileErrors"`
|
FileErrors []string `json:"fileErrors"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p payload) WriteTo(out io.Writer) {
|
func (p payload) WriteTo(out io.Writer) {
|
||||||
|
@ -539,9 +539,9 @@ func (s *submitServer) submitGenericWebhook(p payload, listingURL string, report
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
genericHookPayload := genericWebhookPayload{
|
genericHookPayload := genericWebhookPayload{
|
||||||
payload: p,
|
payload: p,
|
||||||
ReportURL: reportURL,
|
ReportURL: reportURL,
|
||||||
ListingURL: listingURL,
|
ListingURL: listingURL,
|
||||||
}
|
}
|
||||||
for _, url := range s.cfg.GenericWebhookURLs {
|
for _, url := range s.cfg.GenericWebhookURLs {
|
||||||
// Enrich the payload with a reportURL and listingURL, to convert a single struct
|
// Enrich the payload with a reportURL and listingURL, to convert a single struct
|
||||||
|
@ -695,14 +695,30 @@ func buildGenericIssueRequest(p payload, listingURL string) (title, body string)
|
||||||
return
|
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 {
|
func buildGithubIssueRequest(p payload, listingURL string) github.IssueRequest {
|
||||||
title, body := buildGenericIssueRequest(p, listingURL)
|
title, body := buildGenericIssueRequest(p, listingURL)
|
||||||
|
|
||||||
labels := p.Labels
|
labels := append(p.Labels, getAdditionalLabels(p)...)
|
||||||
// go-github doesn't like nils
|
// go-github doesn't like nils
|
||||||
if labels == nil {
|
if labels == nil {
|
||||||
labels = []string{}
|
labels = []string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return github.IssueRequest{
|
return github.IssueRequest{
|
||||||
Title: &title,
|
Title: &title,
|
||||||
Body: &body,
|
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 {
|
func buildGitlabIssueRequest(p payload, listingURL string, labels []string, confidential bool) *gitlab.CreateIssueOptions {
|
||||||
title, body := buildGenericIssueRequest(p, listingURL)
|
title, body := buildGenericIssueRequest(p, listingURL)
|
||||||
|
|
||||||
if p.Labels != nil {
|
|
||||||
labels = append(labels, p.Labels...)
|
|
||||||
}
|
|
||||||
|
|
||||||
return &gitlab.CreateIssueOptions{
|
return &gitlab.CreateIssueOptions{
|
||||||
Title: &title,
|
Title: &title,
|
||||||
Description: &body,
|
Description: &body,
|
||||||
Confidential: &confidential,
|
Confidential: &confidential,
|
||||||
Labels: labels,
|
Labels: append(p.Labels, getAdditionalLabels(p)...),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue