Skip to content

Commit 63cff7d

Browse files
committed
[sig-builds]: Migrate DCs to Deployments and remove [apigroup:apps.openshift.io] API dependency
1 parent c5810fd commit 63cff7d

File tree

7 files changed

+167
-177
lines changed

7 files changed

+167
-177
lines changed

test/extended/builds/volumes.go

Lines changed: 67 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,28 @@ package builds
33
import (
44
"fmt"
55
"path/filepath"
6-
"time"
76

87
g "github.com/onsi/ginkgo/v2"
98
o "github.com/onsi/gomega"
109

1110
apierrors "k8s.io/apimachinery/pkg/api/errors"
1211
admissionapi "k8s.io/pod-security-admission/api"
1312

14-
deploymentutil "github.com/openshift/origin/test/extended/deployments"
1513
exutil "github.com/openshift/origin/test/extended/util"
1614
)
1715

1816
var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func() {
1917
var (
20-
oc = exutil.NewCLIWithPodSecurityLevel("build-volumes", admissionapi.LevelBaseline)
21-
baseDir = exutil.FixturePath("testdata", "builds", "volumes")
22-
secret = filepath.Join(baseDir, "secret.yaml")
23-
configmap = filepath.Join(baseDir, "configmap.yaml")
24-
s2iImageStream = filepath.Join(baseDir, "s2i-imagestream.yaml")
25-
s2iBuildConfig = filepath.Join(baseDir, "s2i-buildconfig.yaml")
26-
s2iDeploymentConfig = filepath.Join(baseDir, "s2i-deploymentconfig.yaml")
27-
dockerImageStream = filepath.Join(baseDir, "docker-imagestream.yaml")
28-
dockerBuildConfig = filepath.Join(baseDir, "docker-buildconfig.yaml")
29-
dockerDeploymentConfig = filepath.Join(baseDir, "docker-deploymentconfig.yaml")
18+
oc = exutil.NewCLIWithPodSecurityLevel("build-volumes", admissionapi.LevelBaseline)
19+
baseDir = exutil.FixturePath("testdata", "builds", "volumes")
20+
secret = filepath.Join(baseDir, "secret.yaml")
21+
configmap = filepath.Join(baseDir, "configmap.yaml")
22+
s2iImageStream = filepath.Join(baseDir, "s2i-imagestream.yaml")
23+
s2iBuildConfig = filepath.Join(baseDir, "s2i-buildconfig.yaml")
24+
s2iDeployment = filepath.Join(baseDir, "s2i-deployment.yaml")
25+
dockerImageStream = filepath.Join(baseDir, "docker-imagestream.yaml")
26+
dockerBuildConfig = filepath.Join(baseDir, "docker-buildconfig.yaml")
27+
dockerDeployment = filepath.Join(baseDir, "docker-deployment.yaml")
3028
)
3129

3230
g.Context("", func() {
@@ -53,7 +51,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
5351
}
5452
})
5553

56-
g.It("should mount given secrets and configmaps into the build pod for source strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
54+
g.It("should mount given secrets and configmaps into the build pod for source strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io]", func() {
5755
g.By("creating an imagestream")
5856
err := oc.Run("create").Args("-f", s2iImageStream).Execute()
5957
o.Expect(err).NotTo(o.HaveOccurred())
@@ -72,26 +70,29 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
7270
o.Expect(buildPodLogs).To(o.ContainSubstring("my-secret-value"))
7371
o.Expect(buildPodLogs).To(o.ContainSubstring("my-configmap-value"))
7472

75-
g.By("creating a deployment config")
76-
err = oc.Run("create").Args("-f", s2iDeploymentConfig).Execute()
73+
g.By("creating a deployment")
74+
err = oc.Run("create").Args("-f", s2iDeployment).Execute()
75+
o.Expect(err).NotTo(o.HaveOccurred())
76+
77+
projectName, err := oc.Run("project").Args("-q").Output()
7778
o.Expect(err).NotTo(o.HaveOccurred())
7879

7980
g.By("waiting for the deployment to complete")
80-
_, err = deploymentutil.WaitForDeployerToComplete(oc, "mys2itest-1", 5*time.Minute)
81+
err = exutil.WaitForDeploymentReady(oc, "mys2itest", projectName, -1)
8182
o.Expect(err).NotTo(o.HaveOccurred())
8283

8384
g.By("ensuring that the secret does not exist in the build image")
84-
out, err := oc.Run("rsh").Args("dc/mys2itest", "cat", "/var/run/secrets/some-secret/key").Output()
85+
out, err := oc.Run("rsh").Args("deployment/mys2itest", "cat", "/var/run/secrets/some-secret/key").Output()
8586
o.Expect(err).To(o.HaveOccurred())
8687
o.Expect(out).To(o.ContainSubstring("cat: /var/run/secrets/some-secret/key: No such file or directory"))
8788

8889
g.By("ensuring that the configmap does not exist in the build image")
89-
out, err = oc.Run("rsh").Args("dc/mys2itest", "cat", "/var/run/configmaps/some-configmap/key").Output()
90+
out, err = oc.Run("rsh").Args("deployment/mys2itest", "cat", "/var/run/configmaps/some-configmap/key").Output()
9091
o.Expect(err).To(o.HaveOccurred())
9192
o.Expect(out).To(o.ContainSubstring("cat: /var/run/configmaps/some-configmap/key: No such file or directory"))
9293
})
9394

94-
g.It("should mount given secrets and configmaps into the build pod for docker strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
95+
g.It("should mount given secrets and configmaps into the build pod for docker strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io]", func() {
9596
g.By("creating an imagestream")
9697
err := oc.Run("create").Args("-f", dockerImageStream).Execute()
9798
o.Expect(err).NotTo(o.HaveOccurred())
@@ -110,21 +111,24 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
110111
o.Expect(buildPodLogs).To(o.ContainSubstring("my-secret-value"))
111112
o.Expect(buildPodLogs).To(o.ContainSubstring("my-configmap-value"))
112113

113-
g.By("creating a deployment config")
114-
err = oc.Run("create").Args("-f", dockerDeploymentConfig).Execute()
114+
g.By("creating a deployment")
115+
err = oc.Run("create").Args("-f", dockerDeployment).Execute()
116+
o.Expect(err).NotTo(o.HaveOccurred())
117+
118+
projectName, err := oc.Run("project").Args("-q").Output()
115119
o.Expect(err).NotTo(o.HaveOccurred())
116120

117121
g.By("waiting for the deployment to complete")
118-
_, err = deploymentutil.WaitForDeployerToComplete(oc, "mydockertest-1", 5*time.Minute)
122+
err = exutil.WaitForDeploymentReady(oc, "mydockertest", projectName, -1)
119123
o.Expect(err).NotTo(o.HaveOccurred())
120124

121125
g.By("ensuring that the secret does not exist in the build image")
122-
out, err := oc.Run("rsh").Args("dc/mydockertest", "cat", "/var/run/secrets/some-secret/key").Output()
126+
out, err := oc.Run("rsh").Args("deployment/mydockertest", "cat", "/var/run/secrets/some-secret/key").Output()
123127
o.Expect(err).To(o.HaveOccurred())
124128
o.Expect(out).To(o.ContainSubstring("cat: /var/run/secrets/some-secret/key: No such file or directory"))
125129

126130
g.By("ensuring that the configmap does not exist in the build image")
127-
out, err = oc.Run("rsh").Args("dc/mydockertest", "cat", "/var/run/configmaps/some-configmap/key").Output()
131+
out, err = oc.Run("rsh").Args("deployment/mydockertest", "cat", "/var/run/configmaps/some-configmap/key").Output()
128132
o.Expect(err).To(o.HaveOccurred())
129133
o.Expect(out).To(o.ContainSubstring("cat: /var/run/configmaps/some-configmap/key: No such file or directory"))
130134
})
@@ -134,13 +138,13 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
134138
var _ = g.Describe("[sig-builds][Feature:Builds][volumes] csi build volumes within Tech Preview enabled cluster", func() {
135139
defer g.GinkgoRecover()
136140
var (
137-
oc = exutil.NewCLIWithPodSecurityLevel("build-volumes-csi", admissionapi.LevelBaseline)
138-
baseDir = exutil.FixturePath("testdata", "builds", "volumes")
139-
secret = filepath.Join(baseDir, "secret.yaml")
140-
s2iDeploymentConfig = filepath.Join(baseDir, "s2i-deploymentconfig.yaml")
141-
s2iImageStream = filepath.Join(baseDir, "s2i-imagestream.yaml")
142-
dockerDeploymentConfig = filepath.Join(baseDir, "docker-deploymentconfig.yaml")
143-
dockerImageStream = filepath.Join(baseDir, "docker-imagestream.yaml")
141+
oc = exutil.NewCLIWithPodSecurityLevel("build-volumes-csi", admissionapi.LevelBaseline)
142+
baseDir = exutil.FixturePath("testdata", "builds", "volumes")
143+
secret = filepath.Join(baseDir, "secret.yaml")
144+
s2iDeployment = filepath.Join(baseDir, "s2i-deployment.yaml")
145+
s2iImageStream = filepath.Join(baseDir, "s2i-imagestream.yaml")
146+
dockerDeployment = filepath.Join(baseDir, "docker-deployment.yaml")
147+
dockerImageStream = filepath.Join(baseDir, "docker-imagestream.yaml")
144148
// csi enabled volume specifics
145149
csiSharedSecret = filepath.Join(baseDir, "csi-sharedsecret.yaml")
146150
csiSharedRole = filepath.Join(baseDir, "csi-sharedresourcerole.yaml")
@@ -196,7 +200,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] csi build volumes with
196200
}
197201
})
198202

199-
g.It("should mount given csi shared resource secret into the build pod for source strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
203+
g.It("should mount given csi shared resource secret into the build pod for source strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io]", func() {
200204
g.By("creating an imagestream")
201205
err := oc.Run("create").Args("-f", s2iImageStream).Execute()
202206
o.Expect(err).NotTo(o.HaveOccurred())
@@ -214,21 +218,24 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] csi build volumes with
214218
o.Expect(err).NotTo(o.HaveOccurred())
215219
o.Expect(buildPodLogs).To(o.ContainSubstring("my-secret-value"))
216220

217-
g.By("creating a deployment config")
218-
err = oc.Run("create").Args("-f", s2iDeploymentConfig).Execute()
221+
g.By("creating a deployment")
222+
err = oc.Run("create").Args("-f", s2iDeployment).Execute()
223+
o.Expect(err).NotTo(o.HaveOccurred())
224+
225+
projectName, err := oc.Run("project").Args("-q").Output()
219226
o.Expect(err).NotTo(o.HaveOccurred())
220227

221228
g.By("waiting for the deployment to complete")
222-
_, err = deploymentutil.WaitForDeployerToComplete(oc, "mys2itest-1", 5*time.Minute)
229+
err = exutil.WaitForDeploymentReady(oc, "mys2itest", projectName, -1)
223230
o.Expect(err).NotTo(o.HaveOccurred())
224231

225232
g.By("ensuring that the shared secret does not exist in the build image")
226-
out, err := oc.Run("rsh").Args("dc/mys2itest", "cat", "/var/run/secrets/some-secret/key").Output()
233+
out, err := oc.Run("rsh").Args("deployment/mys2itest", "cat", "/var/run/secrets/some-secret/key").Output()
227234
o.Expect(err).To(o.HaveOccurred())
228235
o.Expect(out).To(o.ContainSubstring("cat: /var/run/secrets/some-secret/key: No such file or directory"))
229236
})
230237

231-
g.It("should mount given csi shared resource secret without resource refresh into the build pod for source strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
238+
g.It("should mount given csi shared resource secret without resource refresh into the build pod for source strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io]", func() {
232239
g.By("creating an imagestream")
233240
err := oc.Run("create").Args("-f", s2iImageStream).Execute()
234241
o.Expect(err).NotTo(o.HaveOccurred())
@@ -246,21 +253,24 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] csi build volumes with
246253
o.Expect(err).NotTo(o.HaveOccurred())
247254
o.Expect(buildPodLogs).To(o.ContainSubstring("my-secret-value"))
248255

249-
g.By("creating a deployment config")
250-
err = oc.Run("create").Args("-f", s2iDeploymentConfig).Execute()
256+
g.By("creating a deployment")
257+
err = oc.Run("create").Args("-f", s2iDeployment).Execute()
258+
o.Expect(err).NotTo(o.HaveOccurred())
259+
260+
projectName, err := oc.Run("project").Args("-q").Output()
251261
o.Expect(err).NotTo(o.HaveOccurred())
252262

253263
g.By("waiting for the deployment to complete")
254-
_, err = deploymentutil.WaitForDeployerToComplete(oc, "mys2itest-1", 5*time.Minute)
264+
err = exutil.WaitForDeploymentReady(oc, "mys2itest", projectName, -1)
255265
o.Expect(err).NotTo(o.HaveOccurred())
256266

257267
g.By("ensuring that the shared secret does not exist in the build image")
258-
out, err := oc.Run("rsh").Args("dc/mys2itest", "cat", "/var/run/secrets/some-secret/key").Output()
268+
out, err := oc.Run("rsh").Args("deployment/mys2itest", "cat", "/var/run/secrets/some-secret/key").Output()
259269
o.Expect(err).To(o.HaveOccurred())
260270
o.Expect(out).To(o.ContainSubstring("cat: /var/run/secrets/some-secret/key: No such file or directory"))
261271
})
262272

263-
g.It("should mount given csi shared resource secret into the build pod for docker strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
273+
g.It("should mount given csi shared resource secret into the build pod for docker strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io]", func() {
264274
g.By("creating an imagestream")
265275
err := oc.Run("create").Args("-f", dockerImageStream).Execute()
266276
o.Expect(err).NotTo(o.HaveOccurred())
@@ -278,21 +288,24 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] csi build volumes with
278288
o.Expect(err).NotTo(o.HaveOccurred())
279289
o.Expect(buildPodLogs).To(o.ContainSubstring("my-secret-value"))
280290

281-
g.By("creating a deployment config")
282-
err = oc.Run("create").Args("-f", dockerDeploymentConfig).Execute()
291+
g.By("creating a deployment")
292+
err = oc.Run("create").Args("-f", dockerDeployment).Execute()
293+
o.Expect(err).NotTo(o.HaveOccurred())
294+
295+
projectName, err := oc.Run("project").Args("-q").Output()
283296
o.Expect(err).NotTo(o.HaveOccurred())
284297

285298
g.By("waiting for the deployment to complete")
286-
_, err = deploymentutil.WaitForDeployerToComplete(oc, "mydockertest-1", 5*time.Minute)
299+
err = exutil.WaitForDeploymentReady(oc, "mydockertest", projectName, -1)
287300
o.Expect(err).NotTo(o.HaveOccurred())
288301

289302
g.By("ensuring that the shared secret does not exist in the build image")
290-
out, err := oc.Run("rsh").Args("dc/mydockertest", "cat", "/var/run/secrets/some-secret/key").Output()
303+
out, err := oc.Run("rsh").Args("deployment/mydockertest", "cat", "/var/run/secrets/some-secret/key").Output()
291304
o.Expect(err).To(o.HaveOccurred())
292305
o.Expect(out).To(o.ContainSubstring("cat: /var/run/secrets/some-secret/key: No such file or directory"))
293306
})
294307

295-
g.It("should mount given csi shared resource secret without resource refresh into the build pod for docker strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
308+
g.It("should mount given csi shared resource secret without resource refresh into the build pod for docker strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io]", func() {
296309
g.By("creating an imagestream")
297310
err := oc.Run("create").Args("-f", dockerImageStream).Execute()
298311
o.Expect(err).NotTo(o.HaveOccurred())
@@ -310,16 +323,19 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] csi build volumes with
310323
o.Expect(err).NotTo(o.HaveOccurred())
311324
o.Expect(buildPodLogs).To(o.ContainSubstring("my-secret-value"))
312325

313-
g.By("creating a deployment config")
314-
err = oc.Run("create").Args("-f", dockerDeploymentConfig).Execute()
326+
g.By("creating a deployment")
327+
err = oc.Run("create").Args("-f", dockerDeployment).Execute()
328+
o.Expect(err).NotTo(o.HaveOccurred())
329+
330+
projectName, err := oc.Run("project").Args("-q").Output()
315331
o.Expect(err).NotTo(o.HaveOccurred())
316332

317333
g.By("waiting for the deployment to complete")
318-
_, err = deploymentutil.WaitForDeployerToComplete(oc, "mydockertest-1", 5*time.Minute)
334+
err = exutil.WaitForDeploymentReady(oc, "mydockertest", projectName, -1)
319335
o.Expect(err).NotTo(o.HaveOccurred())
320336

321337
g.By("ensuring that the shared secret does not exist in the build image")
322-
out, err := oc.Run("rsh").Args("dc/mydockertest", "cat", "/var/run/secrets/some-secret/key").Output()
338+
out, err := oc.Run("rsh").Args("deployment/mydockertest", "cat", "/var/run/secrets/some-secret/key").Output()
323339
o.Expect(err).To(o.HaveOccurred())
324340
o.Expect(out).To(o.ContainSubstring("cat: /var/run/secrets/some-secret/key: No such file or directory"))
325341
})

0 commit comments

Comments
 (0)