Skip to content

Commit d138567

Browse files
committed
Latest
1 parent 0e6f7b9 commit d138567

7 files changed

Lines changed: 248 additions & 139 deletions

File tree

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,45 @@
1-
name: Publish Docker image
2-
1+
name: Docker
32
on: [push]
43

54
jobs:
5+
define-matrix:
6+
runs-on: ubuntu-latest
7+
8+
outputs:
9+
images: ${{ steps.images.outputs.images }}
10+
11+
steps:
12+
- name: Check out the repo
13+
uses: actions/checkout@v4
14+
15+
- name: Define Images
16+
id: images
17+
env:
18+
DEFAULT_NAME: ${{ github.repository }}
19+
OWNER: ${{ github.repository_owner }}
20+
run: |
21+
ls Dockerfile* \
22+
| jq -R -s -c '
23+
split("\n")[:-1]
24+
| map({
25+
"name": (
26+
if . == "Dockerfile"
27+
then env.DEFAULT_NAME
28+
else ( env.OWNER + "/" + ltrimstr("Dockerfile.") )
29+
end
30+
),
31+
"file": .
32+
}) ' \
33+
| awk '{print "images="$1}' \
34+
>> "$GITHUB_OUTPUT"
35+
636
push_to_registries:
7-
name: Push Docker image to multiple registries
37+
needs: define-matrix
38+
strategy:
39+
matrix:
40+
image: ${{ fromJSON(needs.define-matrix.outputs.images) }}
41+
42+
name: Build and Push Docker Image
843
runs-on: ubuntu-latest
944
permissions:
1045
packages: write
@@ -24,7 +59,7 @@ jobs:
2459
id: meta
2560
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
2661
with:
27-
images: ghcr.io/${{ github.repository }}
62+
images: ghcr.io/${{ matrix.image.name }}
2863
tags: |
2964
type=sha,format=long,prefix=
3065
type=raw,value=latest,enable={{is_default_branch}}
@@ -34,6 +69,7 @@ jobs:
3469
with:
3570
context: .
3671
push: true
72+
file: ${{ matrix.image.file }}
3773
tags: ${{ steps.meta.outputs.tags }}
3874
labels: ${{ steps.meta.outputs.labels }}
3975
build-args: |

.github/workflows/lint.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
golangci:
14-
name: lint
13+
lint:
14+
name: Linting
1515
runs-on: ubuntu-latest
16+
1617
steps:
1718
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
1821
- uses: actions/setup-go@v5
1922
with:
20-
go-version: '1.24'
23+
go-version: stable
2124
- name: golangci-lint
22-
uses: golangci/golangci-lint-action@v6
25+
uses: golangci/golangci-lint-action@v7
2326
with:
24-
version: v1.64
27+
version: v2.0
2528
args: --timeout=5m

.golangci.yml

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,48 @@
1-
---
2-
1+
version: "2"
32
run:
43
tests: true
5-
64
linters:
75
enable:
8-
- errcheck
9-
- gofmt
10-
- gosimple
11-
- govet
12-
- ineffassign
6+
- asciicheck
7+
- bidichk
8+
- gocheckcompilerdirectives
139
- misspell
1410
- rowserrcheck
1511
- sqlclosecheck
16-
- staticcheck
17-
- typecheck
18-
- unused
12+
- forbidigo
1913
disable:
20-
- wsl
21-
- prealloc
2214
- gochecknoglobals
23-
disable-all: false
24-
presets:
25-
- bugs
26-
- unused
27-
fast: true
28-
15+
- prealloc
16+
- wsl
17+
exclusions:
18+
generated: lax
19+
presets:
20+
- comments
21+
- common-false-positives
22+
- legacy
23+
- std-error-handling
24+
paths:
25+
- third_party$
26+
- builtin$
27+
- examples$
28+
rules:
29+
- path: cmd
30+
linters:
31+
- forbidigo
32+
settings:
33+
forbidigo:
34+
forbid:
35+
- pattern: ^proto\.GetExtension.*$
36+
msg: "Use protosrc.GetExtension instead of proto.GetExtension"
37+
- pattern: ^protojson.*
38+
msg: "Use j5codec instead of protojson"
39+
- pattern: ^(fmt\.Print(|f|ln))$
40+
formatters:
41+
enable:
42+
- gofmt
43+
exclusions:
44+
generated: lax
45+
paths:
46+
- third_party$
47+
- builtin$
48+
- examples$

cmd/lambda/lambda.go

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ import (
1111
"github.com/aws/aws-sdk-go-v2/config"
1212
"github.com/aws/aws-sdk-go-v2/service/eventbridge"
1313
"github.com/aws/aws-sdk-go-v2/service/secretsmanager"
14-
"github.com/aws/aws-sdk-go-v2/service/sns"
1514
"github.com/pentops/log.go/log"
1615
"github.com/pentops/o5-github-lambda/internal/github"
17-
"github.com/pentops/o5-runtime-sidecar/awsmsg"
16+
sceb "github.com/pentops/o5-runtime-sidecar/adapters/eventbridge"
1817
)
1918

2019
var Version string
@@ -76,21 +75,20 @@ func do(ctx context.Context) error {
7675
return fmt.Errorf("decoding secret: %w", err)
7776
}
7877

79-
publishers := []awsmsg.Publisher{}
80-
81-
targetTopicARN := os.Getenv("TARGET_TOPIC_ARN")
82-
if targetTopicARN != "" {
83-
snsClient := sns.NewFromConfig(awsConfig)
84-
snsPublisher := awsmsg.NewSNSPublisher(snsClient, targetTopicARN)
85-
publishers = append(publishers, snsPublisher)
86-
}
78+
publishers := []github.Publisher{}
8779

8880
targetEventBusARN := os.Getenv("TARGET_EVENT_BUS_ARN")
89-
if targetEventBusARN != "" {
90-
eventBridgeClient := eventbridge.NewFromConfig(awsConfig)
91-
eventBridgePublisher := awsmsg.NewEventBridgePublisher(eventBridgeClient, targetEventBusARN)
92-
publishers = append(publishers, eventBridgePublisher)
81+
if targetEventBusARN == "" {
82+
return fmt.Errorf("TARGET_EVENT_BUS_ARN is required")
83+
}
84+
eventBridgeClient := eventbridge.NewFromConfig(awsConfig)
85+
eventBridgePublisher, err := sceb.NewEventBridgePublisher(eventBridgeClient, sceb.EventBridgeConfig{
86+
BusARN: targetEventBusARN,
87+
})
88+
if err != nil {
89+
return fmt.Errorf("creating eventbridge publisher: %w", err)
9390
}
91+
publishers = append(publishers, eventBridgePublisher)
9492

9593
webhook, err := github.NewWebhookWorker(secretVal.GithubWebhookSecret, sourceConfig, publishers...)
9694
if err != nil {

go.mod

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,50 @@
11
module github.com/pentops/o5-github-lambda
22

3-
go 1.22.4
3+
go 1.24.0
4+
5+
toolchain go1.24.4
46

57
require (
68
github.com/aws/aws-lambda-go v1.47.0
7-
github.com/aws/aws-sdk-go-v2 v1.30.5
8-
github.com/aws/aws-sdk-go-v2/config v1.27.33
9+
github.com/aws/aws-sdk-go-v2 v1.36.5
10+
github.com/aws/aws-sdk-go-v2/config v1.29.9
911
github.com/aws/aws-sdk-go-v2/service/eventbridge v1.33.3
1012
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.29.3
1113
github.com/aws/aws-sdk-go-v2/service/sns v1.31.3
1214
github.com/google/go-github/v47 v47.1.0
13-
github.com/pentops/log.go v0.0.0-20240806161938-2742d05b4c24
14-
github.com/pentops/o5-messaging v0.0.0-20240917175438-554bc6c7bc73
15-
github.com/pentops/o5-runtime-sidecar v0.0.0-20240810015839-4cbad3cb2923
15+
github.com/pentops/log.go v0.0.16
16+
github.com/pentops/o5-messaging v0.0.0-20250804183335-7df32a9e4659
17+
github.com/pentops/o5-runtime-sidecar v0.0.0-20250802182415-22432fd531ae
1618
)
1719

1820
require (
19-
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.34.2-20240717164558-a6c49f84cc0f.2 // indirect
20-
github.com/aws/aws-sdk-go-v2/credentials v1.17.32 // indirect
21-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13 // indirect
22-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17 // indirect
23-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17 // indirect
24-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
25-
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.17 // indirect
26-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 // indirect
27-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19 // indirect
21+
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.6-20250603165357-b52ab10f4468.1 // indirect
22+
github.com/aws/aws-sdk-go-v2/credentials v1.17.62 // indirect
23+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 // indirect
24+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.36 // indirect
25+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.36 // indirect
26+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
27+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.36 // indirect
28+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.4 // indirect
29+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.17 // indirect
2830
github.com/aws/aws-sdk-go-v2/service/sqs v1.34.3 // indirect
29-
github.com/aws/aws-sdk-go-v2/service/sso v1.22.7 // indirect
30-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.7 // indirect
31-
github.com/aws/aws-sdk-go-v2/service/sts v1.30.7 // indirect
32-
github.com/aws/smithy-go v1.20.4 // indirect
33-
github.com/fatih/color v1.17.0 // indirect
31+
github.com/aws/aws-sdk-go-v2/service/sso v1.25.1 // indirect
32+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.1 // indirect
33+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.17 // indirect
34+
github.com/aws/smithy-go v1.22.4 // indirect
35+
github.com/fatih/color v1.18.0 // indirect
3436
github.com/google/go-querystring v1.1.0 // indirect
3537
github.com/google/uuid v1.6.0 // indirect
36-
github.com/mattn/go-colorable v0.1.13 // indirect
38+
github.com/iancoleman/strcase v0.3.0 // indirect
39+
github.com/mattn/go-colorable v0.1.14 // indirect
3740
github.com/mattn/go-isatty v0.0.20 // indirect
38-
github.com/pentops/j5 v0.0.0-20240923235006-4e9cc847f113 // indirect
39-
golang.org/x/crypto v0.26.0 // indirect
40-
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect
41-
golang.org/x/net v0.28.0 // indirect
42-
golang.org/x/sys v0.25.0 // indirect
43-
golang.org/x/text v0.18.0 // indirect
44-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
45-
google.golang.org/grpc v1.66.0 // indirect
46-
google.golang.org/protobuf v1.34.2 // indirect
41+
github.com/pentops/j5 v0.0.0-20250804180511-490f30d7c098 // indirect
42+
github.com/shopspring/decimal v1.4.0 // indirect
43+
golang.org/x/crypto v0.39.0 // indirect
44+
golang.org/x/net v0.40.0 // indirect
45+
golang.org/x/sys v0.33.0 // indirect
46+
golang.org/x/text v0.26.0 // indirect
47+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
48+
google.golang.org/grpc v1.73.0 // indirect
49+
google.golang.org/protobuf v1.36.6 // indirect
4750
)

0 commit comments

Comments
 (0)