Skip to content

Commit 7c1b3b3

Browse files
committed
determine project name from the root directory
Signed-off-by: Joe Lanford <[email protected]>
1 parent 29acbff commit 7c1b3b3

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

.taskfile.build.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ includes:
88
vars:
99
BIN: "{{.ROOT_DIR}}/bin"
1010
KUSTOMIZE_DIR: "config/default"
11-
OPERATOR_CONTROLLER_MANIFEST: ./operator-controller.yaml
11+
CONTROLLER_MANIFEST: ./{{.PROJECT}}.yaml
1212

1313
OLMV0_VERSION: v0.24.0
1414
CERT_MANAGER_VERSION: v1.9.0
1515
RUKPAK_VERSION: v0.11.0
1616

1717
env:
18-
IMAGE_REPO: quay.io/operator-framework/operator-controller
18+
IMAGE_REPO: quay.io/operator-framework/{{.PROJECT}}
1919
IMAGE_TAG: devel
2020

2121
tasks:
@@ -58,7 +58,7 @@ tasks:
5858
GOARCH is taken from the environment to ensure a binary that will run on the local
5959
machine. GOOS is always set to `linux` for the docker build.
6060
61-
By default, the image is tagged as quay.io/operator-framework/operator-controller:devel.
61+
By default, the image is tagged as quay.io/operator-framework/{{.PROJECT}}:devel.
6262
You can control the image repo and tag by setting the IMAGE_REPO and IMAGE_TAG
6363
environment variables.
6464
cmds:
@@ -79,17 +79,17 @@ tasks:
7979
with the controller image set to the IMAGE_REPO and IMAGE_TAG environment variables.
8080
cmds:
8181
- cd config/manager && {{.TOOLSBIN}}/kustomize edit set image controller=$IMAGE_REPO:$IMAGE_TAG
82-
- "{{.TOOLSBIN}}/kustomize build {{.KUSTOMIZE_DIR}} > {{.OPERATOR_CONTROLLER_MANIFEST}}"
82+
- "{{.TOOLSBIN}}/kustomize build {{.KUSTOMIZE_DIR}} > {{.CONTROLLER_MANIFEST}}"
8383
deps: [tools:kustomize, generate]
8484

8585
install-script:
8686
desc: "Generate the install script"
8787
summary: |
8888
This task generates the install script that can be used to install the operator.
8989
90-
The OPERATOR_CONTROLLER_MANIFEST task variable is used to set the location that
91-
will be used to `kubectl apply -f` the operator-controller manifest. By default,
92-
this is set to `./operator-controller.yaml`. However this can be overridden during
90+
The CONTROLLER_MANIFEST task variable is used to set the location that
91+
will be used to `kubectl apply -f` the controller manifest. By default,
92+
this is set to `./{{.PROJECT}}.yaml`. However this can be overridden during
9393
a release to reference the release manifest URL that is uploaded to GitHub during
9494
the release.
9595
silent: true
@@ -113,8 +113,8 @@ tasks:
113113
kubectl wait --for=condition=Available --namespace=rukpak-system deployment/rukpak-webhooks --timeout=60s
114114
kubectl wait --for=condition=Available --namespace=crdvalidator-system deployment/crd-validation-webhook --timeout=60s
115115
116-
# Install operator-controller
117-
kubectl apply -f {{.OPERATOR_CONTROLLER_MANIFEST}}
118-
kubectl wait --for=condition=Available --namespace=operator-controller-system deployment/operator-controller-controller-manager --timeout=60s
116+
# Install controller
117+
kubectl apply -f {{.CONTROLLER_MANIFEST}}
118+
kubectl wait --for=condition=Available --namespace={{.PROJECT}}-system deployment/{{.PROJECT}}-controller-manager --timeout=60s
119119
EOF
120120
- chmod +x ./install.sh

.taskfile.deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ tasks:
2424
- task: build:manifest
2525
vars:
2626
KUSTOMIZE_DIR: "{{.KUSTOMIZE_DIR}}"
27-
OPERATOR_CONTROLLER_MANIFEST: "{{.OPERATOR_CONTROLLER_MANIFEST}}"
27+
CONTROLLER_MANIFEST: "{{.CONTROLLER_MANIFEST}}"
2828
- task: build:install-script
2929
vars:
30-
OPERATOR_CONTROLLER_MANIFEST: "{{.OPERATOR_CONTROLLER_MANIFEST}}"
30+
CONTROLLER_MANIFEST: "{{.CONTROLLER_MANIFEST}}"
3131
- task: kind:create
3232
vars:
3333
KIND_CLUSTER_NAME: "{{.KIND_CLUSTER_NAME}}"

.taskfile.kind.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3'
22

33
vars:
4-
KIND_CLUSTER_NAME: "operator-controller"
4+
KIND_CLUSTER_NAME: "{{.PROJECT}}"
55

66
includes:
77
tools:

.taskfile.test.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ tasks:
8383
- task: deploy:kind
8484
vars:
8585
KUSTOMIZE_DIR: "config/e2e"
86-
OPERATOR_CONTROLLER_MANIFEST: "operator-controller-e2e.yaml"
86+
CONTROLLER_MANIFEST: "{{.PROJECT}}-e2e.yaml"
8787
KIND_CLUSTER_NAME: "{{.KIND_CLUSTER_NAME}}-e2e"
8888
KIND_EXTRA_FLAGS: "--config ./kind-e2e.yaml"
8989
GO_COVER: "true"
@@ -93,8 +93,8 @@ tasks:
9393
KIND_CLUSTER_NAME: "{{.KIND_CLUSTER_NAME}}-e2e"
9494
- "{{.TOOLSBIN}}/ginkgo --tags {{.GO_BUILD_TAGS}} --progress --trace {{with .FOCUS}}--focus '{{.}}'{{end}} ./test/e2e"
9595

96-
# Delete the operator controller manager pod to write the coverage data to disk.
97-
- kubectl delete --wait pod -n operator-controller-system -l control-plane=controller-manager
96+
# Delete the controller manager pod to write the coverage data to disk.
97+
- kubectl delete --wait pod -n {{.PROJECT}}-system -l control-plane=controller-manager
9898
- go tool covdata percent -i={{.GOCOVERDIR}}
9999
deps: [tools:ginkgo]
100100

Taskfile.dist.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
version: '3'
22

33
vars:
4+
PROJECT: "{{base .ROOT_DIR}}"
45
TOOLSBIN: "{{.ROOT_DIR}}/hack/tools/bin"
56
GO_BUILD_TAGS: upstream
67

78
env:
8-
IMAGE_REPO: quay.io/operator-framework/operator-controller
9+
IMAGE_REPO: quay.io/operator-framework/{{.PROJECT}}
910
IMAGE_TAG: devel
1011

1112
GORELEASER_ARGS: --snapshot --clean
@@ -39,7 +40,7 @@ tasks:
3940
This task will run the operator in a kind cluster.
4041
4142
The KIND_CLUSTER_NAME task variable is used to control the name of the
42-
kind cluster. By default, this is set to "operator-controller".
43+
kind cluster. By default, this is set to "{{.PROJECT}}".
4344
cmds:
4445
- task: deploy:kind
4546
vars:
@@ -64,6 +65,6 @@ tasks:
6465
- task: build:manifest
6566
- task: build:install-script
6667
vars:
67-
OPERATOR_CONTROLLER_MANIFEST: https://github.com/operator-framework/operator-controller/releases/download/$IMAGE_TAG/operator-controller.yaml
68+
CONTROLLER_MANIFEST: https://github.com/operator-framework/{{.PROJECT}}/releases/download/$IMAGE_TAG/{{.PROJECT}}.yaml
6869
- "{{.TOOLSBIN}}/goreleaser release $GORELEASER_ARGS"
6970
deps: [tools:goreleaser]

0 commit comments

Comments
 (0)