fluent-plugin-logtail 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 812d8fea53a6dc3b81c07be27f454c178d9ff2ce9bc4d6bde6531dc12e92c0c4
4
- data.tar.gz: 61a02d757f5e7623e5d556c3f0ab383942a640065857f745b4814771839de1fc
3
+ metadata.gz: 2a83c2cb26fd6a612aa976e939af1facf21807705c3b5011931894a20732ce73
4
+ data.tar.gz: 1315b1b244032c1980861a07b4d539b4ec857017f08f2fd0b5f564c76173b139
5
5
  SHA512:
6
- metadata.gz: 615922ba184a54c595633a6c8ef0c99db5f4e2ebf4814e41c4b80315221063cf6a997ca31bc94df34cd2d0bdbcf400dc07b2d9d054df098b1867515569026eeb
7
- data.tar.gz: 42a5b851381bd677dd2ce65a823b85e6ca9624c7631ee65a4ce05f52fd8a32939fa20c0589f33c1f84d8227c17b959d0e0c48994b03cc1d662ad1e6de227f6d1
6
+ metadata.gz: 7f8b843456204b4f98aebda01f051f60bcc15d4bec12f5df02c63a464139e119d32ef6c7f5db8bd677f576e6649f419c9c62fc679c8bfe744ce089c99b08c4d2
7
+ data.tar.gz: 95979f0ad965a2599799e6b15ecc4e34aee160bda95919f8b6a76b01d20fbe75a7181a6221c270ec2c5df0f9d2e61d6dc616139b4aa5198e49814efc18f7310b
@@ -1,23 +1,36 @@
1
1
  name: build
2
2
 
3
- on: [push, pull_request]
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ schedule:
8
+ - cron: '20 5 * * 1'
9
+ workflow_dispatch:
4
10
 
5
11
  jobs:
6
12
  test:
7
-
8
- runs-on: ubuntu-20.04
13
+ runs-on: ubuntu-24.04
9
14
 
10
15
  strategy:
16
+ fail-fast: false
17
+
11
18
  matrix:
12
19
  ruby-version:
13
- - 3.0.0
14
- - 2.7.2
15
- - 2.6.6
16
- - 2.5.8
17
- - 2.4.10
20
+ - "4.0"
21
+ - "3"
22
+ - "3.4"
23
+ - "3.3"
24
+ - "3.2"
25
+ - "3.1"
26
+ - "3.0"
27
+ - "2.7"
28
+ - "2.6"
29
+ - "2.5"
30
+ - "2.4"
18
31
 
19
32
  steps:
20
- - uses: actions/checkout@v2
33
+ - uses: actions/checkout@v7
21
34
 
22
35
  - name: Set up Ruby ${{ matrix.ruby-version }}
23
36
  uses: ruby/setup-ruby@v1
@@ -0,0 +1,28 @@
1
+ # Issues in this repo are synced with Linear. A GitHub closing keyword ("Closes #123",
2
+ # "Fixes owner/repo#123") closes the issue the moment the PR merges, while Linear's PR
3
+ # automation moves the linked Linear issue to Self QA at the same time. The two automations
4
+ # then fight: the GitHub issue is closed, reopened, and the Linear issue lands in Triage.
5
+ # Reference the issue with "Refs #123" instead and close it from Linear once the fix is
6
+ # released.
7
+ name: no closing keywords
8
+ on:
9
+ pull_request:
10
+ types: [opened, edited, reopened, synchronize]
11
+ permissions:
12
+ pull-requests: read
13
+ jobs:
14
+ check:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Reject GitHub closing keywords in the PR description
18
+ env:
19
+ BODY: ${{ github.event.pull_request.body }}
20
+ run: |
21
+ pattern='\b(close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)\b:?[[:space:]]+(#[0-9]+|[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+#[0-9]+|https?://github\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+/issues/[0-9]+)'
22
+ if matches=$(printf '%s' "$BODY" | grep -inoE "$pattern"); then
23
+ echo "::error::The PR description contains a GitHub closing keyword, which would close the issue on merge and desync it from Linear:"
24
+ echo "$matches"
25
+ echo "Use 'Refs #123' instead and close the issue from Linear once the fix is released."
26
+ exit 1
27
+ fi
28
+ echo "No closing keywords found."
@@ -0,0 +1,215 @@
1
+ # Publishes the gem to RubyGems.org from GitHub Actions with trusted publishing (OIDC), the way
2
+ # logtail-js releases the @logtail/* packages to npm. No RubyGems.org API key exists anywhere:
3
+ # the gem on rubygems.org trusts exactly this workflow file, run from this repository in the
4
+ # "rubygems" environment, and the shared account's multi-factor authentication stays as it is.
5
+ #
6
+ # One-time setup on rubygems.org, signed in as the gem's owner: the gem's page → Trusted publishers
7
+ # → GitHub Actions, with the repository owner "logtail", this repository's name, the workflow
8
+ # "release.yml" and the environment "rubygems".
9
+ #
10
+ # Repository settings this relies on: the "rubygems" environment with deployment branches limited
11
+ # to main and no required reviewers (add reviewers there if releases should need an approval; a
12
+ # job that references a missing environment would create it WITHOUT protection), and the GitHub
13
+ # Actions app among the actors allowed to bypass the pull request requirement of main, which the
14
+ # version commit needs.
15
+ #
16
+ # Release: Actions → Release → Run workflow from main, pick patch or minor. The workflow runs the
17
+ # tests, bumps the version in lib/*/version.rb, builds the gem, commits "vX.Y.Z", tags it, pushes
18
+ # both, pushes the gem to RubyGems.org and creates a GitHub release with auto-generated notes for
19
+ # the tag; edit the notes afterwards if needed.
20
+ #
21
+ # Retry: if a release failed after the version commit was pushed, run "retry" from main. It bumps
22
+ # nothing, checks out the tag of the version in lib/*/version.rb and rebuilds that commit, pushes
23
+ # the gem if RubyGems.org is still missing it and creates the GitHub release if it is still
24
+ # missing. Running patch or minor again would release the next version instead.
25
+ #
26
+ # Dry run: bumps in place without committing, builds the gem and, on main, exchanges the
27
+ # workflow's OIDC token with RubyGems.org, which proves that the trusted publisher matches this
28
+ # workflow. Nothing is pushed. Every push that touches this file is a dry run, so a change to the
29
+ # workflow proves itself on its pull request before it reaches main, and the push that merges it
30
+ # performs the token exchange as well, because the "rubygems" environment only admits main. A dry
31
+ # run can also be dispatched from any branch.
32
+ name: Release
33
+
34
+ on:
35
+ workflow_dispatch:
36
+ inputs:
37
+ release:
38
+ description: "patch or minor: bump, tag and publish. retry: finish a release that failed halfway."
39
+ type: choice
40
+ options: [patch, minor, retry]
41
+ required: true
42
+ dry_run:
43
+ description: "Dry run: bump and build, verify RubyGems.org accepts this workflow, publish nothing"
44
+ type: boolean
45
+ default: false
46
+ push:
47
+ paths:
48
+ - .github/workflows/release.yml
49
+
50
+ permissions:
51
+ contents: read
52
+
53
+ concurrency:
54
+ group: release
55
+ cancel-in-progress: false
56
+
57
+ env:
58
+ DRY_RUN: ${{ github.event_name == 'push' || inputs.dry_run }}
59
+ RELEASE: ${{ inputs.release || 'patch' }}
60
+
61
+ jobs:
62
+ verify:
63
+ name: Test
64
+ runs-on: ubuntu-24.04
65
+ steps:
66
+ - uses: actions/checkout@v7
67
+
68
+ - name: Set up Ruby
69
+ uses: ruby/setup-ruby@v1
70
+ with:
71
+ ruby-version: "3"
72
+ bundler-cache: true
73
+
74
+ - name: Run tests
75
+ run: bundle exec rspec
76
+
77
+ build:
78
+ name: Bump and build
79
+ needs: verify
80
+ runs-on: ubuntu-24.04
81
+ permissions:
82
+ contents: write # pushes the version commit and the tag
83
+ outputs:
84
+ version: ${{ steps.version.outputs.version }}
85
+ gem: ${{ steps.build.outputs.gem }}
86
+
87
+ steps:
88
+ - name: Releases run from main only
89
+ if: ${{ env.DRY_RUN != 'true' && github.ref != 'refs/heads/main' }}
90
+ run: |
91
+ echo "::error::Dispatch the release from main, not from $GITHUB_REF_NAME."
92
+ exit 1
93
+
94
+ - uses: actions/checkout@v7
95
+ with:
96
+ fetch-depth: 0 # the version check looks at the tags on HEAD
97
+
98
+ - name: Set up Ruby
99
+ uses: ruby/setup-ruby@v1
100
+ with:
101
+ ruby-version: "3"
102
+
103
+ - name: Bump version
104
+ id: version
105
+ run: |
106
+ ruby - <<'EOF'
107
+ release, dry_run = ENV.fetch("RELEASE"), ENV["DRY_RUN"] == "true"
108
+ path = Dir["lib/**/version.rb"].fetch(0)
109
+ source = File.read(path)
110
+ current = source[/VERSION = "(\d+\.\d+\.\d+)"/, 1] || abort("no VERSION constant in #{path}")
111
+ tagged = `git tag --points-at HEAD`.split.include?("v#{current}")
112
+
113
+ if release == "retry"
114
+ # main may have moved on since the version commit, so build what the tag points at
115
+ abort("retry only finishes a release whose version v#{current} is tagged") unless system("git", "rev-parse", "-q", "--verify", "refs/tags/v#{current}", out: File::NULL)
116
+ system("git", "checkout", "-q", "v#{current}") || abort("could not check out v#{current}")
117
+ version = current
118
+ else
119
+ abort("HEAD is already released as v#{current}, there is nothing new to release") if tagged && !dry_run
120
+ major, minor, patch = current.split(".").map(&:to_i)
121
+ version = release == "minor" ? "#{major}.#{minor + 1}.0" : "#{major}.#{minor}.#{patch + 1}"
122
+ File.write(path, source.sub(%("#{current}"), %("#{version}")))
123
+ end
124
+
125
+ puts "#{current} -> #{version}"
126
+ File.open(ENV.fetch("GITHUB_OUTPUT"), "a") { |output| output.puts "version=#{version}" }
127
+ EOF
128
+
129
+ - name: Build the gem
130
+ id: build
131
+ env:
132
+ VERSION: ${{ steps.version.outputs.version }}
133
+ run: |
134
+ git diff --stat
135
+ gem build *.gemspec
136
+ gem=$(ls *.gem)
137
+ case "$gem" in
138
+ *-"$VERSION".gem) ;;
139
+ *) echo "::error::Built $gem, expected version $VERSION."; exit 1 ;;
140
+ esac
141
+ echo "gem=$gem" >> "$GITHUB_OUTPUT"
142
+
143
+ - name: Commit and tag
144
+ if: ${{ env.DRY_RUN != 'true' && env.RELEASE != 'retry' }}
145
+ env:
146
+ VERSION: ${{ steps.version.outputs.version }}
147
+ run: |
148
+ git config user.name "github-actions[bot]"
149
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
150
+ git commit -am "v$VERSION"
151
+ git tag -a "v$VERSION" -m "v$VERSION"
152
+ git push origin main "v$VERSION"
153
+
154
+ - uses: actions/upload-artifact@v7
155
+ with:
156
+ name: gem
157
+ path: "*.gem"
158
+ if-no-files-found: error
159
+
160
+ release:
161
+ name: Publish
162
+ needs: build
163
+ # The rubygems environment only admits main, so dry runs from other branches stop after the build
164
+ if: ${{ github.ref == 'refs/heads/main' }}
165
+ runs-on: ubuntu-24.04
166
+ environment: rubygems
167
+ permissions:
168
+ contents: write # creates the GitHub release
169
+ id-token: write # OIDC token exchange with RubyGems.org
170
+ env:
171
+ VERSION: ${{ needs.build.outputs.version }}
172
+ GEM: ${{ needs.build.outputs.gem }}
173
+
174
+ steps:
175
+ - uses: actions/download-artifact@v8
176
+ with:
177
+ name: gem
178
+
179
+ - name: Set up Ruby
180
+ uses: ruby/setup-ruby@v1
181
+ with:
182
+ ruby-version: "3"
183
+
184
+ # Exchanges the job's OIDC token for a short-lived RubyGems.org API key and hands it to
185
+ # `gem push`. Fails when no trusted publisher on rubygems.org matches this workflow.
186
+ - uses: rubygems/configure-rubygems-credentials@v2.1.0
187
+
188
+ - name: Dry run
189
+ if: ${{ env.DRY_RUN == 'true' }}
190
+ run: |
191
+ ls -l "$GEM"
192
+ echo "RubyGems.org accepted the OIDC token: the trusted publisher matches this workflow. Nothing is pushed."
193
+
194
+ - name: Push to RubyGems.org
195
+ if: ${{ env.DRY_RUN != 'true' }}
196
+ run: |
197
+ name="${GEM%-$VERSION.gem}"
198
+ if gem specification --remote "$name" --version "$VERSION" > /dev/null 2>&1; then
199
+ echo "$name $VERSION is on rubygems.org already, finishing the release."
200
+ else
201
+ gem push "$GEM"
202
+ fi
203
+
204
+ - name: Create GitHub release
205
+ if: ${{ env.DRY_RUN != 'true' }}
206
+ env:
207
+ GH_TOKEN: ${{ github.token }}
208
+ GH_REPO: ${{ github.repository }}
209
+ run: |
210
+ if gh release view "v$VERSION" > /dev/null 2>&1; then
211
+ echo "Release v$VERSION already exists."
212
+ else
213
+ # --verify-tag: only ever attach to the tag the build job pushed, never create one here.
214
+ gh release create "v$VERSION" --verify-tag --generate-notes
215
+ fi
@@ -1,9 +1,10 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ require_relative "lib/fluent/plugin/logtail/version"
2
3
  require 'date'
3
4
 
4
5
  Gem::Specification.new do |s|
5
6
  s.name = 'fluent-plugin-logtail'
6
- s.version = '0.2.1'
7
+ s.version = Fluent::Plugin::Logtail::VERSION
7
8
  s.date = Date.today.to_s
8
9
  s.summary = 'Logtail.com plugin for Fluentd'
9
10
  s.description = 'Streams Fluentd logs to the Logtail.com logging service.'
@@ -0,0 +1,7 @@
1
+ module Fluent
2
+ module Plugin
3
+ module Logtail
4
+ VERSION = "0.2.2"
5
+ end
6
+ end
7
+ end
@@ -1,11 +1,12 @@
1
1
  require 'fluent/output'
2
2
  require 'net/https'
3
+ require_relative 'logtail/version'
3
4
 
4
5
  module Fluent
5
6
  class LogtailOutput < Fluent::BufferedOutput
6
7
  Fluent::Plugin.register_output('logtail', self)
7
8
 
8
- VERSION = "0.1.1".freeze
9
+ VERSION = Fluent::Plugin::Logtail::VERSION
9
10
  CONTENT_TYPE = "application/msgpack".freeze
10
11
  PORT = 443
11
12
  PATH = "/".freeze
@@ -39,6 +39,9 @@ describe Fluent::LogtailOutput do
39
39
  }.configure(cloud_config)
40
40
  end
41
41
 
42
+ # The gem version the bundle loaded from the gemspec, so a version bump needs no spec change
43
+ let(:user_agent) { "Logtail Fluentd/#{Gem.loaded_specs.fetch("fluent-plugin-logtail").version}" }
44
+
42
45
  let(:record) do
43
46
  {'age' => 26, 'request_id' => '42', 'parent_id' => 'parent', 'routing_id' => 'routing'}
44
47
  end
@@ -52,7 +55,7 @@ describe Fluent::LogtailOutput do
52
55
  stub = stub_request(:post, "https://in.logs.betterstack.com/").
53
56
  with(
54
57
  :body => start_with("\xDD\x00\x00\x00\x01\x85\xA3age\x1A\xAArequest_id\xA242\xA9parent_id\xA6parent\xAArouting_id\xA7routing\xA2dt\xB4".force_encoding("ASCII-8BIT")),
55
- :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer abcd1234', 'Content-Type'=>'application/msgpack', 'User-Agent'=>'Logtail Fluentd/0.1.1'}
58
+ :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer abcd1234', 'Content-Type'=>'application/msgpack', 'User-Agent'=>user_agent}
56
59
  ).
57
60
  to_return(:status => 202, :body => "", :headers => {})
58
61
 
@@ -86,7 +89,7 @@ describe Fluent::LogtailOutput do
86
89
  stub = stub_request(:post, "https://s1234.eu-nbg-2.betterstackdata.com/").
87
90
  with(
88
91
  :body => start_with("\xDD\x00\x00\x00\x01\x85\xA3age\x1A\xAArequest_id\xA242\xA9parent_id\xA6parent\xAArouting_id\xA7routing\xA2dt\xB4".force_encoding("ASCII-8BIT")),
89
- :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer abcd1234', 'Content-Type'=>'application/msgpack', 'User-Agent'=>'Logtail Fluentd/0.1.1'}
92
+ :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer abcd1234', 'Content-Type'=>'application/msgpack', 'User-Agent'=>user_agent}
90
93
  ).
91
94
  to_return(:status => 202, :body => "", :headers => {})
92
95
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-logtail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logtail.com
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-02-17 00:00:00.000000000 Z
10
+ date: 2026-10-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: fluentd
@@ -79,11 +78,14 @@ extensions: []
79
78
  extra_rdoc_files: []
80
79
  files:
81
80
  - ".github/workflows/main.yml"
81
+ - ".github/workflows/no-closing-keywords.yml"
82
+ - ".github/workflows/release.yml"
82
83
  - ".gitignore"
83
84
  - Gemfile
84
85
  - LICENSE.md
85
86
  - README.md
86
87
  - fluent-plugin-logtail.gemspec
88
+ - lib/fluent/plugin/logtail/version.rb
87
89
  - lib/fluent/plugin/out_logtail.rb
88
90
  - spec/fluent/plugin/out_logtail_spec.rb
89
91
  - spec/spec_helper.rb
@@ -91,7 +93,6 @@ homepage: https://github.com/logtail/fluent-plugin-logtail
91
93
  licenses:
92
94
  - ISC
93
95
  metadata: {}
94
- post_install_message:
95
96
  rdoc_options: []
96
97
  require_paths:
97
98
  - lib
@@ -106,10 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
107
  - !ruby/object:Gem::Version
107
108
  version: '0'
108
109
  requirements: []
109
- rubygems_version: 3.3.7
110
- signing_key:
110
+ rubygems_version: 3.6.9
111
111
  specification_version: 4
112
112
  summary: Logtail.com plugin for Fluentd
113
- test_files:
114
- - spec/fluent/plugin/out_logtail_spec.rb
115
- - spec/spec_helper.rb
113
+ test_files: []