DX2003
DX2003

Reputation: 138

Can gcloud builds submit run in background?

I'm trying to automate my builds using Google Cloud Build. For various reasons the primary use flow will be to manually kick off builds rather than using a Github trigger.

Right now it looks like when you run

gcloud builds submit .

it kicks off the build process but the gcloud command must stay running for the build to continue. If I Ctrl-C it then it stops the entire build process.

I could run it in the background but presumably if I get disconnected from the network or my laptop goes to sleep that will also interrupt the build process(?)

Clearly the build can run in the background since that's what a Github trigger does; is there any way I can do the same thing from the command line?

Upvotes: 1

Views: 1002

Answers (1)

DazWilkin
DazWilkin

Reputation: 40136

If you add --async to your gcloud builds ... command, the job will be run asynchronously, as a long-running operation.

You may query the state of this operation in order to determine the state of the build.

https://cloud.google.com/sdk/gcloud/reference/builds/submit

Alternatively, you may use something like Linux screen to keep any job running after you detach.

Upvotes: 3

Related Questions