Using the JavaScript library, NodeJS-CloudBuild we've been able to write a Cloud Function that triggers a new Cloud Build whenever we need.
It's been stable for a few months, but starting monday, we've been getting an inconsistent error whenever we call the function: Error: 14 UNAVAILABLE: 502:Bad Gateway
The code sample is pretty simple, taken straight from the repository but with our variables.
// Creates a client
const cb = new CloudBuildClient();
// Starts a build against the branch provided.
const [resp] = await cb.runBuildTrigger({
projectId,
triggerId,
source: {
projectId,
dir: './',
branchName,
},
});
console.info(`triggered build for ${triggerId}`);
I'm not sure what changed recently to cause these return errors. It works fine when doing a "manual" trigger from the Cloud build dashboard, too.