-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor Makefile, GH workflows and other project housekeeping tasks #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
97ccccb to
be4e7fb
Compare
bf206f5 to
6b244ce
Compare
6b244ce to
6ddbfd1
Compare
9890a4b to
6b49a31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things we had previously, which I'd prefer to keep:
- Spelling Checks
- License Checks
- Vulnerability Checks
dist/chart/.helmignore
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As already said in #7 (comment), we already have this chart in https://github.com/ironcore-dev/network-operator/tree/main/charts/network-operator:
We already have the helm chart under
charts/network-operatorwhich seems to be inline with the standard convention used by many other projects.I'm aware that kubebuilder decided for
dist/chartbut I don't think that's a good choice. There also seems to be a related issue in kubernetes-sigs/kubebuilder#4320, which hopefully gets resolved soon (there are already open PRs for it) to make this configurable.And to cite the official Helm Documentation:
The directory name is the name of the chart (without versioning information).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this chart being created? Can the helm plugin be configured to use a different folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's being created with the helm plugin, but then simply moved to another directory, see
Line 127 in be24d60
| @rm -rf charts/network-operator && mv dist/chart charts/network-operator && rm -rf dist |
However, there is an open issue on kubebuilder to make this configurable (kubernetes-sigs/kubebuilder#4320) which would simplify this step for us in the future.
As this is already a custom target not included into the kubebuilder scaffold, we can pretty much do what we want here. Also, as this is a complete replacement every time (because the helm plugin just overwrites everything) this step either way always requires some manual efforts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already defined in
network-operator/api/v1alpha1/groupversion_info.go
Lines 4 to 8 in 76cc0c8
| // Package v1alpha1 contains API Schema definitions for the networking.cloud.sap v1alpha1 API group. | |
| // +kubebuilder:validation:Required | |
| // +kubebuilder:object:generate=true | |
| // +groupName=networking.cloud.sap | |
| package v1alpha1 |
doc.go, but then we should remove it in the other file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is needed by the CRDs to api reference doc generator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As said, we can add it. But then we should remove those lines from ./api/v1alpha1/groupversion_info.go#L4-L8 and make sure we keep the following to set the default for the package:
+kubebuilder:validation:Required6b49a31 to
4e8fc5b
Compare
4e8fc5b to
bac45ed
Compare
bac45ed to
cbbfd82
Compare
dd4f465 to
7a445ba
Compare
7a445ba to
83dbfb3
Compare
15d85b4 to
49e3275
Compare
dd55988 to
c2feeef
Compare
| - copyloopvar | ||
| - dupl | ||
| - errcheck | ||
| - ginkgolinter | ||
| - goconst | ||
| - gocyclo | ||
| - govet | ||
| - ineffassign | ||
| - lll | ||
| - misspell | ||
| - nakedret | ||
| - prealloc | ||
| - revive | ||
| - staticcheck | ||
| - unconvert | ||
| - unparam | ||
| - unused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses way less linters as used previously. Do we really want to reduce the linting in this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added back all the linters. However I don't think we will need things like sqlclosecheck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert the changes done here (except renaming of the make targets used), these were some intentional changes made (and also fixed a lot of linter issues).
3bf87e9 to
3556f30
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We previously run a check in the Checks workflow to check for license headers. Now that we removed this workflow, can we add this step to this worfklow? In particular it should run the make check-license target we have defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were previously running go-licence-detector here. If we remove this now, then we should also remove the .license-scan-rules.json and .license-scan-overrides.jsonl configuration files (or keep it and keep the config).
| - name: Run linter | ||
| run: | | ||
| make golangci-lint | ||
| cp ./bin/golangci-lint /usr/local/bin/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we otherwise use mv <binary> /usr/local/bin, e.g. in the kustomize-validation workflow. Ideally this would be consistent.
.github/workflows/publish-docker.yml
Outdated
| target: ${{ matrix.image.target }} | ||
| build-args: | | ||
| VERSION=${{ steps.meta.outputs.version }} | ||
| GIT_COMMIT=${{ steps.vars.sha_short }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| GIT_COMMIT=${{ steps.vars.sha_short }} | |
| GIT_COMMIT=$(git rev-parse --short HEAD) |
nit: if we can run a shell command here as done below with the date command I would also run this command here inline instead of creating a new step.
Did you test, that for the BUILD_DATE arg you are able to invoke a shell command in this scope?
| # Copy the Go Modules manifests | ||
| COPY go.mod go.mod | ||
| COPY go.sum go.sum | ||
| # cache deps before building and copying source so that we don't need to re-download as much | ||
| # and so that source changes don't invalidate our downloaded layer | ||
| RUN go mod download |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a suggestion, could we at least do:
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download -xInstead of the go mod download, so that we have the mod cache to speed up the build process?
| _, _ = fmt.Fprintf(GinkgoWriter, "chdir dir: %q\n", err) | ||
| } | ||
|
|
||
| cmd.Env = append(os.Environ(), "GO111MODULE=on") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| cmd.Env = append(os.Environ(), "GO111MODULE=on") |
not needed.
| prometheusOperatorVersion = "v0.77.1" | ||
| prometheusOperatorURL = "https://github.com/prometheus-operator/prometheus-operator/" + | ||
| "releases/download/%s/bundle.yaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you removed the prometheus installation in test/e2e/e2e_suite_test.go. I would either also remove everything regarding that (incl. the InstallPrometheusOperator and UninstallPrometheusOperator funcs that are now unused) or keep the prometheus operator installation as previously.
| @@ -153,31 +171,8 @@ func LoadImageToKindClusterWithName(name string) error { | |||
| if v, ok := os.LookupEnv("KIND_CLUSTER"); ok { | |||
| cluster = v | |||
| } | |||
| // See: https://kind.sigs.k8s.io/docs/user/rootless/#creating-a-kind-cluster-with-rootless-nerdctl | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep this part from the previous implementation, as it allows to use a different container tool than docker (something that kubebuilder pretents but actually does not support).
test/utils/util.go
Outdated
| // false positive | ||
| // nolint:gosec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // false positive | |
| // nolint:gosec |
I don't get an gosec linter error here. Same for the end of the func.
| if idx < 0 { | ||
| if strings.Contains(string(content), target[len(prefix):]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous enhancement of detecting an already commented file is superior. Also, this func is now unused (as we don't install the prometheus operator anymore), so I would remove this func (we shouldn't include dead code in the repo).
a6f74bb to
f2b63de
Compare
5ab5751 to
5b75547
Compare
5b75547 to
559abfa
Compare
|
This PR is stale because it has been open for 45 days with no activity. |
Proposed changes
Refactor Makefile, GH workflows and other project housekeeping tasks.