Skip to content

Commit

Permalink
feat: add editorconfig (migtools#3)
Browse files Browse the repository at this point in the history
Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 authored Mar 1, 2024
1 parent 9810d69 commit 065eed6
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 10 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

[{*.go,go.mod,Makefile}]
indent_style = unset

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

[{*.md,LICENSE}]
indent_size = unset
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ jobs:
- name: Check if 'make manifests' was run
run: make check-manifests

# TODO editorconfig
- name: Check all files format
run: make ec
21 changes: 20 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,23 @@ endef

##@ oadp-nac specifics

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: 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 +237,7 @@ 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)

.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 065eed6

Please sign in to comment.