Skip to content

Commit ebeb9b8

Browse files
committed
Merge branch 'main' of github.com:devtron-labs/git-sensor into git-diff-optimise
# Conflicts: # go.mod # go.sum
2 parents 926e790 + a8e6e8b commit ebeb9b8

File tree

114 files changed

+1528
-1608
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1528
-1608
lines changed

api/GrpcHandler.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package api
218

319
import (

api/GrpcHandler_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package api
218

319
import (

api/RestHandler.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/*
2-
* Copyright (c) 2020 Devtron Labs
2+
* Copyright (c) 2020-2024. Devtron Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
1515
*/
1616

1717
package api

api/Router.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
/*
2-
* Copyright (c) 2020 Devtron Labs
2+
* Copyright (c) 2020-2024. Devtron Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
1515
*/
1616

1717
package api
1818

1919
import (
2020
"encoding/json"
21+
"github.com/devtron-labs/common-lib/middlewares"
2122
"github.com/devtron-labs/common-lib/monitoring"
2223
"github.com/devtron-labs/git-sensor/util"
2324
"github.com/gorilla/mux"
@@ -62,6 +63,7 @@ func (r MuxRouter) Init() {
6263
}
6364
_, _ = writer.Write(b)
6465
})
66+
r.Router.Use(middlewares.Recovery)
6567
r.Router.Path("/git-provider").HandlerFunc(r.restHandler.SaveGitProvider).Methods("POST")
6668
r.Router.Path("/git-repo").HandlerFunc(r.restHandler.AddRepo).Methods("POST")
6769
r.Router.Path("/git-repo").HandlerFunc(r.restHandler.UpdateRepo).Methods("PUT")

app/App.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/*
2-
* Copyright (c) 2020 Devtron Labs
2+
* Copyright (c) 2020-2024. Devtron Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
1515
*/
1616

1717
package app
@@ -22,6 +22,7 @@ import (
2222
"github.com/caarlos0/env"
2323
constants "github.com/devtron-labs/common-lib/constants"
2424
pubsub "github.com/devtron-labs/common-lib/pubsub-lib"
25+
"github.com/devtron-labs/common-lib/pubsub-lib/metrics"
2526
"github.com/devtron-labs/git-sensor/api"
2627
"github.com/devtron-labs/git-sensor/bean"
2728
"github.com/devtron-labs/git-sensor/internals/middleware"
@@ -127,6 +128,7 @@ func (app *App) initGrpcServer(port int) error {
127128
}
128129

129130
grpcPanicRecoveryHandler := func(p any) (err error) {
131+
metrics.IncPanicRecoveryCount("grpc", "", "", "")
130132
app.Logger.Error(constants.PanicLogIdentifier, "recovered from panic", "panic", p, "stack", string(debug.Stack()))
131133
return status.Errorf(codes.Internal, "%s", p)
132134
}

bean/bean.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (c) 2024. Devtron Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package bean
218

319
type StartupConfig struct {

git-ask-pass.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
#!/bin/sh
2+
#
3+
# Copyright (c) 2024. Devtron Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
218
# This script is used as the command supplied to GIT_ASKPASS as a way to supply username/password
319
# credentials to git, without having to use git credentials helpers, or having on-disk config.
420
case "$1" in

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ go 1.20
44

55
require (
66
github.com/caarlos0/env v3.5.0+incompatible
7-
github.com/devtron-labs/common-lib v0.0.16-0.20240503082245-7ab933f8381f
7+
github.com/devtron-labs/common-lib v0.0.18-0.20240520062828-c6c38c3f135e
88
github.com/devtron-labs/protos v0.0.3-0.20240527113333-08a3be5ec6c1
99
github.com/gammazero/workerpool v0.0.0-20200206003619-019d125201ab
1010
github.com/go-git/go-git/v5 v5.11.0
1111
github.com/go-pg/pg v6.15.1+incompatible
12-
github.com/google/wire v0.4.0
12+
github.com/google/wire v0.6.0
1313
github.com/gorilla/handlers v1.4.2
1414
github.com/gorilla/mux v1.8.0
1515
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.1
@@ -41,7 +41,7 @@ require (
4141
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
4242
github.com/go-git/go-billy/v5 v5.5.0 // indirect
4343
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
44-
github.com/golang/protobuf v1.5.3 // indirect
44+
github.com/golang/protobuf v1.5.4 // indirect
4545
github.com/gorilla/websocket v1.5.0 // indirect
4646
github.com/hpcloud/tail v1.0.0 // indirect
4747
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
@@ -69,10 +69,10 @@ require (
6969
go.uber.org/atomic v1.10.0 // indirect
7070
go.uber.org/multierr v1.6.0 // indirect
7171
golang.org/x/crypto v0.21.0 // indirect
72-
golang.org/x/mod v0.12.0 // indirect
72+
golang.org/x/mod v0.14.0 // indirect
7373
golang.org/x/net v0.23.0 // indirect
7474
golang.org/x/text v0.14.0 // indirect
75-
golang.org/x/tools v0.13.0 // indirect
75+
golang.org/x/tools v0.17.0 // indirect
7676
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
7777
gopkg.in/fsnotify.v1 v1.4.7 // indirect
7878
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect

0 commit comments

Comments
 (0)