Skip to content

Commit 1f50676

Browse files
cbruno10kaidaguerregraza-iomisravedjudell
authored
Initial plugin release (#12)
Co-authored-by: kaidaguerre <[email protected]> Co-authored-by: Graza <[email protected]> Co-authored-by: misraved <[email protected]> Co-authored-by: Jon Udell <[email protected]> Co-authored-by: Puskar Basu <[email protected]> Co-authored-by: Keep Focused <[email protected]>
1 parent 654f5fd commit 1f50676

File tree

19 files changed

+2991
-1
lines changed

19 files changed

+2991
-1
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Build and Deploy OCI Image
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
registry_publish_workflow_ghcr:
10+
uses: turbot/steampipe-workflows/.github/workflows/registry-publish-ghcr.yml@main
11+
secrets: inherit
12+
with:
13+
releaseTimeout: 60m
14+
pipeling: tailpipe

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ go.work.sum
2323

2424
# env file
2525
.env
26+
.idea/

.goreleaser.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This is an example goreleaser.yaml file with some sane defaults.
2+
# Make sure to check the documentation at http://goreleaser.com
3+
before:
4+
hooks:
5+
- go mod tidy
6+
builds:
7+
- env:
8+
- CGO_ENABLED=0
9+
- GO111MODULE=on
10+
- GOPRIVATE=github.com/turbot
11+
goos:
12+
- linux
13+
- darwin
14+
15+
goarch:
16+
- amd64
17+
- arm64
18+
19+
id: "tailpipe"
20+
binary: "{{ .ProjectName }}.plugin"
21+
# flags:
22+
# - -tags=netgo
23+
24+
archives:
25+
- format: gz
26+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
27+
files:
28+
- none*
29+
checksum:
30+
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
31+
algorithm: sha256
32+
changelog:
33+
sort: asc
34+
filters:
35+
exclude:
36+
- "^docs:"
37+
- "^test:"

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## v0.1.0 [2025-02-11]
2+
3+
_What's new?_
4+
5+
- New tables added
6+
- [github_audit_log](https://hub.tailpipe.io/plugins/turbot/github/tables/github_audit_log)

Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
TAILPIPE_INSTALL_DIR ?= ~/.tailpipe
2+
BUILD_TAGS = netgo
3+
install:
4+
go build -o $(TAILPIPE_INSTALL_DIR)/plugins/hub.tailpipe.io/plugins/turbot/github@latest/tailpipe-plugin-github.plugin -tags "${BUILD_TAGS}" *.go
5+
6+
## Paths
7+
#PLUGIN_NAME=tailpipe-plugin-github.plugin
8+
#PLUGIN_DIR=~/.tailpipe/plugins/hub.tailpipe.io/plugins/turbot/github@latest/
9+
#
10+
## Build in development mode by default
11+
#.PHONY: default
12+
#default: install
13+
#
14+
## Production build, optimized
15+
#.PHONY: build
16+
#build:
17+
# go build -o $(PLUGIN_NAME) .
18+
#
19+
## Install the development build
20+
#.PHONY: install
21+
#install: build
22+
# mv $(PLUGIN_NAME) $(PLUGIN_DIR)
23+
#
24+
## Run tests
25+
#.PHONY: test
26+
#test:
27+
# go test ./... -v
28+
#
29+
## Clean up generated files
30+
#.PHONY: clean
31+
#clean:
32+
# rm -f $(PLUGIN_NAME)

README.md

Lines changed: 143 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,143 @@
1-
# tailpipe-plugin-github
1+
# GitHub Plugin for Tailpipe
2+
3+
[Tailpipe](https://tailpipe.io) is an open-source CLI tool that allows you to collect logs and query them with SQL.
4+
5+
[GitHub](https://www.github.com/) is a provider of Internet hosting for software development and version control using Git. It offers the distributed version control and source code management (SCM) functionality of Git, plus its own features.
6+
7+
The [GitHub Plugin for Tailpipe](https://hub.tailpipe.io/plugins/turbot/github) allows you to collect and query GitHub audit logs using SQL to track activity, monitor trends, detect anomalies, and more!
8+
9+
- **[Get started →](https://hub.tailpipe.io/plugins/turbot/github)**
10+
- Documentation: [Table definitions & examples](https://hub.tailpipe.io/plugins/turbot/github/tables)
11+
- Community: [Join #tailpipe on Slack →](https://turbot.com/community/join)
12+
- Get involved: [Issues](https://github.com/turbot/tailpipe-plugin-github/issues)
13+
14+
Collect and query logs:
15+
![image](docs/images/github_audit_log_terminal.png)
16+
17+
## Getting Started
18+
19+
Install Tailpipe from the [downloads](https://tailpipe.io/downloads) page:
20+
21+
```sh
22+
# MacOS
23+
brew install turbot/tap/tailpipe
24+
```
25+
26+
```sh
27+
# Linux or Windows (WSL)
28+
sudo /bin/sh -c "$(curl -fsSL https://tailpipe.io/install/tailpipe.sh)"
29+
```
30+
31+
Install the plugin:
32+
33+
```sh
34+
tailpipe plugin install github
35+
```
36+
37+
Configure your [connection credentials](https://hub.tailpipe.io/plugins/turbot/github#connection-credentials), table partition, and data source ([examples](https://hub.tailpipe.io/plugins/turbot/github/tables/github_audit_log#example-configurations)):
38+
39+
```sh
40+
vi ~/.tailpipe/config/github.tpc
41+
```
42+
43+
```hcl
44+
partition "github_audit_log" "my_logs" {
45+
source "file" {
46+
paths = ["/Users/myuser/github_audit_logs"]
47+
file_layout = "%{DATA}.json.gz"
48+
}
49+
}
50+
```
51+
52+
Download, enrich, and save logs from your source ([examples](https://tailpipe.io/docs/reference/cli/collect)):
53+
54+
```sh
55+
tailpipe collect github_audit_log
56+
```
57+
58+
Enter interactive query mode:
59+
60+
```sh
61+
tailpipe query
62+
```
63+
64+
Run a query:
65+
66+
```sql
67+
select
68+
action,
69+
count(*) as action_count
70+
from
71+
github_audit_log
72+
group by
73+
action
74+
order by
75+
action_count desc;
76+
```
77+
78+
```sh
79+
+----------------------------------------+--------------+
80+
| action | action_count |
81+
+----------------------------------------+--------------+
82+
| pull_request.create | 9894 |
83+
| pull_request.merge | 7440 |
84+
| issue_comment.update | 5832 |
85+
| packages.package_version_published | 4990 |
86+
| protected_branch.policy_override | 4012 |
87+
| pull_request_review.submit | 3672 |
88+
| pull_request_review_comment.create | 2516 |
89+
| pull_request.close | 2462 |
90+
| pull_request.create_review_request | 2438 |
91+
| repository_vulnerability_alert.create | 1972 |
92+
| repository_vulnerability_alert.resolve | 1486 |
93+
| repo.change_merge_setting | 892 |
94+
+----------------------------------------+--------------+
95+
```
96+
97+
## Developing
98+
99+
Prerequisites:
100+
101+
- [Tailpipe](https://tailpipe.io/downloads)
102+
- [Golang](https://golang.org/doc/install)
103+
104+
Clone:
105+
106+
```sh
107+
git clone https://github.com/turbot/tailpipe-plugin-github.git
108+
cd tailpipe-plugin-github
109+
```
110+
111+
After making your local changes, build the plugin, which automatically installs the new version to your `~/.tailpipe/plugins` directory:
112+
113+
```sh
114+
make
115+
```
116+
117+
Re-collect your data:
118+
119+
```sh
120+
tailpipe collect github_audit_log
121+
```
122+
123+
Try it!
124+
125+
```sh
126+
tailpipe query
127+
> .inspect github_audit_log
128+
```
129+
130+
## Open Source & Contributing
131+
132+
This repository is published under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) (source code) and [CC BY-NC-ND](https://creativecommons.org/licenses/by-nc-nd/2.0/) (docs) licenses. Please see our [code of conduct](https://github.com/turbot/.github/blob/main/CODE_OF_CONDUCT.md). We look forward to collaborating with you!
133+
134+
[Tailpipe](https://tailpipe.io) is a product produced from this open source software, exclusively by [Turbot HQ, Inc](https://turbot.com). It is distributed under our commercial terms. Others are allowed to make their own distribution of the software, but cannot use any of the Turbot trademarks, cloud services, etc. You can learn more in our [Open Source FAQ](https://turbot.com/open-source).
135+
136+
## Get Involved
137+
138+
**[Join #tailpipe on Slack →](https://turbot.com/community/join)**
139+
140+
Want to help but don't know where to start? Pick up one of the `help wanted` issues:
141+
142+
- [Tailpipe](https://github.com/turbot/tailpipe/labels/help%20wanted)
143+
- [GitHub Plugin](https://github.com/turbot/tailpipe-plugin-github/labels/help%20wanted)

config/github_connection.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package config
2+
3+
const PluginName = "github"
4+
5+
type GitHubConnection struct {
6+
}
7+
8+
func (c *GitHubConnection) Identifier() string {
9+
return PluginName
10+
}
11+
12+
func (c *GitHubConnection) Validate() error {
13+
return nil
14+
}

0 commit comments

Comments
 (0)