コード例 #1
0
ファイル: path_for_build.go プロジェクト: xoebus/checkin
func PathForBuild(build atc.Build) string {
	var path string
	if build.OneOff() {
		path, _ = Routes.CreatePathForRoute(GetJoblessBuild, rata.Params{
			"build_id": fmt.Sprintf("%d", build.ID),
		})
	} else {
		path, _ = Routes.CreatePathForRoute(GetBuild, rata.Params{
			"pipeline_name": build.PipelineName,
			"job":           build.JobName,
			"build":         build.Name,
		})
	}

	return path
}
コード例 #2
0
ファイル: build_test.go プロジェクト: ACPK/atc
import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/concourse/atc"
	"github.com/concourse/atc/db"
)

var _ = Describe("Build", func() {
	Describe("OneOff", func() {
		It("returns true if there is no JobName", func() {
			build := atc.Build{
				JobName: "",
			}
			Expect(build.OneOff()).To(BeTrue())
		})

		It("returns false if there is a JobName", func() {
			build := atc.Build{
				JobName: "something",
			}
			Expect(build.OneOff()).To(BeFalse())
		})
	})

	Describe("IsRunning", func() {
		It("returns true if the build is pending", func() {
			build := atc.Build{
				Status: string(atc.StatusPending),
			}