raider_reporter 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -1
- data/lib/raider_reporter/version.rb +1 -1
- data/lib/raider_reporter/writers/uploader.rb +24 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 43cb5da1df209da0c5607c26891e58a868982311569e8f844d80b87a46943f14
|
|
4
|
+
data.tar.gz: 82099d1f6c53736ef7f9d075207887581e6280af14a4d0335008ef54712ee48b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 276522de77789af81f1534ca8980cd3e168915963c2dd52b1863d2aa7ca4f5bfb54d3fecd018498931dcc45d58905adc331388ba26d152797e0800e421ab9688
|
|
7
|
+
data.tar.gz: b980514dc7c2a51d08cb89de5caf549a648406cbce998159d706d4397735c1eb1af37221eaf354d4e383104facf1025917b4ce12d21fc1937b68c38964960b61
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.1 — 2026-10-13
|
|
4
|
+
|
|
5
|
+
- Fix: a failed upload now reports one short line. An HTML error page (for example a server 500) is summarised as `the server returned an HTML error page` instead of being printed, other bodies are collapsed to one line of at most 200 characters, and the token is redacted from upload errors, including exception messages
|
|
6
|
+
- Docs: the Azure Pipelines snippet publishes `raider-results-$(System.JobPositionInPhase)-$(System.JobAttempt)`, so re-running failed jobs or `strategy: parallel` no longer collides on the artifact name
|
|
7
|
+
|
|
3
8
|
## 0.5.0 — 2026-10-12
|
|
4
9
|
|
|
5
10
|
- Add Azure Pipelines support: detect the build (`provider: azure_pipelines`, build URL, attempt, job, branch, commit), report Azure Repos pull requests in `run.git.pr`, and derive a stable id-based build key. `strategy: parallel` jobs are detected as shards of one build
|
data/README.md
CHANGED
|
@@ -214,7 +214,7 @@ jobs:
|
|
|
214
214
|
RAIDER_ENDPOINT: $(RAIDER_ENDPOINT)
|
|
215
215
|
- task: PublishPipelineArtifact@1
|
|
216
216
|
condition: always()
|
|
217
|
-
inputs: { targetPath: raider-results, artifact: raider-results }
|
|
217
|
+
inputs: { targetPath: raider-results, artifact: raider-results-$(System.JobPositionInPhase)-$(System.JobAttempt) }
|
|
218
218
|
- job: raider_comment
|
|
219
219
|
dependsOn: tests
|
|
220
220
|
condition: and(always(), eq(variables['Build.Reason'], 'PullRequest'))
|
|
@@ -234,6 +234,7 @@ jobs:
|
|
|
234
234
|
- **Map secrets explicitly:** Azure does not expose secret variables to scripts automatically. Map `RAIDER_TOKEN` and `System.AccessToken` with `env:` as shown. If a mapped variable is undefined, Azure passes the literal `$(...)`; the gem treats it as missing: results are still written locally but not uploaded, and `raider-reporter comment` prints a skip notice.
|
|
235
235
|
- **Pull request builds:** for Azure Repos, YAML `pr:` triggers are ignored. PR builds (and therefore the comment job) run only when the pipeline is added as a **Build validation** branch policy on the target branch.
|
|
236
236
|
- **Same stage:** keep the comment job in the same stage as the test jobs; the build key includes `System.StageAttempt`.
|
|
237
|
+
- **Artifact names:** pipeline artifacts cannot be overwritten within a run, so the name includes the job position and attempt. A fixed name would fail when you re-run failed jobs or use `strategy: parallel`.
|
|
237
238
|
- **Azure Repos only:** the PR comment works for repositories hosted in Azure Repos. A GitHub-hosted repository built by Azure Pipelines still uploads results, but `comment` prints `skipped: not an Azure Repos pull request`.
|
|
238
239
|
- **Parallel jobs:** `strategy: parallel: N` shards are detected automatically and grouped into one build, like GitHub matrix jobs.
|
|
239
240
|
- The command never fails your pipeline: it always exits 0 and prints notices to stderr, prefixed `[raider_reporter]`. It needs `SYSTEM_ACCESSTOKEN`, `RAIDER_TOKEN` and `RAIDER_ENDPOINT`, and requires a Raider server that supports the summary endpoint.
|
|
@@ -12,6 +12,7 @@ module RaiderReporter
|
|
|
12
12
|
# Keeps uploads under the server's 50 MB request limit and multipart part limit.
|
|
13
13
|
MAX_UPLOAD_ATTACHMENT_BYTES = 45 * 1024 * 1024
|
|
14
14
|
MAX_UPLOAD_ATTACHMENTS = 1000
|
|
15
|
+
ERROR_DETAIL_LIMIT = 200
|
|
15
16
|
|
|
16
17
|
def initialize(config, timeout: 30, warn: RaiderReporter.method(:warn))
|
|
17
18
|
@config = config
|
|
@@ -42,7 +43,7 @@ module RaiderReporter
|
|
|
42
43
|
end
|
|
43
44
|
to_result(response)
|
|
44
45
|
rescue StandardError => e
|
|
45
|
-
Result.new(ok: false, url: nil, run_id: nil, build_url: nil, error: "#{e.class}: #{e.message}")
|
|
46
|
+
Result.new(ok: false, url: nil, run_id: nil, build_url: nil, error: redact("#{e.class}: #{e.message}"))
|
|
46
47
|
end
|
|
47
48
|
|
|
48
49
|
private
|
|
@@ -97,10 +98,31 @@ module RaiderReporter
|
|
|
97
98
|
Result.new(ok: true, url: present(body["url"]), run_id: present(body["run_id"]),
|
|
98
99
|
build_url: present(build["url"]), error: nil)
|
|
99
100
|
else
|
|
100
|
-
Result.new(ok: false, url: nil, run_id: nil, build_url: nil, error:
|
|
101
|
+
Result.new(ok: false, url: nil, run_id: nil, build_url: nil, error: error_message(response))
|
|
101
102
|
end
|
|
102
103
|
end
|
|
103
104
|
|
|
105
|
+
# One short line: an HTML error page (e.g. a Rails 500) is summarised, anything
|
|
106
|
+
# else is collapsed to one line, redacted, then cut to ERROR_DETAIL_LIMIT.
|
|
107
|
+
def error_message(response)
|
|
108
|
+
text = response.body.to_s.dup.force_encoding(Encoding::UTF_8).scrub
|
|
109
|
+
detail = if html?(response, text)
|
|
110
|
+
"the server returned an HTML error page"
|
|
111
|
+
else
|
|
112
|
+
redact(text).gsub(/\s+/, " ").strip[0, ERROR_DETAIL_LIMIT]
|
|
113
|
+
end
|
|
114
|
+
detail.empty? ? "HTTP #{response.code}" : "HTTP #{response.code}: #{detail}"
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def html?(response, text)
|
|
118
|
+
response["Content-Type"].to_s.include?("html") || text.lstrip.start_with?("<")
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def redact(text)
|
|
122
|
+
token = @config.token.to_s
|
|
123
|
+
token.empty? ? text.to_s : text.to_s.gsub(token, "[REDACTED]")
|
|
124
|
+
end
|
|
125
|
+
|
|
104
126
|
def parse_body(text)
|
|
105
127
|
parsed = JSON.parse(text.to_s)
|
|
106
128
|
parsed.is_a?(Hash) ? parsed : {}
|