Skip to content

Commit

Permalink
Fix module references + add CI (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
harveyxia authored Oct 31, 2024
1 parent a63fc30 commit 14da394
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 44 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- "1.22"
env:
GOPRIVATE: github.com/reddit/achilles-sdk-api

container:
image: golang:${{ matrix.go-version }}

steps:
- uses: actions/checkout@v3

- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
# https://github.com/actions/runner-images/issues/6775.
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
known_hosts: ${{ secrets.KNOWN_HOSTS }}
key: ${{ secrets.GO_MODULE_PRIVATE_KEY }}

- name: Setup access for private Go modules
run: |
git config --global url."ssh://[email protected]/".insteadOf https://github.com/
- name: Generate
run: |
# needed for running `tar -xJv` for installing shellcheck
apt-get update
apt-get install xz-utils
make generate
make lint
git status
git diff
test -z "$(git status --porcelain)"
- name: Test
run: make test
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ARG TARGETARCH
# TODO remove this line once the repo is public
ENV GOPROXY "https://goproxy.build.ue1.snooguts.net"
ENV GOPRIVATE ""
ENV GONOSUMDB "github.snooguts.net/*"
RUN git config --global url.git@github.snooguts.net:.insteadof https://github.snooguts.net/
ENV GONOSUMDB "github.com/*"
RUN git config --global url.git@github.com:.insteadof https://github.com/

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ lint: gosimports
go mod tidy
go fmt ./...
go list ./... | xargs go vet
$(GOSIMPORTS) -local github.snooguts.net/reddit/achilles-sudo-controller -l -w .
$(GOSIMPORTS) -local github.com/reddit/achilles-sudo-controller -l -w .

# Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
.PHONY: generate
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ specified permissions.
1. Clone the `achilles-token-controller`.

```
git clone git@github.snooguts.net:reddit/achilles-token-controller.git
git clone git@github.com:reddit/achilles-token-controller.git
```

1. Ensure you have [k3d](https://k3d.io/v5.7.4/#installation) installed.
Expand Down
2 changes: 1 addition & 1 deletion api/group.example.com/v1alpha1/accesstoken_types.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package v1alpha1

import (
"github.snooguts.net/reddit/achilles-sdk-api/api"
"github.com/reddit/achilles-sdk-api/api"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion api/group.example.com/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import (
"os"

"github.com/prometheus/client_golang/prometheus"
"github.com/reddit/achilles-sdk/pkg/bootstrap"
"github.com/reddit/achilles-sdk/pkg/fsm/metrics"
"github.com/reddit/achilles-sdk/pkg/io"
"github.com/reddit/achilles-sdk/pkg/logging"
"github.com/reddit/achilles-sdk/pkg/meta"
"github.com/reddit/achilles-sdk/pkg/ratelimiter"
"github.com/reddit/achilles-token-controller/internal/controllers/accesstoken"
"github.com/reddit/achilles-token-controller/internal/controlplane"
intscheme "github.com/reddit/achilles-token-controller/internal/scheme"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.snooguts.net/reddit/achilles-sdk/pkg/bootstrap"
"github.snooguts.net/reddit/achilles-sdk/pkg/fsm/metrics"
"github.snooguts.net/reddit/achilles-sdk/pkg/io"
"github.snooguts.net/reddit/achilles-sdk/pkg/logging"
"github.snooguts.net/reddit/achilles-sdk/pkg/meta"
"github.snooguts.net/reddit/achilles-sdk/pkg/ratelimiter"
"github.snooguts.net/reddit/achilles-token-controller/internal/controllers/accesstoken"
"github.snooguts.net/reddit/achilles-token-controller/internal/controlplane"
intscheme "github.snooguts.net/reddit/achilles-token-controller/internal/scheme"
"sigs.k8s.io/controller-runtime/pkg/manager"
)

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ require (
github.com/onsi/ginkgo/v2 v2.17.1
github.com/onsi/gomega v1.32.0
github.com/prometheus/client_golang v1.19.0
github.com/reddit/achilles-sdk v0.0.0-20241031141516-cde734cebdf2
github.com/reddit/achilles-sdk-api v1.1.0
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.6-0.20210604193023-d5e0c0615ace
github.snooguts.net/reddit/achilles-sdk v0.10.0
github.snooguts.net/reddit/achilles-sdk-api v1.1.0
go.uber.org/zap v1.27.0
k8s.io/api v0.29.3
k8s.io/apimachinery v0.30.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1
github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/reddit/achilles-sdk v0.0.0-20241031141516-cde734cebdf2 h1:O4Kov0WnNbLhPvCeZcgCtXsUfzPxnhVE2fdLqOiWYQM=
github.com/reddit/achilles-sdk v0.0.0-20241031141516-cde734cebdf2/go.mod h1:O460xUhvhMBPCTOleF/bpivDRwgBAqFvnBIIrMskny4=
github.com/reddit/achilles-sdk-api v1.1.0 h1:sbQv/qH/kaJU4UoAK7trZo76iA5zlgRpcbqGLcSCaNM=
github.com/reddit/achilles-sdk-api v1.1.0/go.mod h1:tKV9nH5k3TM5MGomS28JRzVyZ+yeJgdS2c5qMZe7fuI=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
Expand All @@ -117,10 +121,6 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.snooguts.net/reddit/achilles-sdk v0.10.0 h1:OlVJ09EHfmT/qgEygayq5lUAIf+5Y7WkDKiHIfoE56g=
github.snooguts.net/reddit/achilles-sdk v0.10.0/go.mod h1:AsEi4PrqUmD+M/xkwMR1X43PiZ0JBvWustWmMMgg9mM=
github.snooguts.net/reddit/achilles-sdk-api v1.1.0 h1:uAapvZfEBJr4bZrJCVSdiar/YSi4ENnCwaZSTFvVmWA=
github.snooguts.net/reddit/achilles-sdk-api v1.1.0/go.mod h1:1cCDjj31mCJTd+DWAWftVhlovAuL6RcueSDvV9zPq3Y=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/accesstoken/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package accesstoken
import (
"fmt"

"github.snooguts.net/reddit/achilles-token-controller/api/group.example.com/v1alpha1"
"github.com/reddit/achilles-token-controller/api/group.example.com/v1alpha1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
4 changes: 2 additions & 2 deletions internal/controllers/accesstoken/conditions.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package accesstoken

import (
"github.snooguts.net/reddit/achilles-sdk-api/api"
"github.snooguts.net/reddit/achilles-token-controller/api/group.example.com/v1alpha1"
"github.com/reddit/achilles-sdk-api/api"
"github.com/reddit/achilles-token-controller/api/group.example.com/v1alpha1"
corev1 "k8s.io/api/core/v1"
)

Expand Down
16 changes: 8 additions & 8 deletions internal/controllers/accesstoken/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package accesstoken
import (
"context"

"github.snooguts.net/reddit/achilles-sdk/pkg/fsm"
"github.snooguts.net/reddit/achilles-sdk/pkg/fsm/types"
"github.snooguts.net/reddit/achilles-sdk/pkg/io"
"github.snooguts.net/reddit/achilles-sdk/pkg/logging"
"github.snooguts.net/reddit/achilles-sdk/pkg/meta"
"github.snooguts.net/reddit/achilles-sdk/pkg/sets"
"github.snooguts.net/reddit/achilles-token-controller/api/group.example.com/v1alpha1"
"github.snooguts.net/reddit/achilles-token-controller/internal/controlplane"
"github.com/reddit/achilles-sdk/pkg/fsm"
"github.com/reddit/achilles-sdk/pkg/fsm/types"
"github.com/reddit/achilles-sdk/pkg/io"
"github.com/reddit/achilles-sdk/pkg/logging"
"github.com/reddit/achilles-sdk/pkg/meta"
"github.com/reddit/achilles-sdk/pkg/sets"
"github.com/reddit/achilles-token-controller/api/group.example.com/v1alpha1"
"github.com/reddit/achilles-token-controller/internal/controlplane"
"go.uber.org/zap"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
Expand Down
18 changes: 9 additions & 9 deletions internal/controllers/accesstoken/reconciler_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/prometheus/client_golang/prometheus"
"github.snooguts.net/reddit/achilles-sdk/pkg/fsm/metrics"
"github.snooguts.net/reddit/achilles-sdk/pkg/io"
"github.snooguts.net/reddit/achilles-sdk/pkg/logging"
achratelimiter "github.snooguts.net/reddit/achilles-sdk/pkg/ratelimiter"
sdktest "github.snooguts.net/reddit/achilles-sdk/pkg/test"
"github.snooguts.net/reddit/achilles-token-controller/internal/controllers/accesstoken"
"github.snooguts.net/reddit/achilles-token-controller/internal/controlplane"
intscheme "github.snooguts.net/reddit/achilles-token-controller/internal/scheme"
"github.snooguts.net/reddit/achilles-token-controller/internal/test"
"github.com/reddit/achilles-sdk/pkg/fsm/metrics"
"github.com/reddit/achilles-sdk/pkg/io"
"github.com/reddit/achilles-sdk/pkg/logging"
achratelimiter "github.com/reddit/achilles-sdk/pkg/ratelimiter"
sdktest "github.com/reddit/achilles-sdk/pkg/test"
"github.com/reddit/achilles-token-controller/internal/controllers/accesstoken"
"github.com/reddit/achilles-token-controller/internal/controlplane"
intscheme "github.com/reddit/achilles-token-controller/internal/scheme"
"github.com/reddit/achilles-token-controller/internal/test"
"go.uber.org/zap"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/accesstoken/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.snooguts.net/reddit/achilles-token-controller/api/group.example.com/v1alpha1"
"github.com/reddit/achilles-token-controller/api/group.example.com/v1alpha1"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down
2 changes: 1 addition & 1 deletion internal/controlplane/context.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Package controlplane contains state shared across all reconcilers.
package controlplane

import "github.snooguts.net/reddit/achilles-sdk/pkg/fsm/metrics"
import "github.com/reddit/achilles-sdk/pkg/fsm/metrics"

// Context holds information on how the controller should run. These values may
// be referenced during the execution of transition functions.
Expand Down
2 changes: 1 addition & 1 deletion internal/scheme/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package scheme
import (
"fmt"

"github.snooguts.net/reddit/achilles-token-controller/api/group.example.com/v1alpha1"
"github.com/reddit/achilles-token-controller/api/group.example.com/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
kscheme "k8s.io/client-go/kubernetes/scheme"
)
Expand Down

0 comments on commit 14da394

Please sign in to comment.