github.com/yrj2011/jx-test-infra@v0.0.0-20190529031832-7a2065ee98eb/prow/kube/prowjob.go (about) 1 /* 2 Copyright 2018 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package kube 18 19 import ( 20 "k8s.io/test-infra/prow/apis/prowjobs/v1" 21 ) 22 23 // The following are aliases to aid in the refactoring while we move 24 // API definitions under prow/apis/ 25 26 // ProwJobType specifies how the job is triggered. 27 type ProwJobType = v1.ProwJobType 28 29 // ProwJobState specifies whether the job is running 30 type ProwJobState = v1.ProwJobState 31 32 // ProwJobAgent specifies the controller (such as plank or jenkins-agent) that runs the job. 33 type ProwJobAgent = v1.ProwJobAgent 34 35 // Various job types. 36 const ( 37 // PresubmitJob means it runs on unmerged PRs. 38 PresubmitJob = v1.PresubmitJob 39 // PostsubmitJob means it runs on each new commit. 40 PostsubmitJob = v1.PostsubmitJob 41 // Periodic job means it runs on a time-basis, unrelated to git changes. 42 PeriodicJob = v1.PeriodicJob 43 // BatchJob tests multiple unmerged PRs at the same time. 44 BatchJob = v1.BatchJob 45 ) 46 47 // Various job states. 48 const ( 49 // TriggeredState means the job has been created but not yet scheduled. 50 TriggeredState = v1.TriggeredState 51 // PendingState means the job is scheduled but not yet running. 52 PendingState = v1.PendingState 53 // SuccessState means the job completed without error (exit 0) 54 SuccessState = v1.SuccessState 55 // FailureState means the job completed with errors (exit non-zero) 56 FailureState = v1.FailureState 57 // AbortedState means prow killed the job early (new commit pushed, perhaps). 58 AbortedState = v1.AbortedState 59 // ErrorState means the job could not schedule (bad config, perhaps). 60 ErrorState = v1.ErrorState 61 ) 62 63 const ( 64 // KubernetesAgent means prow will create a pod to run this job. 65 KubernetesAgent = v1.KubernetesAgent 66 // JenkinsAgent means prow will schedule the job on jenkins. 67 JenkinsAgent = v1.JenkinsAgent 68 // BuildAgent means a knative build controller will perform the build steps for the job. 69 BuildAgent = v1.BuildAgent 70 ) 71 72 const ( 73 // CreatedByProw is added on pods created by prow. We cannot 74 // really use owner references because pods may reside on a 75 // different namespace from the namespace parent prowjobs 76 // live and that would cause the k8s garbage collector to 77 // identify those prow pods as orphans and delete them 78 // instantly. 79 // TODO: Namespace this label. 80 CreatedByProw = "created-by-prow" 81 // ProwJobTypeLabel is added in pods created by prow and 82 // carries the job type (presubmit, postsubmit, periodic, batch) 83 // that the pod is running. 84 ProwJobTypeLabel = "prow.k8s.io/type" 85 // ProwJobIDLabel is added in pods created by prow and 86 // carries the ID of the ProwJob that the pod is fulfilling. 87 // We also name pods after the ProwJob that spawned them but 88 // this allows for multiple resources to be linked to one 89 // ProwJob. 90 ProwJobIDLabel = "prow.k8s.io/id" 91 // ProwJobAnnotation is added in pods created by prow and 92 // carries the name of the job that the pod is running. Since 93 // job names can be arbitrarily long, this is added as 94 // an annotation instead of a label. 95 ProwJobAnnotation = "prow.k8s.io/job" 96 ) 97 98 // ProwJob contains the spec as well as runtime metadata. 99 type ProwJob = v1.ProwJob 100 101 // ProwJobSpec configures the details of the prow job. 102 // 103 // Details include the podspec, code to clone, the cluster it runs 104 // any child jobs, concurrency limitations, etc. 105 type ProwJobSpec = v1.ProwJobSpec 106 107 // DecorationConfig specifies how to augment pods. 108 // 109 // This is primarily used to provide automatic integration with gubernator 110 // and testgrid. 111 type DecorationConfig = v1.DecorationConfig 112 113 // UtilityImages holds pull specs for the utility images 114 // to be used for a job 115 type UtilityImages = v1.UtilityImages 116 117 // PathStrategy specifies minutia about how to contruct the url. 118 // Usually consumed by gubernator/testgrid. 119 const ( 120 PathStrategyLegacy = v1.PathStrategyLegacy 121 PathStrategySingle = v1.PathStrategySingle 122 PathStrategyExplicit = v1.PathStrategyExplicit 123 ) 124 125 // GCSConfiguration holds options for pushing logs and 126 // artifacts to GCS from a job. 127 type GCSConfiguration = v1.GCSConfiguration 128 129 // ProwJobStatus provides runtime metadata, such as when it finished, whether it is running, etc. 130 type ProwJobStatus = v1.ProwJobStatus 131 132 // Pull describes a pull request at a particular point in time. 133 type Pull = v1.Pull 134 135 // Refs describes how the repo was constructed. 136 type Refs = v1.Refs