Skip to content

Commit

Permalink
Merge pull request #1 from brody192/updates
Browse files Browse the repository at this point in the history
small updates
  • Loading branch information
brody192 authored Mar 2, 2024
2 parents d7685c2 + 89dd05b commit 81de1a7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 51 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.3-alpine3.18 as builder
FROM golang:1.22.0-alpine as builder

WORKDIR /app

Expand All @@ -8,7 +8,7 @@ RUN go mod download

COPY . ./

RUN go build -ldflags "-w -s -extldflags '-static'" -trimpath -a -o main
RUN go build -ldflags "-w -s" -o main

FROM gcr.io/distroless/static

Expand Down
19 changes: 9 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
module main

go 1.21.3
go 1.22.0

require (
github.com/brody192/genqlient v0.0.1
github.com/brody192/logger v0.0.3
github.com/go-co-op/gocron v1.35.2
github.com/google/uuid v1.4.0
github.com/gorilla/schema v1.2.0
github.com/brody192/logger v0.0.5
github.com/go-co-op/gocron v1.37.0
github.com/google/uuid v1.6.0
github.com/gorilla/schema v1.2.1
github.com/robfig/cron/v3 v3.0.1
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225
)

require (
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/alexflint/go-arg v1.4.3 // indirect
github.com/alexflint/go-scalar v1.2.0 // indirect
github.com/vektah/gqlparser/v2 v2.5.10 // indirect
github.com/vektah/gqlparser/v2 v2.5.11 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/tools v0.18.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
40 changes: 18 additions & 22 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,21 @@ github.com/bradleyjkemp/cupaloy/v2 v2.8.0 h1:any4BmKE+jGIaMpnU8YgH/I2LPiLBufr6oM
github.com/bradleyjkemp/cupaloy/v2 v2.8.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0=
github.com/brody192/genqlient v0.0.1 h1:uAX6azSukJI+Z/CQ+c1n0zWhqfo4Z2U+bI9JYS0BeJg=
github.com/brody192/genqlient v0.0.1/go.mod h1:LTRv7kq7++Mb81acucp6h7p7ZPImQyrrYdAQwrybHo4=
github.com/brody192/logger v0.0.2 h1:6oar2SjCSbvuI/6rd4YxLrKq3rK8ESzoM4INDKLCwBM=
github.com/brody192/logger v0.0.2/go.mod h1:U5FG46DkOU21OlsjjoMIwXOnh2+8/erIMTNUGag3pwU=
github.com/brody192/logger v0.0.3 h1:5tgw4Bs/NDP9iMdmOS7knR3/cbvu5OzO0q3tf28EEqc=
github.com/brody192/logger v0.0.3/go.mod h1:U5FG46DkOU21OlsjjoMIwXOnh2+8/erIMTNUGag3pwU=
github.com/brody192/logger v0.0.5 h1:1xfbVnWijvpB0gPwUVyjlGIp45n1e650bYovdTREyag=
github.com/brody192/logger v0.0.5/go.mod h1:U5FG46DkOU21OlsjjoMIwXOnh2+8/erIMTNUGag3pwU=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g=
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
github.com/go-co-op/gocron v1.35.2 h1:lG3rdA9TqBBC/PtT2ukQqgLm6jEepnAzz3+OQetvPTE=
github.com/go-co-op/gocron v1.35.2/go.mod h1:NLi+bkm4rRSy1F8U7iacZOz0xPseMoIOnvabGoSe/no=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/go-co-op/gocron v1.37.0 h1:ZYDJGtQ4OMhTLKOKMIch+/CY70Brbb1dGdooLEhh7b0=
github.com/go-co-op/gocron v1.37.0/go.mod h1:3L/n6BkO7ABj+TrfSVXLRzsP26zmikL4ISkLQ0O8iNY=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc=
github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/schema v1.2.1 h1:tjDxcmdb+siIqkTNoV+qRH2mjYdr2hHe5MKXbp61ziM=
github.com/gorilla/schema v1.2.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
Expand Down Expand Up @@ -59,21 +57,19 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/vektah/gqlparser/v2 v2.5.10 h1:6zSM4azXC9u4Nxy5YmdmGu4uKamfwsdKTwp5zsEealU=
github.com/vektah/gqlparser/v2 v2.5.10/go.mod h1:1rCcfwB2ekJofmluGWXMSEnPMZgbxzwj6FaZ/4OT8Cc=
github.com/vektah/gqlparser/v2 v2.5.11 h1:JJxLtXIoN7+3x6MBdtIP59TP1RANnY7pXOaDnADQSf8=
github.com/vektah/gqlparser/v2 v2.5.11/go.mod h1:1rCcfwB2ekJofmluGWXMSEnPMZgbxzwj6FaZ/4OT8Cc=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ=
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ=
golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
Expand Down
18 changes: 12 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,31 @@ func main() {
os.Exit(1)
}

if len(schedules) == 0 {
logger.Stderr.Error("no schedules found")
logger.Stdout.Info("set at least one or more schedules with 'SCHEDULE_1', 'SCHEDULE_2', etc. variables")
os.Exit(1)
}

logger.Stdout.Info("parsed schedules from environment successfully",
slog.Int("found_schedules", len(schedules)),
)

railwayClient := railway.NewAuthedClient(railwayToken)

// print schedules for viewing purposes
for _, schedule := range schedules {
project, err := railway.Project(railwayClient, schedule.ProjectID)
for i := range schedules {
project, err := railway.Project(railwayClient, schedules[i].ProjectID)
if err != nil {
logger.Stderr.Error("failed retrieving project information", logger.ErrAttr(err), slog.String("project_id", schedule.ProjectID))
logger.Stderr.Error("failed retrieving project information", logger.ErrAttr(err), slog.String("project_id", schedules[i].ProjectID))
os.Exit(1)
}

logger.Stdout.Info("found schedule",
slog.String("service_id", schedule.ServiceID),
slog.String("service_id", schedules[i].ServiceID),
slog.String("project_name", project.Project.Name),
slog.String("action", string(schedule.Action)),
slog.String("expression", schedule.Expression),
slog.String("action", string(schedules[i].Action)),
slog.String("expression", schedules[i].Expression),
)
}

Expand Down
11 changes: 0 additions & 11 deletions railway.json

This file was deleted.

0 comments on commit 81de1a7

Please sign in to comment.