Skip to content

Commit

Permalink
Merge pull request #500 from aryan9600/internal-controllers
Browse files Browse the repository at this point in the history
move `controllers` to `internal/controllers`
  • Loading branch information
stefanprodan authored Mar 27, 2023
2 parents 7889652 + c62e9f2 commit 946bb84
Show file tree
Hide file tree
Showing 17 changed files with 13 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ notes

# Thes are downloaded in the Makefile
cache/*
controllers/testdata/crds/*
internal/controllers/testdata/crds/*

# Binaries for programs and plugins
*.exe
Expand Down Expand Up @@ -31,3 +31,6 @@ testbin

# Exclude all build related files
build/

# CRDs for fuzzing tests.
internal/controllers/testdata/crd
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ RUN go mod download

# Copy source code
COPY main.go main.go
COPY controllers/ controllers/
COPY pkg/ pkg/
COPY internal/ internal/

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ ifeq ($(shell uname -s),Darwin)
ENVTEST_ARCH=amd64
endif

TEST_CRDS := controllers/testdata/crds
TEST_CRDS := internal/controllers/testdata/crds

# Log level for `make run`
LOG_LEVEL ?= info
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestMain(m *testing.M) {

func runTestsWithFeatures(m *testing.M, feats map[string]bool) int {
testEnv = testenv.New(testenv.WithCRDPath(
filepath.Join("..", "config", "crd", "bases"),
filepath.Join("..", "..", "config", "crd", "bases"),
filepath.Join("testdata", "crds"),
))

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
"github.com/fluxcd/pkg/git"

// +kubebuilder:scaffold:imports
"github.com/fluxcd/image-automation-controller/controllers"
"github.com/fluxcd/image-automation-controller/internal/controllers"
)

const (
Expand Down
12 changes: 6 additions & 6 deletions tests/fuzz/oss_fuzz_prebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ set -euxo pipefail

# Some tests requires embedded resources. Embedding does not allow
# for traversing into ascending dirs, therefore we copy those contents here:
mkdir -p controllers/testdata/crd
cp config/crd/bases/*.yaml controllers/testdata/crd
mkdir -p internal/controllers/testdata/crd
cp config/crd/bases/*.yaml internal/controllers/testdata/crd

# Version of the source-controller from which to get the GitRepository CRD.
# Pulls source-controller/api's version set in go.mod.
Expand All @@ -32,10 +32,10 @@ SOURCE_VER=$(go list -m github.com/fluxcd/source-controller/api | awk '{print $2
# Pulls image-reflector-controller/api's version set in go.mod.
REFLECTOR_VER=$(go list -m github.com/fluxcd/image-reflector-controller/api | awk '{print $2}')

if [ -d "../../controllers/testdata/crds" ]; then
cp ../../controllers/testdata/crds/*.yaml testdata/crds
if [ -d "../../internal/controllers/testdata/crds" ]; then
cp ../../internal/controllers/testdata/crds/*.yaml testdata/crds
else
# Fetch the CRDs if not present since we need them when running fuzz tests on CI.
curl -s --fail https://raw.githubusercontent.com/fluxcd/source-controller/${SOURCE_VER}/config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml -o controllers/testdata/crd/gitrepositories.yaml
curl -s --fail https://raw.githubusercontent.com/fluxcd/image-reflector-controller/${REFLECTOR_VER}/config/crd/bases/image.toolkit.fluxcd.io_imagepolicies.yaml -o controllers/testdata/crd/imagepolicies.yaml
curl -s --fail https://raw.githubusercontent.com/fluxcd/source-controller/${SOURCE_VER}/config/crd/bases/source.toolkit.fluxcd.io_gitrepositories.yaml -o internal/controllers/testdata/crd/gitrepositories.yaml
curl -s --fail https://raw.githubusercontent.com/fluxcd/image-reflector-controller/${REFLECTOR_VER}/config/crd/bases/image.toolkit.fluxcd.io_imagepolicies.yaml -o internal/controllers/testdata/crd/imagepolicies.yaml
fi

0 comments on commit 946bb84

Please sign in to comment.