Skip to content

Commit 1d3fcad

Browse files
p-shah256kersten
andcommitted
fix: Use dynamic controller-runtime version in doc generator
Replace hardcoded controller-runtime version in hack/docs/internal/cronjob-tutorial/generate_cronjob.go with a reference to the ControllerRuntimeVersion constant from the scaffolding package. This prevents the docs generation from breaking when the controller-runtime version is updated in the scaffolding logic, ensuring that `make generate-docs` remains stable across version bumps. Update hack/docs/internal/cronjob-tutorial/generate_cronjob.go Co-authored-by: Saan <94980910+sbin64@users.noreply.github.com> Update hack/docs/internal/cronjob-tutorial/generate_cronjob.go Co-authored-by: Kersten Burkhardt <kerstenk@gmail.com>
1 parent 23b74ea commit 1d3fcad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hack/docs/internal/cronjob-tutorial/generate_cronjob.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ limitations under the License.
1717
package cronjob
1818

1919
import (
20+
"fmt"
2021
"os/exec"
2122
"path/filepath"
2223

2324
log "github.com/sirupsen/logrus"
2425
"github.com/spf13/afero"
2526
hackutils "sigs.k8s.io/kubebuilder/v4/hack/docs/utils"
2627
pluginutil "sigs.k8s.io/kubebuilder/v4/pkg/plugin/util"
28+
"sigs.k8s.io/kubebuilder/v4/pkg/plugins/golang/v4/scaffolds"
2729
"sigs.k8s.io/kubebuilder/v4/test/e2e/utils"
2830
)
2931

@@ -288,7 +290,8 @@ func (sp *Sample) updateController() {
288290

289291
err = pluginutil.InsertCode(
290292
filepath.Join(sp.ctx.Dir, "internal/controller/cronjob_controller.go"),
291-
`// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.4/pkg/reconcile`, skipGoCycloLint)
293+
fmt.Sprintf(`// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@%s/pkg/reconcile`,
294+
scaffolds.ControllerRuntimeVersion), skipGoCycloLint)
292295
hackutils.CheckError("fixing cronjob_controller.go", err)
293296

294297
err = pluginutil.ReplaceInFile(

0 commit comments

Comments
 (0)