Browse code

Output more helpful cancel message

Jordan Liggitt authored on 2015/12/17 06:19:11
Showing 1 changed files
... ...
@@ -151,6 +151,11 @@ func RunCancelBuild(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, arg
151 151
 
152 152
 // isBuildCancellable checks if another cancellation event was triggered, and if the build status is correct.
153 153
 func isBuildCancellable(build *buildapi.Build, out io.Writer) bool {
154
+	if build.Status.Cancelled {
155
+		fmt.Fprintf(out, "A cancellation event was already triggered for the build %s.\n", build.Name)
156
+		return false
157
+	}
158
+
154 159
 	if build.Status.Phase != buildapi.BuildPhaseNew &&
155 160
 		build.Status.Phase != buildapi.BuildPhasePending &&
156 161
 		build.Status.Phase != buildapi.BuildPhaseRunning {
... ...
@@ -159,9 +164,5 @@ func isBuildCancellable(build *buildapi.Build, out io.Writer) bool {
159 159
 		return false
160 160
 	}
161 161
 
162
-	if build.Status.Cancelled {
163
-		fmt.Fprintf(out, "A cancellation event was already triggered for the build %s.\n", build.Name)
164
-		return false
165
-	}
166 162
 	return true
167 163
 }