buildkite-test_collector 2.7.2 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.buildkite/pipeline.release.yml +18 -0
- data/.buildkite/steps/release-gem +56 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +36 -20
- data/README.md +7 -6
- data/buildkite.yaml +2 -0
- data/lib/buildkite/test_collector/http_client.rb +21 -17
- data/lib/buildkite/test_collector/uploader.rb +12 -5
- data/lib/buildkite/test_collector/version.rb +1 -1
- data/lib/buildkite/test_collector.rb +3 -1
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a06be6db9195629f49724e87ac755466db10f8e8ae5289ca7f3a1803a335ff66
|
4
|
+
data.tar.gz: 8b0110c802047ac6f169156f8f07e0808a2d23e8cc3f47156a5208a92167e0a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caad67348cde90de584225d0c64e1c1cc3ab50aa222879679ab1399063ea2e9ff97ce3c19f3c85725560d288a034d0ee25e1d0e5e6eb79bcf89d9ee0e51e9f38
|
7
|
+
data.tar.gz: 550c9d2ba8120b5fc2464f47094223f28c5103a836123179fb43f8b6399ce45490a20c67454921a7f192cda575e6b19c3296654af28a9a3b7fc2a90cbcf03fe0
|
@@ -0,0 +1,18 @@
|
|
1
|
+
agents:
|
2
|
+
queue: hosted
|
3
|
+
|
4
|
+
steps:
|
5
|
+
- block: "OK to release?"
|
6
|
+
|
7
|
+
- command: ".buildkite/steps/release-gem"
|
8
|
+
label: ":rubygems:"
|
9
|
+
if: build.tag != null
|
10
|
+
plugins:
|
11
|
+
- rubygems-oidc#v0.2.0:
|
12
|
+
role: "rg_oidc_akr_fy1x4px4yjwd1rdhkkda"
|
13
|
+
- docker#v5.12.0:
|
14
|
+
image: "ruby:3.4"
|
15
|
+
environment:
|
16
|
+
- GEM_HOST_API_KEY
|
17
|
+
- BUILDKITE_TAG
|
18
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -euo pipefail
|
4
|
+
|
5
|
+
if [ -z "${GEM_HOST_API_KEY}" ]; then
|
6
|
+
echo "GEM_HOST_API_KEY environment variable not found"
|
7
|
+
exit 1
|
8
|
+
fi
|
9
|
+
|
10
|
+
if [ -z "${BUILDKITE_TAG}" ]; then
|
11
|
+
echo "BUILDKITE_TAG environment variable not found"
|
12
|
+
exit 1
|
13
|
+
fi
|
14
|
+
|
15
|
+
cd $(dirname $0)/../..
|
16
|
+
|
17
|
+
echo "--- Inspecting tag and version"
|
18
|
+
|
19
|
+
echo "BUILDKITE_TAG: ${BUILDKITE_TAG}"
|
20
|
+
|
21
|
+
if [[ ! "${BUILDKITE_TAG}" == v* ]]; then
|
22
|
+
echo "We will only try to publish to rubygems when the tag starts with 'v'"
|
23
|
+
exit 1
|
24
|
+
fi
|
25
|
+
|
26
|
+
VERSION=$(echo "${BUILDKITE_TAG}" | sed "s/^v//")
|
27
|
+
GEM_FILENAME="buildkite-test_collector-${VERSION}.gem"
|
28
|
+
|
29
|
+
echo "Version to release: ${VERSION}"
|
30
|
+
|
31
|
+
echo "--- Building gem"
|
32
|
+
|
33
|
+
gem build buildkite-test_collector.gemspec
|
34
|
+
|
35
|
+
if [ ! -f "${GEM_FILENAME}" ]; then
|
36
|
+
echo
|
37
|
+
echo "ERROR: Expected compiled gem to be '${GEM_FILENAME}' but file not found"
|
38
|
+
echo "Does the gemspec specify version '${BUILDKITE_TAG}'?"
|
39
|
+
echo
|
40
|
+
echo "Gem files found:"
|
41
|
+
echo
|
42
|
+
ls *.gem
|
43
|
+
echo
|
44
|
+
exit 1
|
45
|
+
fi
|
46
|
+
|
47
|
+
echo "--- Check if version already exists on rubygems.org"
|
48
|
+
|
49
|
+
if [ $(curl -s -o /dev/null -w "%{http_code}" https://rubygems.org/api/v2/rubygems/buildkite-test_collector/versions/${VERSION}.json) == "200" ]; then
|
50
|
+
echo "Gem version ${VERSION} already found on rubygems, skipping release"
|
51
|
+
exit 1
|
52
|
+
fi
|
53
|
+
|
54
|
+
echo "--- publish gem"
|
55
|
+
|
56
|
+
gem push "${GEM_FILENAME}"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## v2.8.0
|
4
|
+
|
5
|
+
* Buildkite::TestCollector.tags: specify tags for all executions by @pda in https://github.com/buildkite/test-collector-ruby/pull/235
|
6
|
+
* Add Ruby 3.4 to Buildkite build matrix by @gchan in https://github.com/buildkite/test-collector-ruby/pull/236
|
7
|
+
|
8
|
+
**Full Changelog**: https://github.com/buildkite/test-collector-ruby/compare/v2.7.2...v2.8.0
|
9
|
+
|
3
10
|
## v2.7.2
|
4
11
|
|
5
12
|
- Fixes RSpec library hook bug introduced in v2.7.1 #230 - @malclocke
|
data/Gemfile.lock
CHANGED
@@ -1,37 +1,53 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
buildkite-test_collector (2.
|
4
|
+
buildkite-test_collector (2.8.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activesupport (
|
10
|
-
|
9
|
+
activesupport (8.0.1)
|
10
|
+
base64
|
11
|
+
benchmark (>= 0.3)
|
12
|
+
bigdecimal
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
14
|
+
connection_pool (>= 2.2.5)
|
15
|
+
drb
|
11
16
|
i18n (>= 1.6, < 2)
|
17
|
+
logger (>= 1.4.2)
|
12
18
|
minitest (>= 5.1)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
19
|
+
securerandom (>= 0.3)
|
20
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
21
|
+
uri (>= 0.13.1)
|
22
|
+
base64 (0.2.0)
|
23
|
+
benchmark (0.4.0)
|
24
|
+
bigdecimal (3.1.9)
|
25
|
+
concurrent-ruby (1.3.5)
|
26
|
+
connection_pool (2.5.0)
|
27
|
+
diff-lcs (1.5.1)
|
28
|
+
drb (2.2.1)
|
29
|
+
i18n (1.14.7)
|
17
30
|
concurrent-ruby (~> 1.0)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
rspec-
|
23
|
-
rspec-
|
24
|
-
|
25
|
-
|
26
|
-
|
31
|
+
logger (1.6.5)
|
32
|
+
minitest (5.25.4)
|
33
|
+
rake (13.2.1)
|
34
|
+
rspec (3.13.0)
|
35
|
+
rspec-core (~> 3.13.0)
|
36
|
+
rspec-expectations (~> 3.13.0)
|
37
|
+
rspec-mocks (~> 3.13.0)
|
38
|
+
rspec-core (3.13.2)
|
39
|
+
rspec-support (~> 3.13.0)
|
40
|
+
rspec-expectations (3.13.3)
|
27
41
|
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
-
rspec-support (~> 3.
|
29
|
-
rspec-mocks (3.
|
42
|
+
rspec-support (~> 3.13.0)
|
43
|
+
rspec-mocks (3.13.2)
|
30
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
-
rspec-support (~> 3.
|
32
|
-
rspec-support (3.
|
45
|
+
rspec-support (~> 3.13.0)
|
46
|
+
rspec-support (3.13.2)
|
47
|
+
securerandom (0.4.1)
|
33
48
|
tzinfo (2.0.6)
|
34
49
|
concurrent-ruby (~> 1.0)
|
50
|
+
uri (1.0.2)
|
35
51
|
|
36
52
|
PLATFORMS
|
37
53
|
ruby
|
data/README.md
CHANGED
@@ -131,14 +131,15 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/buildk
|
|
131
131
|
|
132
132
|
1. Bump the version in `version.rb` and run `bundle` to update the `Gemfile.lock`.
|
133
133
|
1. Update the CHANGELOG.md with your new version and a description of your changes.
|
134
|
-
|
135
|
-
```
|
136
|
-
git tag v.x.x.x
|
137
|
-
git push --tags
|
138
|
-
```
|
134
|
+
|
139
135
|
Once your PR is merged to `main`:
|
140
136
|
|
141
|
-
1.
|
137
|
+
1. Git tag the merge commit and push
|
138
|
+
```
|
139
|
+
git tag vX.X.X
|
140
|
+
git push origin vX.X.X
|
141
|
+
```
|
142
|
+
1. Visit the [release pipeline](https://buildkite.com/buildkite/test-collector-ruby-release) to unblock it and confirm the new version is pushed to rubygems.org
|
142
143
|
1. Create a [new release in github](https://github.com/buildkite/test-collector-ruby/releases).
|
143
144
|
|
144
145
|
## 📜 MIT License
|
data/buildkite.yaml
CHANGED
@@ -4,6 +4,7 @@ agents:
|
|
4
4
|
steps:
|
5
5
|
- label: ":rspec: Tests :ruby: {{matrix}}"
|
6
6
|
command:
|
7
|
+
- "gem install bundler:2.3.25"
|
7
8
|
- "bundle"
|
8
9
|
- "bundle exec rake"
|
9
10
|
plugins:
|
@@ -11,6 +12,7 @@ steps:
|
|
11
12
|
image: "public.ecr.aws/docker/library/ruby:{{matrix}}"
|
12
13
|
matrix:
|
13
14
|
- "latest"
|
15
|
+
- "3.4"
|
14
16
|
- "3.3"
|
15
17
|
- "3.2"
|
16
18
|
- "3.1"
|
@@ -4,19 +4,18 @@ require "net/http"
|
|
4
4
|
|
5
5
|
module Buildkite::TestCollector
|
6
6
|
class HTTPClient
|
7
|
-
|
8
|
-
def initialize(url)
|
7
|
+
def initialize(url:, api_token:)
|
9
8
|
@url = url
|
10
|
-
@
|
9
|
+
@api_token = api_token
|
11
10
|
end
|
12
11
|
|
13
|
-
def
|
14
|
-
|
12
|
+
def post_upload(data:, run_env:, tags:)
|
13
|
+
endpoint_uri = URI.parse(url)
|
15
14
|
|
16
|
-
http = Net::HTTP.new(
|
17
|
-
http.use_ssl =
|
15
|
+
http = Net::HTTP.new(endpoint_uri.host, endpoint_uri.port)
|
16
|
+
http.use_ssl = endpoint_uri.scheme == "https"
|
18
17
|
|
19
|
-
|
18
|
+
request = Net::HTTP::Post.new(endpoint_uri.path, {
|
20
19
|
"Authorization" => authorization_header,
|
21
20
|
"Content-Type" => "application/json",
|
22
21
|
"Content-Encoding" => "gzip",
|
@@ -25,7 +24,8 @@ module Buildkite::TestCollector
|
|
25
24
|
data_set = data.map(&:as_hash)
|
26
25
|
|
27
26
|
body = {
|
28
|
-
run_env:
|
27
|
+
run_env: run_env,
|
28
|
+
tags: tags,
|
29
29
|
format: "json",
|
30
30
|
data: data_set
|
31
31
|
}.to_json
|
@@ -36,9 +36,9 @@ module Buildkite::TestCollector
|
|
36
36
|
writer.write(body)
|
37
37
|
writer.close
|
38
38
|
|
39
|
-
|
39
|
+
request.body = compressed_body.string
|
40
40
|
|
41
|
-
response = http.request(
|
41
|
+
response = http.request(request)
|
42
42
|
|
43
43
|
if response.is_a?(Net::HTTPSuccess)
|
44
44
|
response
|
@@ -48,21 +48,25 @@ module Buildkite::TestCollector
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def metadata
|
51
|
-
|
51
|
+
endpoint_uri = URI.parse("#{url}/metadata")
|
52
52
|
|
53
|
-
http = Net::HTTP.new(
|
54
|
-
http.use_ssl =
|
53
|
+
http = Net::HTTP.new(endpoint_uri.host, endpoint_uri.port)
|
54
|
+
http.use_ssl = endpoint_uri.scheme == "https"
|
55
55
|
|
56
|
-
|
56
|
+
request = Net::HTTP::Get.new(endpoint_uri.path, {
|
57
57
|
"Authorization" => authorization_header,
|
58
58
|
"Content-Type" => "application/json"
|
59
59
|
})
|
60
60
|
|
61
|
-
http.request(
|
61
|
+
http.request(request)
|
62
62
|
end
|
63
63
|
|
64
64
|
private
|
65
65
|
|
66
|
-
|
66
|
+
attr_reader :url
|
67
|
+
|
68
|
+
def authorization_header
|
69
|
+
"Token token=\"#{@api_token}\""
|
70
|
+
end
|
67
71
|
end
|
68
72
|
end
|
@@ -36,16 +36,23 @@ module Buildkite::TestCollector
|
|
36
36
|
def self.upload(data)
|
37
37
|
return false unless Buildkite::TestCollector.api_token
|
38
38
|
|
39
|
-
http = Buildkite::TestCollector::HTTPClient.new(
|
39
|
+
http = Buildkite::TestCollector::HTTPClient.new(
|
40
|
+
url: Buildkite::TestCollector.url,
|
41
|
+
api_token: Buildkite::TestCollector.api_token,
|
42
|
+
)
|
40
43
|
|
41
44
|
Thread.new do
|
42
45
|
begin
|
43
46
|
upload_attempts ||= 0
|
44
|
-
http.
|
47
|
+
http.post_upload(
|
48
|
+
data: data,
|
49
|
+
run_env: Buildkite::TestCollector::CI.env,
|
50
|
+
tags: Buildkite::TestCollector.tags,
|
51
|
+
)
|
52
|
+
|
45
53
|
rescue *Buildkite::TestCollector::Uploader::RETRYABLE_UPLOAD_ERRORS => e
|
46
|
-
if (upload_attempts += 1) < MAX_UPLOAD_ATTEMPTS
|
47
|
-
|
48
|
-
end
|
54
|
+
retry if (upload_attempts += 1) < MAX_UPLOAD_ATTEMPTS
|
55
|
+
|
49
56
|
rescue StandardError => e
|
50
57
|
$stderr.puts e
|
51
58
|
$stderr.puts "#{Buildkite::TestCollector::NAME} #{Buildkite::TestCollector::VERSION} experienced an error when sending your data, you may be missing some executions for this run."
|
@@ -36,17 +36,19 @@ module Buildkite
|
|
36
36
|
attr_accessor :tracing_enabled
|
37
37
|
attr_accessor :artifact_path
|
38
38
|
attr_accessor :env
|
39
|
+
attr_accessor :tags
|
39
40
|
attr_accessor :batch_size
|
40
41
|
attr_accessor :trace_min_duration
|
41
42
|
attr_accessor :span_filters
|
42
43
|
end
|
43
44
|
|
44
|
-
def self.configure(hook:, token: nil, url: nil, tracing_enabled: true, artifact_path: nil, env: {})
|
45
|
+
def self.configure(hook:, token: nil, url: nil, tracing_enabled: true, artifact_path: nil, env: {}, tags: {})
|
45
46
|
self.api_token = (token || ENV["BUILDKITE_ANALYTICS_TOKEN"])&.strip
|
46
47
|
self.url = url || DEFAULT_URL
|
47
48
|
self.tracing_enabled = tracing_enabled
|
48
49
|
self.artifact_path = artifact_path
|
49
50
|
self.env = env
|
51
|
+
self.tags = tags
|
50
52
|
self.batch_size = ENV.fetch("BUILDKITE_ANALYTICS_UPLOAD_BATCH_SIZE") { DEFAULT_UPLOAD_BATCH_SIZE }.to_i
|
51
53
|
|
52
54
|
trace_min_ms_string = ENV["BUILDKITE_ANALYTICS_TRACE_MIN_MS"]
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildkite-test_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Buildkite
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-04 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activesupport
|
@@ -52,13 +51,14 @@ dependencies:
|
|
52
51
|
- - "~>"
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: '3.10'
|
55
|
-
description:
|
56
54
|
email:
|
57
55
|
- support+analytics@buildkite.com
|
58
56
|
executables: []
|
59
57
|
extensions: []
|
60
58
|
extra_rdoc_files: []
|
61
59
|
files:
|
60
|
+
- ".buildkite/pipeline.release.yml"
|
61
|
+
- ".buildkite/steps/release-gem"
|
62
62
|
- ".gitignore"
|
63
63
|
- ".rspec"
|
64
64
|
- CHANGELOG.md
|
@@ -99,7 +99,6 @@ licenses:
|
|
99
99
|
metadata:
|
100
100
|
homepage_uri: https://github.com/buildkite/test-collector-ruby
|
101
101
|
source_code_uri: https://github.com/buildkite/test-collector-ruby
|
102
|
-
post_install_message:
|
103
102
|
rdoc_options: []
|
104
103
|
require_paths:
|
105
104
|
- lib
|
@@ -114,8 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
113
|
- !ruby/object:Gem::Version
|
115
114
|
version: '0'
|
116
115
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
118
|
-
signing_key:
|
116
|
+
rubygems_version: 3.6.2
|
119
117
|
specification_version: 4
|
120
118
|
summary: Track test executions and report to Buildkite Test Engine
|
121
119
|
test_files: []
|