Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api v1 #21

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Check pull request
on: pull_request
env:
NAME: nais-api-reconcilers
IMAGE_REPOSITORY: oci://europe-north1-docker.pkg.dev/nais-io/nais
jobs:
test:
name: Check pull request
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: asdf-vm/actions/setup@v3
Expand Down Expand Up @@ -41,4 +44,33 @@ jobs:
run: |
make fmt
make generate
git diff --exit-code --name-only
git diff --exit-code --name-only

build_push:
outputs:
version: ${{ steps.build-push-sign.outputs.version }}
permissions:
contents: read
id-token: write
name: Build and push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: go_version
run: echo "go_version=$(cat .tool-versions | grep golang | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: nais/platform-build-push-sign@main
id: build-push-sign
with:
name: ${{ env.NAME }}
build_args: GO_VERSION=${{ steps.go_version.outputs.go_version }}-
google_service_account: gh-api-reconcilers
workload_identity_provider: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}
push: true
- name: Build Chart
run: |-
sed -i "s/^version: .*/version: ${{ steps.build-push-sign.outputs.version }}/g" charts/Chart.yaml
cat charts/Chart.yaml
helm package charts
- name: Push Chart
run: |-
helm push ${{ env.NAME }}*.tgz ${{ env.IMAGE_REPOSITORY }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG GO_VERSION=""
FROM golang:${GO_VERSION}alpine as builder
FROM golang:${GO_VERSION}alpine AS builder
WORKDIR /src
COPY go.* /src/
RUN go mod download
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ local:
test:
go test ./...

check: staticcheck vulncheck deadcode
check: staticcheck vulncheck deadcode gosec

staticcheck:
go run honnef.co/go/tools/cmd/staticcheck@latest ./...
Expand All @@ -30,6 +30,9 @@ vulncheck:
deadcode:
go run golang.org/x/tools/cmd/deadcode@latest -test ./...

gosec:
go run github.com/securego/gosec/v2/cmd/gosec@latest --exclude-generated -terse ./...

fmt:
go run mvdan.cc/gofumpt@latest -w ./

Expand Down
2 changes: 1 addition & 1 deletion charts/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
image:
repository: europe-north1-docker.pkg.dev/nais-io/nais/images/api-reconcilers
repository: europe-north1-docker.pkg.dev/nais-io/nais/images/nais-api-reconcilers
tag: main
resources:
requests:
Expand Down
28 changes: 15 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ require (
github.com/google/uuid v1.6.0
github.com/grafana/grafana-openapi-client-go v0.0.0-20240826142251-d1c93bae4198
github.com/joho/godotenv v1.5.1
github.com/nais/api v0.0.0-20240702091139-fe19bb3460df
github.com/nais/api/pkg/apiclient v0.0.0-20241111133716-81030e9e22c6
github.com/nais/dependencytrack v0.0.0-20240826042152-d9faa3523a2f
github.com/prometheus/client_golang v1.20.2
github.com/sethvargo/go-envconfig v1.1.0
github.com/shurcooL/githubv4 v0.0.0-20240727222349-48295856cce7
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
github.com/vektra/mockery/v2 v2.45.0
github.com/vektra/mockery/v2 v2.46.3
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0
go.opentelemetry.io/otel v1.29.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0
go.opentelemetry.io/otel v1.30.0
go.opentelemetry.io/otel/exporters/prometheus v0.51.0
go.opentelemetry.io/otel/metric v1.29.0
go.opentelemetry.io/otel/metric v1.30.0
go.opentelemetry.io/otel/sdk v1.29.0
go.opentelemetry.io/otel/sdk/metric v1.29.0
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948
Expand All @@ -46,6 +46,7 @@ require (
cloud.google.com/go/auth v0.9.1 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect
cloud.google.com/go/compute/metadata v0.5.0 // indirect
dario.cat/mergo v1.0.1 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand All @@ -54,6 +55,7 @@ require (
github.com/cloudflare/circl v1.4.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/docker/docker v27.3.1+incompatible // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
Expand All @@ -79,7 +81,7 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jinzhu/copier v0.3.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/klauspost/compress v1.17.10 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/httprc v1.0.6 // indirect
Expand Down Expand Up @@ -108,22 +110,22 @@ require (
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.einride.tech/aip v0.68.0 // indirect
go.mongodb.org/mongo-driver v1.16.1 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.opentelemetry.io/otel/trace v1.30.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.24.0 // indirect
google.golang.org/genproto v0.0.0-20240826202546-f6391c0de4c7 // indirect
Expand Down
Loading