OC(1)

πŸ“¦
version 4.22.0 Β· 2 versions
, in nixpkgs unstable

πŸ’… OC(1) β€” ok bestie let's cancel some builds

So you opened the manual page for oc and specifically the cancel-build command. No cap, this one's actually useful. It's from Openshift and it was ported over in June 2016 β€” vintage, but the vibe check still passes.


✨ NAME ✨

oc cancel-build β€” the one that cancels running, pending, or new builds 🫢


🌸 SYNOPSIS 🌸

oc cancel-build [OPTIONS]

That's it. That's the whole vibe. Just fire it off with whatever options you need πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so here's the tea: this command cancels running, pending, or new builds. All three flavors, she handles them.

But listen β€” it's not a snap your fingers and it's gone situation. This command requests a graceful shutdown of the build. So there may be a delay between you requesting the build be cancelled and the build actually being terminated. She's polite, she's not gonna yank the plug mid-sentence 😭

Bestie heads up: if you're expecting instant obliteration, you're gonna have a moment of waiting. Breathe. The build is on its way out 🌈

πŸŽ€ OPTIONS πŸŽ€

  • --dump-logs=false β€” Specify if the build logs for the cancelled build should be shown. Default is false, so if you want the receipts, you gotta ask for them πŸ”₯
  • --restart=false β€” Specify if a new build should be created after the current build is cancelled. Like a phoenix but make it CI. Defaults to false ngl.
  • --state=[new,pending,running] β€” Only cancel builds in this state. Pick from new, pending, or running. Very much a "be specific about who you're cancelling" situation πŸ’…

πŸ’œ OPTIONS INHERITED FROM PARENT COMMANDS πŸ’œ

Yeah, cancel-build didn't come alone β€” she brought her whole friend group from the parent oc command. These are all inherited, so they work here too. Periodt.

  • --as="" β€” Username to impersonate for the operation. User could be a regular user or a service account in a namespace.
  • --as-group=[] β€” Group to impersonate for the operation, this flag can be repeated to specify multiple groups. Repeat as much as you want, she doesn't mind 🫢
  • --as-uid="" β€” UID to impersonate for the operation.
  • --as-user-extra=[] β€” User extras to impersonate for the operation, this flag can be repeated to specify multiple values for the same key.
  • --cache-dir="/homeless-shelter/.kube/cache" β€” Default cache directory β€” yes that's literally the path, don't come for me, I just work here 🏠
  • --certificate-authority="" β€” Path to a cert file for the certificate authority
  • --client-certificate="" β€” Path to a client certificate file for TLS
  • --client-key="" β€” Path to a client key file for TLS
  • --cluster="" β€” The name of the kubeconfig cluster to use
  • --context="" β€” The name of the kubeconfig context to use
  • --disable-compression=false β€” If true, opt-out of response compression for all requests to the server
  • --insecure-skip-tls-verify=false β€” If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
⚠️ ok real talk: that one literally says it makes your HTTPS connections insecure. It's giving danger. Only if you know what you're doing, bestie πŸ’€
  • --kubeconfig="" β€” Path to the kubeconfig file to use for CLI requests.
  • --kuberc="" β€” Path to the kuberc file to use for preferences. This can be disabled by exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=off.
  • --match-server-version=false β€” Require server version to match client version
  • -n, --namespace="" β€” If present, the namespace scope for this CLI request
  • --profile="none" β€” Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) β€” pick your fighter 🌈
  • --profile-output="profile.pprof" β€” Name of the file to write the profile to
  • --request-timeout="0" β€” The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. Zero = she waits forever, main character energy honestly ⭐
  • -s, --server="" β€” The address and port of the Kubernetes API server
  • --tls-server-name="" β€” Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used
  • --token="" β€” Bearer token for authentication to the API server
  • --user="" β€” The name of the kubeconfig user to use
  • --warnings-as-errors=false β€” Treat warnings received from the server as errors and exit with a non-zero exit code β€” she's strict, she's got boundaries πŸ”₯

🌟 EXAMPLE 🌟

These are the moment, honestly. Copy them exactly, no cap:

# Cancel the build with the given name
oc cancel-build ruby-build-2

# Cancel the named build and print the build logs
oc cancel-build ruby-build-2 --dump-logs

# Cancel the named build and create a new one with the same parameters
oc cancel-build ruby-build-2 --restart

# Cancel multiple builds
oc cancel-build ruby-build-1 ruby-build-2 ruby-build-3

# Cancel all builds created from the 'ruby-build' build config that are in the 'new' state
oc cancel-build bc/ruby-build --state=new

See how the last one uses bc/ruby-build? That's you being all fancy with the build config reference. Iconic πŸ‘‘


🧚 SEE ALSO 🧚

  • oc(1) β€” the mothership. Go say hi to her too πŸ’–

⭐ HISTORY ⭐

June 2016, Ported from the Kubernetes man-doc generator β€” a genuine throwback, iykyk πŸŽ€


Okay that's the whole page bestie!! Big mwah to Openshift and the Openshift CLI User Manuals for this one, dated June 2016. Go forth and cancel builds responsibly, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from