The charts have no unit tests. CI runs ct lint plus a helm template and
kustomize build, which prove the charts render but never assert what
they render, so conditional template logic goes unverified.
Add helm-unittest, pinned and installed as a standalone binary, a
test.helm make target, and a Helm Unittests workflow that runs it. The
first suite covers the toolbox deployment: the image composed from the
toolbox and cephImage settings, the precedence of both over the older
toolbox.image setting, the hostNetwork branch driven by the cluster
network provider, and the revisionHistoryLimit guard.
The new job is a required check in .mergify.yml, alongside the existing
chart linting.
Suites live under tests/ in a chart and are excluded from the packaged
chart via .helmignore. The runner is invoked with --strict so that a
misspelled key fails the suite instead of silently rendering defaults.
Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
Replace the sed-based generation of pkg/apis/go.mod and copied go.sum with a Go workspace.
Each module is now tidied independently and kept in sync via go work sync.
Signed-off-by: Malay Kumar Parida <mparida@redhat.com>
The chart package rule captures find output over the chart directory as
its prerequisite list when make parses the makefile, including any
dependency archives already sitting in charts/. The
helm.dependency.update recipe then runs helm dependency update, which
deletes archives that no longer match the Chart.yaml pins. An archive
left by an earlier build at a different ref — an older version pin, or
another branch — is thus frozen as a prerequisite and deleted mid-run,
and make stops with "No rule to make target
.../charts/ceph-csi-operator-1.0.1.tgz" (seen after the csi-operator
pin moved from 1.0.1 to 1.0.4).
Exclude *.tgz files from the prerequisite find. The archives never
carried staleness information anyway because helm.dependency.update is
a non-file target that is always considered remade, so the package
target re-runs every build regardless.
Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
When neither docker nor podman is available and usable,
`make build`, `make lint.yaml`, and `lint.markdown` used to fail
with confusing unhelpful error messages like `run: command not found`
or `build: command not found` and in the case of build fail rather late
in the process.
This change lets make fail imuch more early and with a clear error message that a
working installation of container runtime with podman or docker is required.
The new logic is this:
If docker is present and usable, use it
otherwise, if podman is present and usable, use it
otherwise, if DOCKERCMD is explicitly set to a usable command, use it.
otherwise, error out at corresponding targets.
In order to avoid adding new confusions, `make clean` and `make build` are additionally made robust to
gracefully skip the image cleanup and image cleanuop steps, respectively, with an informational message
instead of
failingi hard when no usable container command is provided or detected.
Assisted-by: GitHub Copilot
Signed-off-by: Michael Adam <obnox@samba.org>
kubernetes/code-generator is versioned alongside the core k8s.io modules, so codegen should logically stay in sync with the Kubernetes version in go.mod.
So we now resolve KUBE_CODEGEN_TAG from k8s.io/apimachinery with go list instead of maintaining a separate
pin that can silently fall behind dependency bumps. This removes manual version upkeep entirely. Bumping k8s modules in
go.mod automatically picks the matching code-generator release on the next make codegen.
Also rename CODE_GENERATOR_VERSION to KUBE_CODEGEN_TAG to align with the kube_codegen.sh tooling and the CODE_GENERATOR path used by codegen.sh.
Add the generated files for latest codegen run as well.
Signed-off-by: Malay Kumar Parida <mparida@redhat.com>
The go.mod.check target generates pkg/apis/go.mod from the root go.mod
and must remove the root-only replace directive that points
github.com/rook/rook/pkg/apis to ./pkg/apis. The sed pattern expected
the line to start with "replace", but the actual line is tab-indented
inside the replace block, so the directive was never removed.
Update the sed pattern to match optional leading whitespace and remove
the incorrect self-replace from pkg/apis/go.mod.
Signed-off-by: Malay Kumar Parida <mparida@redhat.com>
The yamllint make target required yamllint to be installed
in the PATH.
This change renders it self-contained
by using a container image instead.
Signed-off-by: Michael Adam <obnox@samba.org>
Co-authored-by: Blaine Gardner <b.blaine.gardner@gmail.com>
running make shellcheck required shellcheck to be
installed locally in the $PATH.
This change renders make shellcheck self-contained
by installing shellcheck in the local tools cache directory
likeit is already done with other tools.
Signed-off-by: Michael Adam <obnox@samba.org>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The definition of a newline withe name '\n' was invalid and broke
introduced commands-before-first-target syntax errors in the
Makefile.
This change fixes the poblem by changing the name to the valid name
NEWLINE.
Signed-off-by: Michael Adam <obnox@samba.org>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
the markdownlint and markdownlint.fix make targets
required markdownlint-cli2 to be installed locally
in the $PATH.
This change renders them self-contained by running
markdownlint from the official markdownlint-cli2
docker image.
Also clean the development-flow guide for linting tools
Signed-off-by: Michael Adam <obnox@samba.org>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Travis Nielsen <tnielsen@redhat.com>
make helm.lint depended on the chart-testing tool ct as well as helm and kustomize being available in
the PATH.
This makes the target self-contained by
- running ct via go run
- using the cached version of helm used elswhere in the
build system
- caching kustomize in the tools dir and using that
Signed-off-by: Michael Adam <obnox@samba.org>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
A target was recently introduced for creating the host-specific tools
cache directory.
Several helmng-related tools installation targets depended on the directory implicitly or
created it as part of their recipe.
This change makes the dependency explicit by using the new target as a
prerequisite.
Signed-off-by: Michael Adam <obnox@samba.org>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
A target was recently introduced for creating the host-specific tools
cache directory.
Several golang-related tools install targets depended on the directory implicitly or
created it as part of their recipe.
This change makes the dependency explicit by using the new targett as a
prerequisite. This also simplifies some recipes by removing now unneeded
mkdir operations.
Signed-off-by: Michael Adam <obnox@samba.org>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The go-junit-reporttool used to be installed into the general tools cache dir.
For consistency, this changes it to be into the host-specific tools
cache directory like the other cached tools
Signed-off-by: Michael Adam <obnox@samba.org>
Tool binaries were installed to a host-specific cache for that was eforced to the linux platform.
This change fixes the mechanism to install the tool binaries to the cache directory for the real
detected platform
Signed-off-by: Michael Adam <obnox@samba.org>
the target for installing helm to the local
host-specific tools cache and a few other targets are
using the tools cache directory and depend on it
implicitly.
This change is a preparation for making this dependency explicit
by adding a new target for creating the tools cache directory
that can be use as a target prerequisite in subsequent changes.
Signed-off-by: Michael Adam <obnox@samba.org>
Co-authored-by: Travis Nielsen <tnielsen@redhat.com>
Kubernetes has begun releasing a kube-api-linter application for linting
Kubernetes APIs to match against common best-practices. (a.k.a., KAL).
Of note: KAL is still new and has no semver releases.
I believe this linter is helpful in encouraging Rook devs to think
deeply about how end-users consume the API. It ensures that new APIs
account for set/unset status, zero values, upper/lower bounds, and
possibly others in the future.
This commit adds initial support to Rook, without making the results a
requirement. Maintainers still need to evaluate rule configuration and
determine how tightly Rook wants to hold to the results.
As of this commit, I observe around 650 "issues" with the current Rook APIs.
This doesn't mean that Rook is in danger of breaking. Issues with API
types are often just indications that upper/lower bounds are missing, or
that there is ambiguity between set-empty and unset-empty values.
This commit uses `--new` in CI to ensure only new API issues are
flagged.
Also of note, KAL is a golangci-lint plugin. It is possible to locally
build KAL (from source) into golangci-lint to run both at the same time.
However, this is time-consuming, and it's harder to coordinate tool
binary caching this way when it's related to 2 different versions.
Treating KAL as a standalone binary allows for simpler make scripting
and maintenance.
Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
this commit add check to pull helm chart dependency
only when the charts are not available locally on the
system. This reduces overall make build other make
command completion time.
Signed-off-by: subhamkrai <srai@redhat.com>
The error message issued by `make` when the available golang was ont one
of the supported versions was somewhat confusion or even broken.
This change fixes the message.
Signed-off-by: Michael Adam <obnox@samba.org>
This commit test csi-operator helm chart as a dependencies with rook-ceph operator helm chart.
With these changes csi-operator will be installed as a part of rook-ceph operator helm chart.
Signed-off-by: subhamkrai <srai@redhat.com>
The helm charts will now only be published when it is
an officially tagged release build.
The images will only be published to all repos for
dockerhub, quay, and ghcr when it is a tagged release.
The images will be published only to dockerhub for all
master and interim release branch builds.
Remove obsolete makefile option for images.
Ceph is the only image Rook ever expects to build.
Simplify the makefile by removing the legacy option
to select which image to build.
Also included are other small improvements to clean up
the release scripts.
Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
Resolves this warning:
WARN [runner/nolint_filter] Found unknown linters in //nolint directives: just configuration keys., value not credential
Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
The lint make target is not used anywhere in the codebase and is particular not run in the CI.
It was recently discovered that `make lint` does not even work at all.
It was subsequently suggested to remove the broken and unused target altogether.
This change settles that issue by removing the lint target and the preparatory
golint installation target.
Fixes: #15317
Signed-off-by: Michael Adam <obnox@samba.org>
make test was failing when running on arm macbooks. Fix it so that it
isn't running with hardcoded GOOS=linux.
Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
`make test` failed for me on MacOS with this error:
```console
$ make test
...
=== installing go-junit-report
tar: Error opening archive: Unrecognized archive format
make[2]: ***
$
```
So it seems the version v2.0.0 of go-junit-report has a broken source
tarball
Going to the latest version v2.1.0 fixes the problem for me.
Signed-off-by: Michael Adam <obnox@samba.org>
Few day's back go 1.22 is release. Let's add that
as valid version to build on. Also, adding 1.22 as
test matric for linux build CI.
https://tip.golang.org/doc/go1.22
Signed-off-by: subhamkrai <srai@redhat.com>
To keep the go dependencies minimal, add the go packages
just for the pkg/apis directory. Projects that only reference
the rook apis can then have a smaller footprint for Go
dependencies.
Signed-off-by: travisn <tnielsen@redhat.com>
The go package dependencies (go.mod and go.sum) were created
under the pkg/apis directory to simplify the dependencies for
other projects referencing the rook repo. The downside is that
the dependabot can no longer open a working and valid PR since
the bot is not aware of the go.mod and go.sum in the apis directory.
Since the reduction of dependencies for vault in #12455,
the list of extra dependencies is not quite so extensive.
We are putting effort into shrinking the dependency list instead
of using the modules files in the apis subdirectory.
Note that #12419 updated the dependencies for the latest controller
runtime which also increased the size of the modules
list in the pkgs subdirectory, which means the difference
in dependencies in the pkgs subdirectory is no longer
signficant anyway.
Signed-off-by: travisn <tnielsen@redhat.com>