Skip to content

Commit c392fa2

Browse files
authored
Merge pull request #2 from gbenhaim/add-tests
CI and Build
2 parents e2a231e + ada67a2 commit c392fa2

File tree

7 files changed

+158
-115
lines changed

7 files changed

+158
-115
lines changed

.github/workflows/go-lint.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: Go Lint
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: '1.21'
23+
24+
- name: Run Lint
25+
run: make lint

.github/workflows/go-test.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: Go Tests
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: '1.21'
23+
24+
- name: Test
25+
run: make test

Dockerfile

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Build the manager binary
2-
FROM golang:1.22 AS builder
1+
FROM registry.redhat.io/rhel9/go-toolset:1.21.9-1.1717085562 AS builder
2+
33
ARG TARGETOS
44
ARG TARGETARCH
55

6-
WORKDIR /workspace
6+
WORKDIR /opt/app-root/src
77
# Copy the Go Modules manifests
88
COPY go.mod go.mod
99
COPY go.sum go.sum
@@ -13,7 +13,6 @@ RUN go mod download
1313

1414
# Copy the go source
1515
COPY cmd/main.go cmd/main.go
16-
COPY api/ api/
1716
COPY internal/controller/ internal/controller/
1817

1918
# Build
@@ -23,11 +22,10 @@ COPY internal/controller/ internal/controller/
2322
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
2423
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
2524

26-
# Use distroless as minimal base image to package the manager binary
27-
# Refer to https://github.com/GoogleContainerTools/distroless for more details
28-
FROM gcr.io/distroless/static:nonroot
29-
WORKDIR /
30-
COPY --from=builder /workspace/manager .
25+
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.4-1134
26+
27+
COPY LICENSE /licenses
28+
COPY --from=builder /opt/app-root/src/manager /
3129
USER 65532:65532
3230

3331
ENTRYPOINT ["/manager"]

go.mod

+31-32
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
module github.com/konflux-ci/notification-service
22

3-
go 1.22.0
4-
5-
toolchain go1.22.4
3+
go 1.21.9
64

75
require (
8-
github.com/go-logr/logr v1.4.1
6+
github.com/go-logr/logr v1.4.2
97
github.com/konflux-ci/operator-toolkit v0.0.0-20240402130556-ef6dcbeca69d
10-
github.com/onsi/ginkgo/v2 v2.17.1
11-
github.com/onsi/gomega v1.32.0
12-
github.com/tektoncd/pipeline v0.61.0
13-
k8s.io/apimachinery v0.30.0
14-
k8s.io/client-go v0.30.0
15-
knative.dev/pkg v0.0.0-20240625144936-ee1db869c7ef
16-
sigs.k8s.io/controller-runtime v0.18.2
8+
github.com/onsi/ginkgo/v2 v2.19.0
9+
github.com/onsi/gomega v1.33.1
10+
github.com/tektoncd/pipeline v0.60.2
11+
k8s.io/apimachinery v0.29.6
12+
k8s.io/client-go v0.29.6
13+
knative.dev/pkg v0.0.0-20240116073220-b488e7be5902
14+
sigs.k8s.io/controller-runtime v0.17.5
1715
)
1816

1917
require (
@@ -26,23 +24,23 @@ require (
2624
github.com/cespare/xxhash/v2 v2.2.0 // indirect
2725
github.com/davecgh/go-spew v1.1.1 // indirect
2826
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
29-
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
27+
github.com/evanphx/json-patch/v5 v5.8.0 // indirect
3028
github.com/fsnotify/fsnotify v1.7.0 // indirect
3129
github.com/go-kit/log v0.2.1 // indirect
3230
github.com/go-logfmt/logfmt v0.5.1 // indirect
3331
github.com/go-logr/zapr v1.3.0 // indirect
3432
github.com/go-openapi/jsonpointer v0.19.6 // indirect
3533
github.com/go-openapi/jsonreference v0.20.2 // indirect
3634
github.com/go-openapi/swag v0.22.3 // indirect
37-
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
35+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
3836
github.com/gogo/protobuf v1.3.2 // indirect
3937
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4038
github.com/golang/protobuf v1.5.4 // indirect
4139
github.com/google/cel-go v0.20.1 // indirect
4240
github.com/google/gnostic-models v0.6.8 // indirect
4341
github.com/google/go-cmp v0.6.0 // indirect
4442
github.com/google/gofuzz v1.2.0 // indirect
45-
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
43+
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
4644
github.com/google/uuid v1.6.0 // indirect
4745
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
4846
github.com/imdario/mergo v0.3.13 // indirect
@@ -53,9 +51,9 @@ require (
5351
github.com/modern-go/reflect2 v1.0.2 // indirect
5452
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
5553
github.com/pkg/errors v0.9.1 // indirect
56-
github.com/prometheus/client_golang v1.19.1 // indirect
57-
github.com/prometheus/client_model v0.6.1 // indirect
58-
github.com/prometheus/common v0.54.0 // indirect
54+
github.com/prometheus/client_golang v1.18.0 // indirect
55+
github.com/prometheus/client_model v0.5.0 // indirect
56+
github.com/prometheus/common v0.46.0 // indirect
5957
github.com/prometheus/procfs v0.12.0 // indirect
6058
github.com/prometheus/statsd_exporter v0.22.7 // indirect
6159
github.com/spf13/pflag v1.0.5 // indirect
@@ -64,28 +62,29 @@ require (
6462
go.uber.org/multierr v1.11.0 // indirect
6563
go.uber.org/zap v1.27.0 // indirect
6664
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
67-
golang.org/x/net v0.26.0 // indirect
68-
golang.org/x/oauth2 v0.21.0 // indirect
65+
golang.org/x/net v0.25.0 // indirect
66+
golang.org/x/oauth2 v0.20.0 // indirect
6967
golang.org/x/sync v0.7.0 // indirect
70-
golang.org/x/sys v0.21.0 // indirect
71-
golang.org/x/term v0.21.0 // indirect
72-
golang.org/x/text v0.16.0 // indirect
68+
golang.org/x/sys v0.20.0 // indirect
69+
golang.org/x/term v0.20.0 // indirect
70+
golang.org/x/text v0.15.0 // indirect
7371
golang.org/x/time v0.5.0 // indirect
74-
golang.org/x/tools v0.22.0 // indirect
72+
golang.org/x/tools v0.21.0 // indirect
7573
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
76-
google.golang.org/api v0.183.0 // indirect
77-
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect
78-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
74+
google.golang.org/api v0.171.0 // indirect
75+
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect
76+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect
7977
google.golang.org/grpc v1.64.0 // indirect
80-
google.golang.org/protobuf v1.34.2 // indirect
78+
google.golang.org/protobuf v1.34.1 // indirect
8179
gopkg.in/inf.v0 v0.9.1 // indirect
8280
gopkg.in/yaml.v2 v2.4.0 // indirect
8381
gopkg.in/yaml.v3 v3.0.1 // indirect
84-
k8s.io/api v0.30.0 // indirect
85-
k8s.io/apiextensions-apiserver v0.30.0 // indirect
86-
k8s.io/klog/v2 v2.120.1 // indirect
87-
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
88-
k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect
82+
k8s.io/api v0.29.6 // indirect
83+
k8s.io/apiextensions-apiserver v0.29.2 // indirect
84+
k8s.io/component-base v0.29.2 // indirect
85+
k8s.io/klog/v2 v2.110.1 // indirect
86+
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
87+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
8988
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
9089
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
9190
sigs.k8s.io/yaml v1.4.0 // indirect

0 commit comments

Comments
 (0)