Example #1
0
			jobBuild, err := pipelineDB.CreateJobBuild("some-job")
			Expect(err).NotTo(HaveOccurred())

			// To show that it returns volumes that are used in both one-off builds and job builds
			volume1 := db.Volume{
				WorkerName: "worker-1",
				TTL:        2 * time.Minute,
				Handle:     "volume-1",
				VolumeIdentifier: db.VolumeIdentifier{
					ResourceVersion: atc.Version{"digest": "digest-1"},
					ResourceHash:    `docker:{"repository":"repository-1"}`,
				},
			}
			err = database.InsertVolume(volume1)
			Expect(err).NotTo(HaveOccurred())
			err = database.SaveImageResourceVersion(oneOffBuildA.ID, "plan-id-1", volume1.VolumeIdentifier)
			Expect(err).NotTo(HaveOccurred())
			err = database.SaveImageResourceVersion(jobBuild.ID, "plan-id-1", volume1.VolumeIdentifier)
			Expect(err).NotTo(HaveOccurred())

			// To show that it can return more than one volume per build ID
			volume2 := db.Volume{
				WorkerName: "worker-2",
				TTL:        2 * time.Minute,
				Handle:     "volume-2",
				VolumeIdentifier: db.VolumeIdentifier{
					ResourceVersion: atc.Version{"digest": "digest-2"},
					ResourceHash:    `docker:{"repository":"repository-2"}`,
				},
			}
			err = database.InsertVolume(volume2)