Skip to content

Commit 7188f89

Browse files
authored
NOISSUE - Fix failing CI (#21)
* Fix failing CI Signed-off-by: nyagamunene <[email protected]> * Update check generated files Signed-off-by: nyagamunene <[email protected]> * Update linter and protoc issues Signed-off-by: nyagamunene <[email protected]> * Update protoc version Signed-off-by: nyagamunene <[email protected]> --------- Signed-off-by: nyagamunene <[email protected]>
1 parent 56751e0 commit 7188f89

File tree

12 files changed

+121
-126
lines changed

12 files changed

+121
-126
lines changed

.github/workflows/check-generated-files.yml

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -33,83 +33,83 @@ jobs:
3333
uses: dorny/paths-filter@v3
3434
id: changes
3535
with:
36-
base: main
37-
filters: |
38-
proto:
39-
- ".github/workflows/check-generated-files.yml"
40-
41-
mocks:
42-
- ".github/workflows/check-generated-files.yml"
43-
- "sdk/mocks/sdk.go"
44-
- "mocks/repository.go"
45-
- "mocks/service.go"
46-
47-
- name: Set up protoc
48-
if: steps.changes.outputs.proto == 'true'
49-
run: |
50-
PROTOC_VERSION=27.2
51-
PROTOC_GEN_VERSION=v1.34.2
52-
PROTOC_GRPC_VERSION=v1.4.0
53-
54-
# Download and install protoc
55-
PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip
56-
curl -0L -o $PROTOC_ZIP https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
57-
unzip -o $PROTOC_ZIP -d protoc3
58-
sudo mv protoc3/bin/* /usr/local/bin/
59-
sudo mv protoc3/include/* /usr/local/include/
60-
rm -rf $PROTOC_ZIP protoc3
61-
62-
# Install protoc-gen-go and protoc-gen-go-grpc
63-
go install google.golang.org/protobuf/cmd/protoc-gen-go@$PROTOC_GEN_VERSION
64-
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$PROTOC_GRPC_VERSION
65-
66-
# Add protoc to the PATH
67-
export PATH=$PATH:/usr/local/bin/protoc
68-
69-
- name: Check Protobuf is up to Date
70-
if: steps.changes.outputs.proto == 'true'
71-
run: |
72-
for p in $(find . -name "*.pb.go"); do
73-
mv $p $p.tmp
74-
done
75-
76-
make proto
77-
78-
for p in $(find . -name "*.pb.go"); do
79-
if ! cmp -s $p $p.tmp; then
80-
echo "Error: Proto file and generated Go file $p are out of sync!"
81-
echo "Please run 'make proto' with protoc version $PROTOC_VERSION, protoc-gen-go version $PROTOC_GEN_VERSION and protoc-gen-go-grpc version $PROTOC_GRPC_VERSION and commit the changes."
82-
exit 1
83-
fi
84-
done
85-
86-
- name: Check Mocks are up to Date
87-
if: steps.changes.outputs.mocks == 'true'
88-
run: |
89-
MOCKERY_VERSION=v2.43.2
90-
STRINGER_VERSION=v0.19.0
91-
92-
go install github.com/vektra/mockery/v2@$MOCKERY_VERSION
93-
go install golang.org/x/tools/cmd/stringer@$STRINGER_VERSION
94-
95-
mv ./sdk/mocks/sdk.go ./sdk/mocks/sdk.go.tmp
96-
mv ./mocks/repository.go ./mocks/repository.go.tmp
97-
mv ./mocks/service.go ./mocks/service.go.tmp
98-
99-
make mocks
100-
101-
check_mock_changes() {
102-
local file_path=$1
103-
local tmp_file_path=$1.tmp
104-
local entity_name=$2
105-
106-
if ! cmp -s "$file_path" "$tmp_file_path"; then
107-
echo "Error: Generated mocks for $entity_name are out of sync!"
108-
echo "Please run 'make mocks' with mockery version $MOCKERY_VERSION and commit the changes."
109-
exit 1
110-
fi
111-
}
112-
113-
check_mock_changes ./sdk/mocks/sdk.go "SDK ./sdk/mocks/sdk.go"
114-
check_mock_changes ./mocks/repository.go "Certs Repository ./mocks/repository.go"
115-
check_mock_changes ./mocks/service.go "Certs Service ./mocks/service.go"
36+
base: main
37+
filters: |
38+
proto:
39+
- ".github/workflows/check-generated-files.yml"
40+
41+
mocks:
42+
- ".github/workflows/check-generated-files.yml"
43+
- "sdk/mocks/sdk.go"
44+
- "mocks/repository.go"
45+
- "mocks/service.go"
46+
47+
- name: Set up protoc
48+
if: steps.changes.outputs.proto == 'true'
49+
run: |
50+
PROTOC_VERSION=27.1
51+
PROTOC_GEN_VERSION=v1.34.2
52+
PROTOC_GRPC_VERSION=v1.4.0
53+
54+
# Download and install protoc
55+
PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip
56+
curl -0L -o $PROTOC_ZIP https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP
57+
unzip -o $PROTOC_ZIP -d protoc3
58+
sudo mv protoc3/bin/* /usr/local/bin/
59+
sudo mv protoc3/include/* /usr/local/include/
60+
rm -rf $PROTOC_ZIP protoc3
61+
62+
# Install protoc-gen-go and protoc-gen-go-grpc
63+
go install google.golang.org/protobuf/cmd/protoc-gen-go@$PROTOC_GEN_VERSION
64+
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$PROTOC_GRPC_VERSION
65+
66+
# Add protoc to the PATH
67+
export PATH=$PATH:/usr/local/bin/protoc
68+
69+
- name: Check Protobuf is up to Date
70+
if: steps.changes.outputs.proto == 'true'
71+
run: |
72+
for p in $(find . -name "*.pb.go"); do
73+
mv $p $p.tmp
74+
done
75+
76+
make proto
77+
78+
for p in $(find . -name "*.pb.go"); do
79+
if ! cmp -s $p $p.tmp; then
80+
echo "Error: Proto file and generated Go file $p are out of sync!"
81+
echo "Please run 'make proto' with protoc version $PROTOC_VERSION, protoc-gen-go version $PROTOC_GEN_VERSION and protoc-gen-go-grpc version $PROTOC_GRPC_VERSION and commit the changes."
82+
exit 1
83+
fi
84+
done
85+
86+
- name: Check Mocks are up to Date
87+
if: steps.changes.outputs.mocks == 'true'
88+
run: |
89+
MOCKERY_VERSION=v2.43.2
90+
STRINGER_VERSION=v0.19.0
91+
92+
go install github.com/vektra/mockery/v2@$MOCKERY_VERSION
93+
go install golang.org/x/tools/cmd/stringer@$STRINGER_VERSION
94+
95+
mv ./sdk/mocks/sdk.go ./sdk/mocks/sdk.go.tmp
96+
mv ./mocks/repository.go ./mocks/repository.go.tmp
97+
mv ./mocks/service.go ./mocks/service.go.tmp
98+
99+
make mocks
100+
101+
check_mock_changes() {
102+
local file_path=$1
103+
local tmp_file_path=$1.tmp
104+
local entity_name=$2
105+
106+
if ! cmp -s "$file_path" "$tmp_file_path"; then
107+
echo "Error: Generated mocks for $entity_name are out of sync!"
108+
echo "Please run 'make mocks' with mockery version $MOCKERY_VERSION and commit the changes."
109+
exit 1
110+
fi
111+
}
112+
113+
check_mock_changes ./sdk/mocks/sdk.go "SDK ./sdk/mocks/sdk.go"
114+
check_mock_changes ./mocks/repository.go "Certs Repository ./mocks/repository.go"
115+
check_mock_changes ./mocks/service.go "Certs Service ./mocks/service.go"

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ jobs:
4646
with:
4747
node-version: lts/*
4848

49-
- name: Install dependencies
50-
run: npm install
51-
5249
- name: Run Prettier
5350
id: prettier-run
5451
uses: rutajdash/[email protected]

api/http/responses.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ var (
1919
_ Response = (*ocspRes)(nil)
2020
)
2121

22-
type pageRes struct {
23-
Limit uint64 `json:"limit"`
24-
Offset uint64 `json:"offset"`
25-
Total uint64 `json:"total"`
26-
}
27-
2822
type renewCertRes struct {
2923
renewed bool
3024
}
@@ -135,6 +129,10 @@ func (res listCertsRes) Headers() map[string]string {
135129
return map[string]string{}
136130
}
137131

132+
func (res listCertsRes) Empty() bool {
133+
return false
134+
}
135+
138136
type viewCertRes struct {
139137
SerialNumber string `json:"serial_number"`
140138
Certificate string `json:"certificate"`
@@ -156,10 +154,6 @@ func (res viewCertRes) Empty() bool {
156154
return false
157155
}
158156

159-
func (res listCertsRes) Empty() bool {
160-
return false
161-
}
162-
163157
type ocspRes struct {
164158
template ocsp.Response
165159
signer crypto.Signer

certs_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ import (
2525

2626
const serialNumber = "serial number"
2727

28-
var (
29-
invalidToken = "123"
30-
)
28+
var invalidToken = "123"
3129

3230
func TestIssueCert(t *testing.T) {
3331
cRepo := new(mocks.MockRepository)

cli/certs_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ func TestGetTokenCmd(t *testing.T) {
369369
t.Fatalf("Failed to unmarshal JSON: %v", err)
370370
}
371371
assert.Equal(t, tc.token, token, fmt.Sprintf("%v unexpected response, expected: %v, got: %v", tc.desc, tc.token, token))
372-
373372
}
374373
sdkCall.Unset()
375374
})

cli/config.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,9 @@ type config struct {
4545
const filePermission = 0o644
4646

4747
var (
48-
errReadFail = errors.New("failed to read config file")
49-
errNoKey = errors.New("no such key")
50-
errUnsupportedKeyValue = errors.New("unsupported data type for key")
51-
errWritingConfig = errors.New("error in writing the updated config to file")
52-
errInvalidURL = errors.New("invalid url")
53-
errURLParseFail = errors.New("failed to parse url")
54-
defaultConfigPath = "./config.toml"
48+
errReadFail = errors.New("failed to read config file")
49+
errWritingConfig = errors.New("error in writing the updated config to file")
50+
defaultConfigPath = "./config.toml"
5551
)
5652

5753
func read(file string) (config, error) {

go.mod

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,19 @@ go 1.23.0
44

55
require (
66
github.com/caarlos0/env/v10 v10.0.0
7+
github.com/fatih/color v1.17.0
78
github.com/go-chi/chi v1.5.5
89
github.com/go-kit/kit v0.13.0
910
github.com/gofrs/uuid v4.4.0+incompatible
1011
github.com/golang-jwt/jwt v3.2.2+incompatible
12+
github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f
1113
github.com/jackc/pgx/v5 v5.6.0
1214
github.com/jmoiron/sqlx v1.4.0
1315
github.com/ory/dockertest/v3 v3.11.0
16+
github.com/pelletier/go-toml v1.9.5
1417
github.com/prometheus/client_golang v1.19.1
1518
github.com/rubenv/sql-migrate v1.7.0
19+
github.com/spf13/cobra v1.8.1
1620
github.com/stretchr/testify v1.9.0
1721
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0
1822
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0
@@ -25,6 +29,7 @@ require (
2529
golang.org/x/sync v0.8.0
2630
google.golang.org/grpc v1.65.0
2731
google.golang.org/protobuf v1.34.2
32+
moul.io/http2curl v1.0.0
2833
)
2934

3035
require (
@@ -41,7 +46,6 @@ require (
4146
github.com/docker/docker v27.1.1+incompatible // indirect
4247
github.com/docker/go-connections v0.5.0 // indirect
4348
github.com/docker/go-units v0.5.0 // indirect
44-
github.com/fatih/color v1.17.0 // indirect
4549
github.com/felixge/httpsnoop v1.0.4 // indirect
4650
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
4751
github.com/go-kit/log v0.2.1 // indirect
@@ -52,7 +56,6 @@ require (
5256
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
5357
github.com/google/uuid v1.6.0 // indirect
5458
github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0 // indirect
55-
github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f // indirect
5659
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5760
github.com/jackc/pgpassfile v1.0.0 // indirect
5861
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
@@ -65,14 +68,13 @@ require (
6568
github.com/opencontainers/go-digest v1.0.0 // indirect
6669
github.com/opencontainers/image-spec v1.1.0 // indirect
6770
github.com/opencontainers/runc v1.1.13 // indirect
68-
github.com/pelletier/go-toml v1.9.5 // indirect
6971
github.com/pkg/errors v0.9.1 // indirect
7072
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
7173
github.com/prometheus/client_model v0.6.1 // indirect
7274
github.com/prometheus/common v0.52.2 // indirect
7375
github.com/prometheus/procfs v0.13.0 // indirect
7476
github.com/sirupsen/logrus v1.9.3 // indirect
75-
github.com/spf13/cobra v1.8.1 // indirect
77+
github.com/smartystreets/goconvey v1.8.1 // indirect
7678
github.com/spf13/pflag v1.0.5 // indirect
7779
github.com/stretchr/objx v0.5.2 // indirect
7880
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
@@ -87,5 +89,4 @@ require (
8789
google.golang.org/genproto/googleapis/rpc v0.0.0-20240730163845-b1a4ccb954bf // indirect
8890
gopkg.in/yaml.v2 v2.4.0 // indirect
8991
gopkg.in/yaml.v3 v3.0.1 // indirect
90-
moul.io/http2curl v1.0.0 // indirect
9192
)

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaU
6868
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
6969
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
7070
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
71+
github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g=
72+
github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k=
7173
github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0 h1:CWyXh/jylQWp2dtiV33mY4iSSp6yf4lmn+c7/tN+ObI=
7274
github.com/grpc-ecosystem/grpc-gateway/v2 v2.21.0/go.mod h1:nCLIt0w3Ept2NwF8ThLmrppXsfT07oC8k0XNDxd8sVU=
7375
github.com/hokaccha/go-prettyjson v0.0.0-20211117102719-0474bc63780f h1:7LYC+Yfkj3CTRcShK0KOL/w6iTiKyqqBA9a41Wnggw8=
@@ -84,6 +86,8 @@ github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk
8486
github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
8587
github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
8688
github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY=
89+
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
90+
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
8791
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
8892
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
8993
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -137,6 +141,10 @@ github.com/rubenv/sql-migrate v1.7.0/go.mod h1:S4wtDEG1CKn+0ShpTtzWhFpHHI5PvCUti
137141
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
138142
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
139143
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
144+
github.com/smarty/assertions v1.15.0 h1:cR//PqUBUiQRakZWqBiFFQ9wb8emQGDb0HeGdqGByCY=
145+
github.com/smarty/assertions v1.15.0/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec=
146+
github.com/smartystreets/goconvey v1.8.1 h1:qGjIddxOk4grTu9JPOU31tVfq3cNdBlNa5sSznIX1xY=
147+
github.com/smartystreets/goconvey v1.8.1/go.mod h1:+/u4qLyY6x1jReYOp7GOM2FSt8aP9CzCZL03bI28W60=
140148
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
141149
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
142150
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=

health.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ const (
1717

1818
var (
1919
// Version represents the last service git tag in git history.
20-
// It's meant to be set using go build ldflags:
20+
// It's meant to be set using go build ldflags.
2121
Version = "0.0.0"
2222
// Commit represents the service git commit hash.
23-
// It's meant to be set using go build ldflags:
23+
// It's meant to be set using go build ldflags.
2424

2525
Commit = "ffffffff"
2626
// BuildTime represetns the service build time.
27-
// It's meant to be set using go build ldflags:
27+
// It's meant to be set using go build ldflags.
2828
BuildTime = "1970-01-01_00:00:00"
2929
)
3030

internal/server/http/doc.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
// Copyright (c) Ultraviolet
1+
// Copyright (c) Abstract Machines
2+
// SPDX-License-Identifier: Apache-2.0
23

34
package http

0 commit comments

Comments
 (0)