Skip to content

Commit 0f1e6c2

Browse files
committed
Merge branch 'main' of github.com:pluralsh/deployment-operator
2 parents 39eb4a4 + c2594c7 commit 0f1e6c2

29 files changed

+1417
-243
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
pull_request:
77
branches:
88
- main
9+
env:
10+
GOPATH: /home/runner/go/
11+
GOPROXY: "https://proxy.golang.org"
912
jobs:
1013
build:
1114
name: Build

Makefile

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
MODULES_DIRECTORY := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
2-
API_DIRECTORY = $(MODULES_DIRECTORY)/api
3-
COMMON_DIRECTORY = $(MODULES_DIRECTORY)/common
4-
OPERATOR_DIRECTORY = $(MODULES_DIRECTORY)/operator
5-
PROVIDER_DIRECTORY = $(MODULES_DIRECTORY)/providers
6-
ARGOCD_PROVIDER_DIRECTORY = $(PROVIDER_DIRECTORY)/argocd
7-
FAKE_PROVIDER_DIRECTORY = $(PROVIDER_DIRECTORY)/fake
8-
PROVISIONER_DIRECTORY = $(MODULES_DIRECTORY)/provisioner
9-
MODULES := $(API_DIRECTORY) $(COMMON_DIRECTORY) $(OPERATOR_DIRECTORY) $(ARGOCD_PROVIDER_DIRECTORY) $(FAKE_PROVIDER_DIRECTORY) $(PROVISIONER_DIRECTORY)
10-
11-
MAKEFLAGS += -j2
12-
13-
.PHONY: --run $(MODULES)
14-
--run: $(MODULES)
15-
16-
$(MODULES):
1+
ROOT_DIRECTORY := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
2+
3+
include $(ROOT_DIRECTORY)/config.mk
4+
5+
PRE = --ensure-tools
6+
7+
.PHONY: --ensure-tools
8+
--ensure-tools:
9+
@$(MAKE) --no-print-directory -C $(TOOLS_DIRECTORY) ensure
10+
11+
.PHONY: --run $(MODULE_DIRECTORIES)
12+
--run: $(MODULE_DIRECTORIES)
13+
14+
$(MODULE_DIRECTORIES):
1715
@$(MAKE) --directory=$@ $(TARGET)
1816

1917
##@ General
@@ -24,25 +22,25 @@ help: ## show help
2422

2523
##@ Build
2624

27-
# TODO: build target is not defined for all modules at the moment.
25+
# TODO: Fix.
2826
.PHONY: build
2927
build: ## build all modules
30-
@$(MAKE) --no-print-directory -C $(MODULES_DIRECTORY) TARGET=build
31-
32-
##@ Code quality
28+
@$(MAKE) --no-print-directory -C $(MODULE_DIRECTORIES) build
3329

34-
.PHONY: check
35-
check: fmt vet lint ## run all code quality checks
30+
.PHONY: build-api
31+
build-api: ## build api module
32+
@$(MAKE) -C $(API_DIRECTORY) build
3633

37-
.PHONY: fmt
38-
fmt: ## format code
39-
@$(MAKE) --no-print-directory -C $(MODULES_DIRECTORY) TARGET=fmt
34+
##@ Tests and checks
4035

41-
.PHONY: vet
42-
vet: ## examine code to find potential errors and suspicious constructs
43-
@$(MAKE) --no-print-directory -C $(MODULES_DIRECTORY) TARGET=vet
36+
.PHONY: test
37+
test: $(PRE) ## test workspace modules
38+
go work edit -json | jq -r '.Use[].DiskPath' | xargs -I{} go test {}/...
4439

45-
# TODO: It doesn't seem to work when running with make. Should we remove vet since it already includes it?
4640
.PHONY: lint
47-
lint: ## lint code
48-
docker run -t --rm -v $$(pwd):/app -v ~/.cache/golangci-lint/v1.54.2:/root/.cache -w /app golangci/golangci-lint:v1.54.2 golangci-lint run -v --fix
41+
lint: $(PRE) ## lint workspace code
42+
go work edit -json | jq -r '.Use[].DiskPath' | xargs -I{} golangci-lint run {}/...
43+
44+
.PHONY: fix
45+
fix: $(PRE) ## fix workspace code
46+
go work edit -json | jq -r '.Use[].DiskPath' | xargs -I{} golangci-lint run --fix {}/...

api/Makefile

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,30 @@
1+
ROOT_DIRECTORY := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
2+
TOOLS_DIRECTORY = $(ROOT_DIRECTORY)/../tools
13
CRD_OPTIONS ?= "crd"
24

3-
ifeq (,$(shell go env GOBIN))
4-
GOBIN=$(shell go env GOPATH)/bin
5-
else
6-
GOBIN=$(shell go env GOBIN)
7-
endif
5+
# List of targets that should be executed before other targets
6+
PRE = --ensure-tools
7+
8+
.PHONY: --ensure-tools
9+
--ensure-tools:
10+
@$(MAKE) --no-print-directory -C $(TOOLS_DIRECTORY) ensure
811

912
##@ General
1013

14+
.PHONY: help
1115
help: ## show help
1216
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
1317

1418
##@ Build
1519

16-
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
17-
get-controller-gen: ## install controller-gen
18-
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
19-
20-
manifests: get-controller-gen ## generate manifests
21-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
20+
.PHONY: manifests
21+
manifests: $(PRE) ## generate manifests
22+
controller-gen $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
2223

23-
generate: get-controller-gen ## generate code
24+
.PHONY: generate
25+
generate: $(PRE) ## generate code
2426
go generate ./pkg/...
25-
$(CONTROLLER_GEN) object:headerFile="../boilerplate.go.txt" paths="./..."
26-
27-
build: manifests generate ## generate manifests and code
28-
29-
##@ Code quality
30-
31-
fmt: ## format code
32-
go fmt ./...
33-
34-
vet: ## examine code to find potential errors and suspicious constructs
35-
go vet ./...
36-
37-
# go-get-tool will 'go get' any package $2 and install it to $1.
38-
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
39-
define go-get-tool
40-
@[ -f $(1) ] || { \
41-
set -e ;\
42-
TMP_DIR=$$(mktemp -d) ;\
43-
cd $$TMP_DIR ;\
44-
go mod init tmp ;\
45-
echo "Downloading $(2)" ;\
46-
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
47-
rm -rf $$TMP_DIR ;\
48-
}
49-
endef
27+
controller-gen object:headerFile="../boilerplate.go.txt" paths="./..."
28+
29+
.PHONY: build
30+
build: manifests generate ## build module

api/apis/platform/v1alpha1/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/config/crd/bases/platform.plural.sh_deploymentaccessclasses.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.3
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.13.0
87
name: deploymentaccessclasses.platform.plural.sh
98
spec:
109
group: platform.plural.sh

api/config/crd/bases/platform.plural.sh_deploymentaccesses.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.3
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.13.0
87
name: deploymentaccesses.platform.plural.sh
98
spec:
109
group: platform.plural.sh

api/config/crd/bases/platform.plural.sh_deploymentclasses.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.3
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.13.0
87
name: deploymentclasses.platform.plural.sh
98
spec:
109
group: platform.plural.sh

api/config/crd/bases/platform.plural.sh_deployments.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.3
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.13.0
87
name: deployments.platform.plural.sh
98
spec:
109
group: platform.plural.sh

api/example/test_deployment.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ metadata:
44
name: test
55
spec:
66
pluralId: ""
7-
repoUrl: https://github.com/pluralsh/deployment-api
8-
ref: 957bde0e71dad665e53f7fcbff43fc2f0e10b0a9
9-
subfolder: example/test_deployment
7+
revision:
8+
version: ""
9+
ref: ""
10+
git:
11+
ref: https://github.com/argoproj/argocd-example-apps
12+
folder: blue-green
1013
namespace: test
11-
providerName: fake.platform.plural.sh
12-
deploymentClassName: fake
14+
providerName: argocd.platform.plural.sh
15+
deploymentClassName: argocd

common/Makefile

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)