Skip to content

Commit 226f160

Browse files
authored
Merge pull request #3564 from camilamacedo86/fix-hack-docs
🌱 ensure that we call go tidy, make manifests and all when we generate…
2 parents 7a8cb07 + 2a4345d commit 226f160

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

docs/book/src/cronjob-tutorial/testdata/project/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.20
55
require (
66
github.com/onsi/ginkgo/v2 v2.9.5
77
github.com/onsi/gomega v1.27.7
8+
github.com/robfig/cron v1.2.0
89
k8s.io/api v0.27.2
910
k8s.io/apimachinery v0.27.2
1011
k8s.io/client-go v0.27.2
@@ -45,7 +46,6 @@ require (
4546
github.com/prometheus/client_model v0.4.0 // indirect
4647
github.com/prometheus/common v0.42.0 // indirect
4748
github.com/prometheus/procfs v0.9.0 // indirect
48-
github.com/robfig/cron v1.2.0 // indirect
4949
github.com/spf13/pflag v1.0.5 // indirect
5050
go.uber.org/atomic v1.7.0 // indirect
5151
go.uber.org/multierr v1.6.0 // indirect

docs/book/src/cronjob-tutorial/testdata/project/go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJ
2525
github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4=
2626
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
2727
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
28-
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
2928
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
3029
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
3130
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
@@ -80,10 +79,8 @@ github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ
8079
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
8180
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
8281
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
83-
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
8482
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
8583
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
86-
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
8784
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
8885
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
8986
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
@@ -105,7 +102,6 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
105102
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
106103
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
107104
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
108-
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
109105
github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q=
110106
github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k=
111107
github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU=

hack/docs/internal/component-config-tutorial/generate_component_config.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,18 @@ clusterName: example-test
151151
}
152152

153153
func (sp *Sample) CodeGen() {
154-
cmd := exec.Command("make", "build")
154+
155+
cmd := exec.Command("make", "manifests")
155156
_, err := sp.ctx.Run(cmd)
157+
CheckError("Failed to run make manifests for componentConfig tutorial", err)
158+
159+
cmd = exec.Command("make", "all")
160+
_, err = sp.ctx.Run(cmd)
161+
CheckError("Failed to run make all for componentConfig tutorial", err)
156162

157-
CheckError("Failed to generate code in componentconfig tutorial", err)
163+
cmd = exec.Command("go", "mod", "tidy")
164+
_, err = sp.ctx.Run(cmd)
165+
CheckError("Failed to run go mod tidy all for componentConfig tutorial", err)
158166
}
159167

160168
// CheckError will exit with exit code 1 when err is not nil.

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,17 @@ func codeGen(sp *Sample) {
128128
_, err := sp.ctx.Run(cmd)
129129
CheckError("Failed to get package robfig/cron", err)
130130

131-
cmd = exec.Command("make", "build")
131+
cmd = exec.Command("make", "manifests")
132132
_, err = sp.ctx.Run(cmd)
133-
CheckError("Failed to generate code in cronjob tutorial", err)
133+
CheckError("Failed to run make manifests for cronjob tutorial", err)
134+
135+
cmd = exec.Command("make", "all")
136+
_, err = sp.ctx.Run(cmd)
137+
CheckError("Failed to run make all for cronjob tutorial", err)
138+
139+
cmd = exec.Command("go", "mod", "tidy")
140+
_, err = sp.ctx.Run(cmd)
141+
CheckError("Failed to run go mod tidy for cronjob tutorial", err)
134142
}
135143

136144
// insert code to fix docs

0 commit comments

Comments
 (0)