Skip to content

Commit

Permalink
feat: add editorconfig
Browse files Browse the repository at this point in the history
Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 committed Mar 1, 2024
1 parent 9810d69 commit b2a1bdf
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 9 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# https://EditorConfig.org

root = true

[*]
indent_size = 4
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
indent_style = unset

[{*.{yaml,yml},PROJECT}]
indent_size = 2

[{*.go,go.mod,*.md,LICENSE}]
indent_size = unset
21 changes: 20 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ endef
##@ oadp-nac specifics

.PHONY: ci
ci: simulation-test lint docker-build hadolint check-generate check-manifests ## Run all checks run by the project continuous integration (CI) locally.
ci: simulation-test lint docker-build hadolint check-generate check-manifests ec ## Run all checks run by the project continuous integration (CI) locally.

.PHONY: simulation-test
simulation-test: envtest ## Run unit and integration tests.
Expand All @@ -222,3 +222,22 @@ check-generate: generate ## Check if 'make generate' was run.
.PHONY: check-manifests
check-manifests: manifests ## Check if 'make manifests' was run.
test -z "$(shell git status --short)" || (echo "run 'make manifests' to generate code" && exit 1)

EC ?= $(LOCALBIN)/ec-$(EC_VERSION)
EC_VERSION ?= 2.8.0

.PHONY: editorconfig
editorconfig: $(LOCALBIN) ## Download editorconfig locally if necessary.
@[ -f $(EC) ] || { \
set -e ;\
ec_binary=ec-$(shell go env GOOS)-$(shell go env GOARCH) ;\
ec_tar=$(LOCALBIN)/$${ec_binary}.tar.gz ;\
curl -sSLo $${ec_tar} https://github.com/editorconfig-checker/editorconfig-checker/releases/download/$(EC_VERSION)/$${ec_binary}.tar.gz ;\
tar xzf $${ec_tar} ;\
rm -rf $${ec_tar} ;\
mv $(LOCALBIN)/$${ec_binary} $(EC) ;\
}

.PHONY: ec
ec: editorconfig ## Run file formatter checks against all project's files.
$(EC)
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ metadata:
name: cluster
spec:
identityProviders:
- name: oadp_nac_test_provider
mappingMethod: claim
- name: oadp_nac_test_provider
mappingMethod: claim
type: HTPasswd
htpasswd:
fileData:
name: htpass-secret
name: htpass-secret
EOF
```
**Apply the OAuth file to the cluster:**
Expand All @@ -60,7 +60,7 @@ $ oc apply -f config/rbac/nonadminbackup_editor_role.yaml

**Create Role Binding for our test user within nac-testing namespace:**
**NOTE:** There could be also a ClusterRoleBinding for the nacuser or one of the groups
to which nacuser belongs to easy administrative tasks and allow use of NAC for wider audience. Please see next paragraph.
to which nacuser belongs to easy administrative tasks and allow use of NAC for wider audience. Please see next paragraph.
```sh
$ cat > nacuser-rolebinding.yaml <<EOF
apiVersion: rbac.authorization.k8s.io/v1
Expand Down Expand Up @@ -114,8 +114,8 @@ export IMG_REGISTRY="quay.io/<USER>/oadp-nac"
make docker-build docker-push IMG="${IMG_REGISTRY}:${NAC_REV}" CONTAINER_TOOL=podman
```

**NOTE:** This image ought to be published in the personal registry you specified.
And it is required to have access to pull the image from the working environment.
**NOTE:** This image ought to be published in the personal registry you specified.
And it is required to have access to pull the image from the working environment.
Make sure you have the proper permission to the registry if the above commands don’t work.

**Install the CRDs into the cluster:**
Expand Down Expand Up @@ -155,7 +155,7 @@ replicaset.apps/oadp-nac-controller-manager-74bbf4577b 1 1 1

```

> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin
> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin
privileges or be logged in as admin.

**Create instances of your solution**
Expand Down
2 changes: 1 addition & 1 deletion hack/boilerplate.go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
*/

0 comments on commit b2a1bdf

Please sign in to comment.