Skip to content

Commit f03f09a

Browse files
graysidebcoerelease-please[bot]JustinBeckwithrenovate-bot
authored
migrate code from googleapis/nodejs-cloudbuild (#2824)
* feat: initial release of cloud build library (#2) * feat(docs): add listBuildTriggers sample to README (#5) * feat: moves library to TypeScript code generation (#10) * chore: release 1.0.0 (#3) * chore: release 1.1.0 (#20) * chore: update license headers * chore: release 1.2.0 (#25) * chore: release 1.3.0 (#33) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] * chore(deps): update dependency c8 to v7 (#38) * refactor: use explicit mocha imports (#40) * chore(deps): update dependency mocha to v7 (#43) * chore: release 1.3.1 * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] * chore: release 1.3.2 (#49) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] * chore: release 1.3.3 (#59) * chore: release 1.4.0 (#63) * chore: release 1.5.0 (#67) * chore(deps): update dependency mocha to v8 (#122) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [mocha](https://mochajs.org/) ([source](https://togithub.com/mochajs/mocha)) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/mocha/7.2.0/8.0.1) | --- ### Release Notes <details> <summary>mochajs/mocha</summary> ### [`v8.0.1`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#&#8203;801--2020-06-10) [Compare Source](https://togithub.com/mochajs/mocha/compare/v8.0.0...v8.0.1) The obligatory patch after a major. #### 🐛 Fixes - [#&#8203;4328](https://togithub.com/mochajs/mocha/issues/4328): Fix `--parallel` when combined with `--watch` ([**@&#8203;boneskull**](https://togithub.com/boneskull)) ### [`v8.0.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#&#8203;800--2020-06-10) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.2.0...v8.0.0) In this major release, Mocha adds the ability to _run tests in parallel_. Better late than never! Please note the **breaking changes** detailed below. Let's welcome [**@&#8203;giltayar**](https://togithub.com/giltayar) and [**@&#8203;nicojs**](https://togithub.com/nicojs) to the maintenance team! #### 💥 Breaking Changes - [#&#8203;4164](https://togithub.com/mochajs/mocha/issues/4164): **Mocha v8.0.0 now requires Node.js v10.0.0 or newer.** Mocha no longer supports the Node.js v8.x line ("Carbon"), which entered End-of-Life at the end of 2019 ([**@&#8203;UlisesGascon**](https://togithub.com/UlisesGascon)) - [#&#8203;4175](https://togithub.com/mochajs/mocha/issues/4175): Having been deprecated with a warning since v7.0.0, **`mocha.opts` is no longer supported** ([**@&#8203;juergba**](https://togithub.com/juergba)) ✨ **WORKAROUND:** Replace `mocha.opts` with a [configuration file](https://mochajs.org/#configuring-mocha-nodejs). - [#&#8203;4260](https://togithub.com/mochajs/mocha/issues/4260): Remove `enableTimeout()` (`this.enableTimeout()`) from the context object ([**@&#8203;craigtaub**](https://togithub.com/craigtaub)) ✨ **WORKAROUND:** Replace usage of `this.enableTimeout(false)` in your tests with `this.timeout(0)`. - [#&#8203;4315](https://togithub.com/mochajs/mocha/issues/4315): The `spec` option no longer supports a comma-delimited list of files ([**@&#8203;juergba**](https://togithub.com/juergba)) ✨ **WORKAROUND**: Use an array instead (e.g., `"spec": "foo.js,bar.js"` becomes `"spec": ["foo.js", "bar.js"]`). - [#&#8203;4309](https://togithub.com/mochajs/mocha/issues/4309): Drop support for Node.js v13.x line, which is now End-of-Life ([**@&#8203;juergba**](https://togithub.com/juergba)) - [#&#8203;4282](https://togithub.com/mochajs/mocha/issues/4282): `--forbid-only` will throw an error even if exclusive tests are avoided via `--grep` or other means ([**@&#8203;arvidOtt**](https://togithub.com/arvidOtt)) - [#&#8203;4223](https://togithub.com/mochajs/mocha/issues/4223): The context object's `skip()` (`this.skip()`) in a "before all" (`before()`) hook will no longer execute subsequent sibling hooks, in addition to hooks in child suites ([**@&#8203;juergba**](https://togithub.com/juergba)) - [#&#8203;4178](https://togithub.com/mochajs/mocha/issues/4178): Remove previously soft-deprecated APIs ([**@&#8203;wnghdcjfe**](https://togithub.com/wnghdcjfe)): - `Mocha.prototype.ignoreLeaks()` - `Mocha.prototype.useColors()` - `Mocha.prototype.useInlineDiffs()` - `Mocha.prototype.hideDiff()` #### 🎉 Enhancements - [#&#8203;4245](https://togithub.com/mochajs/mocha/issues/4245): Add ability to run tests in parallel for Node.js (see [docs](https://mochajs.org/#parallel-tests)) ([**@&#8203;boneskull**](https://togithub.com/boneskull)) ❗ See also [#&#8203;4244](https://togithub.com/mochajs/mocha/issues/4244); [Root Hook Plugins (docs)](https://mochajs.org/#root-hook-plugins) -- _root hooks must be defined via Root Hook Plugins to work in parallel mode_ - [#&#8203;4304](https://togithub.com/mochajs/mocha/issues/4304): `--require` now works with ES modules ([**@&#8203;JacobLey**](https://togithub.com/JacobLey)) - [#&#8203;4299](https://togithub.com/mochajs/mocha/issues/4299): In some circumstances, Mocha can run ES modules under Node.js v10 -- _use at your own risk!_ ([**@&#8203;giltayar**](https://togithub.com/giltayar)) #### 📖 Documentation - [#&#8203;4246](https://togithub.com/mochajs/mocha/issues/4246): Add documentation for parallel mode and Root Hook plugins ([**@&#8203;boneskull**](https://togithub.com/boneskull)) #### 🐛 Fixes (All bug fixes in Mocha v8.0.0 are also breaking changes, and are listed above) </details> --- ### Renovate configuration 📅 **Schedule**: "after 9am and before 3pm" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻️ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-cloudbuild). * chore: release 2.0.0 (#92) :robot: I have created a release \*beep\* \*boop\* --- ## [2.0.0](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v1.5.0...v2.0.0) (2020-06-11) ### ⚠ BREAKING CHANGES * The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on NPM. ### Features * add time-to-live in a queue for builds ([04e3387](https://www.github.com/googleapis/nodejs-cloudbuild/commit/04e3387af33a7ab39eb0c4df47ce08026507b499)) * check status of long running operation by its name ([#114](https://www.github.com/googleapis/nodejs-cloudbuild/issues/114)) ([7b50a74](https://www.github.com/googleapis/nodejs-cloudbuild/commit/7b50a74c098e782393f92140a37e3bd26f45e77d)) * drop node8 support, support for async iterators ([#91](https://www.github.com/googleapis/nodejs-cloudbuild/issues/91)) ([74a195d](https://www.github.com/googleapis/nodejs-cloudbuild/commit/74a195d5cdf63dab1ac3d0d52ef42e1254ab3a2e)) * improve support for x-goog-request-params ([#111](https://www.github.com/googleapis/nodejs-cloudbuild/issues/111)) ([e08d640](https://www.github.com/googleapis/nodejs-cloudbuild/commit/e08d64017e059c911ebe55055c26a0ab76481d86)) * move ts target to es2018 from es2016 ([#121](https://www.github.com/googleapis/nodejs-cloudbuild/issues/121)) ([59c5477](https://www.github.com/googleapis/nodejs-cloudbuild/commit/59c547744519ef9e8d073ea3ecdb81248176a71a)) ### Bug Fixes * remove eslint, update gax, fix generated protos, run the generator ([#100](https://www.github.com/googleapis/nodejs-cloudbuild/issues/100)) ([aafb9cc](https://www.github.com/googleapis/nodejs-cloudbuild/commit/aafb9cc7745b4d5d6dce58f17763f76379af733f)) * synth.py clean up for multiple version ([#115](https://www.github.com/googleapis/nodejs-cloudbuild/issues/115)) ([aa7d99b](https://www.github.com/googleapis/nodejs-cloudbuild/commit/aa7d99b9c02267808cac07f7691f5ce62f06ca14)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). * chore: release 2.0.1 (#126) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * chore: release 2.0.2 (#133) :robot: I have created a release \*beep\* \*boop\* --- ### [2.0.2](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v2.0.1...v2.0.2) (2020-07-09) ### Bug Fixes * typeo in nodejs .gitattribute ([#132](https://www.github.com/googleapis/nodejs-cloudbuild/issues/132)) ([80b5bd9](https://www.github.com/googleapis/nodejs-cloudbuild/commit/80b5bd963aa43e5a47da9e6d0e2ffbf0cde7feef)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). * chore: release 2.0.3 (#143) * chore: updated samples/package.json [ci skip] * chore: updated CHANGELOG.md [ci skip] * chore: updated package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * chore: release 2.0.4 (#179) :robot: I have created a release \*beep\* \*boop\* --- ### [2.0.4](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v2.0.3...v2.0.4) (2020-11-03) ### ⚠ BREAKING CHANGES * The WorkerPool API in the v1 surface has been long deprecated, so it has been deleted from the v1 surface. Alpha WorkerPool customers who want to call the WorkerPool API can use gcloud. ### Features * updated third_party Cloud Build clients with new Build message, fix: revert removal of WorkerPool API ([#166](https://www.github.com/googleapis/nodejs-cloudbuild/issues/166)) ([b8d7a39](https://www.github.com/googleapis/nodejs-cloudbuild/commit/b8d7a395bbcc2f6ff83b798ef678e2f27395802d)) ### Bug Fixes * revert removal of WorkerPool API ([#178](https://www.github.com/googleapis/nodejs-cloudbuild/issues/178)) ([07400cb](https://www.github.com/googleapis/nodejs-cloudbuild/commit/07400cbcb05808762ab3c56c5827607cdefd43c0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). * chore: release 2.0.5 (#182) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * chore: release 2.0.6 (#186) :robot: I have created a release \*beep\* \*boop\* --- ### [2.0.6](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v2.0.5...v2.0.6) (2020-11-25) ### Bug Fixes * check for fetch on window ([#185](https://www.github.com/googleapis/nodejs-cloudbuild/issues/185)) ([115de71](https://www.github.com/googleapis/nodejs-cloudbuild/commit/115de7141262c119113759aee5ddc141d129b55d)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). * chore: release 2.1.0 (#205) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * chore: release 2.2.0 (#213) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Olivier Bourgeois <[email protected]> * chore: release 2.2.1 (#220) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * chore: release 2.2.2 (#227) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * chore: release 2.2.3 (#232) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * chore: release 2.2.4 (#242) :robot: I have created a release \*beep\* \*boop\* --- ### [2.2.4](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v2.2.3...v2.2.4) (2021-06-24) ### Bug Fixes * make request optional in all cases ([#241](https://www.github.com/googleapis/nodejs-cloudbuild/issues/241)) ([c96003a](https://www.github.com/googleapis/nodejs-cloudbuild/commit/c96003a4897d3f7c8181a56c273b842a4dcdfbf7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). * chore: release 2.2.5 (#247) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * chore: release 2.2.6 (#250) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * chore: release 2.2.7 (#252) :robot: I have created a release \*beep\* \*boop\* --- ### [2.2.7](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v2.2.6...v2.2.7) (2021-07-21) ### Bug Fixes * Updating WORKSPACE files to use the newest version of the Typescript generator. ([#251](https://www.github.com/googleapis/nodejs-cloudbuild/issues/251)) ([7bc5f7f](https://www.github.com/googleapis/nodejs-cloudbuild/commit/7bc5f7ff6c1485baaf1444a608d8ebb88ad20cfe)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). * chore: release 2.3.0 (#263) :robot: I have created a release \*beep\* \*boop\* --- ## [2.3.0](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v2.2.7...v2.3.0) (2021-08-05) ### ⚠ BREAKING CHANGES * * feat: add a WorkerPools API ### Features * add a WorkerPools API ([#254](https://www.github.com/googleapis/nodejs-cloudbuild/issues/254)) ([2e5b3f5](https://www.github.com/googleapis/nodejs-cloudbuild/commit/2e5b3f540d9cd2b3a616c4581b07ebcfc444e7c7)) * Implementation of Build Failure Info: - Added message FailureInfo field ([#255](https://www.github.com/googleapis/nodejs-cloudbuild/issues/255)) ([6f115e2](https://www.github.com/googleapis/nodejs-cloudbuild/commit/6f115e2a4ec78289014c05f398d8464e599b1ef6)) ### Build System * force a minor release ([#262](https://www.github.com/googleapis/nodejs-cloudbuild/issues/262)) ([bc43706](https://www.github.com/googleapis/nodejs-cloudbuild/commit/bc4370692e233c265ce45546b205b9b9925d3990)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). * chore: release 2.3.1 (#266) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.1](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v2.3.0...v2.3.1) (2021-08-12) ### Bug Fixes * **build:** migrate to using main branch ([#265](https://www.github.com/googleapis/nodejs-cloudbuild/issues/265)) ([e89f829](https://www.github.com/googleapis/nodejs-cloudbuild/commit/e89f829f10c5710ca5fb259a6c8dfae1527071a3)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). * chore: release 2.3.2 (#269) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.2](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v2.3.1...v2.3.2) (2021-08-16) ### Bug Fixes * **deps:** google-gax v2.24.1 ([#268](https://www.github.com/googleapis/nodejs-cloudbuild/issues/268)) ([c26f7f7](https://www.github.com/googleapis/nodejs-cloudbuild/commit/c26f7f726db4f43f3692aea4c516547abcddd0ea)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). * chore: release 2.4.0 (#270) :robot: I have created a release \*beep\* \*boop\* --- ## [2.4.0](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v2.3.2...v2.4.0) (2021-08-16) ### Features * Add ability to configure BuildTriggers to create Builds that require approval before executing and ApproveBuild API to approve or reject pending Builds ([#267](https://www.github.com/googleapis/nodejs-cloudbuild/issues/267)) ([18ec067](https://www.github.com/googleapis/nodejs-cloudbuild/commit/18ec067ac1e112836c5d56747dda89e04f87c481)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). * chore: release 2.5.0 (#272) :robot: I have created a release \*beep\* \*boop\* --- ## [2.5.0](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v2.4.0...v2.5.0) (2021-08-23) ### Features * turns on self-signed JWT feature flag ([#271](https://www.github.com/googleapis/nodejs-cloudbuild/issues/271)) ([dcb970d](https://www.github.com/googleapis/nodejs-cloudbuild/commit/dcb970d8a6a7d87da553667cd25f8eb1052ba047)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). * chore: release 2.6.0 (#275) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * docs(samples): add example tags to generated samples (#287) * docs(samples): add example tags to generated samples PiperOrigin-RevId: 408439482 Source-Link: googleapis/googleapis@b9f6184 Source-Link: googleapis/googleapis-gen@eb888bc Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWI4ODhiYzIxNGVmYzdiZjQzYmY0NjM0YjQ3MDI1NDU2NWE2NTlhNSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: change node version for sample Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Takashi Matsuo <[email protected]> * chore(quickstart): mention private pool caveats (#317) * build!: update library to use Node 12 (#325) * feat!: Update library to use Node 12 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(main): release 3.0.0 (#326) * chore(main): release 3.0.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(main): release 3.0.1 (#328) :robot: I have created a release *beep* *boop* --- ## [3.0.1](googleapis/nodejs-cloudbuild@v3.0.0...v3.0.1) (2022-06-20) ### Bug Fixes * fixes for dynamic routing and streaming descriptors ([#327](googleapis/nodejs-cloudbuild#327)) ([4cf9b63](googleapis/nodejs-cloudbuild@4cf9b63)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). * chore(main): release 3.1.0 (#334) * chore(main): release 3.1.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(main): release 3.1.1 (#340) * chore(main): release 3.1.1 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * chore(main): release 3.1.2 (#345) * chore(main): release 3.1.2 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> * testing(cloudbuild): Add GitHub Workflows integration for test running * chore(CODEOWNERS): Add cloudbuild ownership Co-authored-by: Benjamin E. Coe <[email protected]> Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Justin Beckwith <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Olivier Bourgeois <[email protected]> Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Takashi Matsuo <[email protected]> Co-authored-by: Ace Nassri <[email protected]> Co-authored-by: Alexander Fenster <[email protected]>
1 parent df55c76 commit f03f09a

File tree

8 files changed

+255
-0
lines changed

8 files changed

+255
-0
lines changed

.github/workflows/cloudbuild.yaml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: cloudbuild
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'cloudbuild/**'
8+
pull_request:
9+
paths:
10+
- 'cloudbuild/**'
11+
pull_request_target:
12+
types: [labeled]
13+
schedule:
14+
- cron: '0 0 * * 0'
15+
jobs:
16+
test:
17+
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 60
20+
permissions:
21+
contents: 'write'
22+
pull-requests: 'write'
23+
id-token: 'write'
24+
steps:
25+
- uses: actions/[email protected]
26+
with:
27+
ref: ${{github.event.pull_request.head.ref}}
28+
repository: ${{github.event.pull_request.head.repo.full_name}}
29+
- uses: 'google-github-actions/[email protected]'
30+
with:
31+
workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider'
32+
service_account: '[email protected]'
33+
create_credentials_file: 'true'
34+
access_token_lifetime: 600s
35+
- uses: actions/[email protected]
36+
with:
37+
node-version: 16
38+
- run: npm install
39+
working-directory: cloudbuild
40+
- run: npm test
41+
working-directory: cloudbuild
42+
env:
43+
MOCHA_REPORTER_SUITENAME: cloudbuild
44+
MOCHA_REPORTER_OUTPUT: cloudbuild_sponge_log.xml
45+
MOCHA_REPORTER: xunit
46+
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
47+
uses: actions/github-script@v6
48+
with:
49+
github-token: ${{ secrets.GITHUB_TOKEN }}
50+
script: |
51+
try {
52+
await github.rest.issues.removeLabel({
53+
name: 'actions:force-run',
54+
owner: 'GoogleCloudPlatform',
55+
repo: 'nodejs-docs-samples',
56+
issue_number: context.payload.pull_request.number
57+
});
58+
} catch (e) {
59+
if (!e.message.includes('Label does not exist')) {
60+
throw e;
61+
}
62+
}
63+
- if: ${{ github.event_name == 'schedule'}}
64+
run: |
65+
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
66+
chmod +x ./flakybot
67+
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

.github/workflows/workflows.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"appengine/typescript",
1818
"appengine/websockets",
1919
"appengine/twilio",
20+
"cloudbuild",
2021
"cloud-language",
2122
"cloud-tasks/tutorial-gcf/app",
2223
"cloud-tasks/tutorial-gcf/function",

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ run @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/nodejs-samples-reviewers
1616
cloud-tasks @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/nodejs-samples-reviewers
1717
workflows @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/nodejs-samples-reviewers
1818
eventarc @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/nodejs-samples-reviewers
19+
cloudbuild @GoogleCloudPlatform/torus-dpe @GoogleCloudPlatform/nodejs-samples-reviewers
1920

2021
# Infrastructure
2122
orgpolicy @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/nodejs-samples-reviewers

cloudbuild/listBuildTriggers.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
// sample-metadata:
18+
// title: List Triggers.
19+
// description: List available build triggers.
20+
// usage: node list-build-triggers.js <PROJECT_ID>
21+
22+
// [START cloudbuild_list_build_triggers]
23+
async function listBuildTriggers(
24+
projectId = 'YOUR_PROJECT_ID' // Your Google Cloud Platform project ID
25+
) {
26+
// Imports the Google Cloud client library
27+
const {CloudBuildClient} = require('@google-cloud/cloudbuild');
28+
29+
// Creates a client
30+
const cb = new CloudBuildClient();
31+
32+
// What project should we list triggers for?
33+
const request = {
34+
projectId,
35+
};
36+
37+
const [result] = await cb.listBuildTriggers(request);
38+
console.info(JSON.stringify(result, null, 2));
39+
}
40+
// [END cloudbuild_list_build_triggers]
41+
42+
const args = process.argv.slice(2);
43+
listBuildTriggers(...args).catch(console.error);

cloudbuild/package.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "nodejs-cloudbuild-samples",
3+
"private": true,
4+
"license": "Apache-2.0",
5+
"files": [
6+
"*.js",
7+
"resources"
8+
],
9+
"author": "Google Inc.",
10+
"repository": "googleapis/nodejs-cloudbuild",
11+
"engines": {
12+
"node": ">=12.0.0"
13+
},
14+
"scripts": {
15+
"test": "c8 mocha system-test --timeout=800000"
16+
},
17+
"dependencies": {
18+
"@google-cloud/cloudbuild": "^3.1.2"
19+
},
20+
"devDependencies": {
21+
"c8": "^7.0.0",
22+
"chai": "^4.2.0",
23+
"mocha": "^8.0.0"
24+
}
25+
}

cloudbuild/quickstart.js

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
'use strict';
17+
18+
// [START cloudbuild_quickstart]
19+
async function quickstart(
20+
projectId = 'YOUR_PROJECT_ID', // Your Google Cloud Platform project ID
21+
triggerId = 'YOUR_TRIGGER_ID', // UUID for build trigger.
22+
branchName = 'BRANCH_TO_BUILD' // Branch to run build against.
23+
) {
24+
// Imports the Google Cloud client library
25+
const {CloudBuildClient} = require('@google-cloud/cloudbuild');
26+
27+
// Creates a client
28+
const cb = new CloudBuildClient();
29+
30+
// Note: for Private Pools, you'll have to specify an API endpoint value
31+
// For example:
32+
// const cb = new CloudBuildClient({ apiEndpoint: '<YOUR_POOL_REGION>-cloudbuild.googleapis.com' });
33+
34+
// Starts a build against the branch provided.
35+
const [resp] = await cb.runBuildTrigger({
36+
projectId,
37+
triggerId,
38+
source: {
39+
projectId,
40+
dir: './',
41+
branchName,
42+
},
43+
});
44+
console.info(`triggered build for ${triggerId}`);
45+
const [build] = await resp.promise();
46+
47+
const STATUS_LOOKUP = [
48+
'UNKNOWN',
49+
'Queued',
50+
'Working',
51+
'Success',
52+
'Failure',
53+
'Error',
54+
'Timeout',
55+
'Cancelled',
56+
];
57+
for (const step of build.steps) {
58+
console.info(
59+
`step:\n\tname: ${step.name}\n\tstatus: ${STATUS_LOOKUP[build.status]}`
60+
);
61+
}
62+
}
63+
// [END cloudbuild_quickstart]
64+
65+
const args = process.argv.slice(2);
66+
quickstart(...args).catch(console.error);

cloudbuild/system-test/.eslintrc.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
rules:
3+
node/no-extraneous-require: off

cloudbuild/system-test/samples.js

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
const path = require('path');
18+
const {assert} = require('chai');
19+
const {describe, it} = require('mocha');
20+
const cp = require('child_process');
21+
22+
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
23+
24+
const cwd = path.join(__dirname, '..');
25+
26+
const PROJECT_ID = process.env.GCLOUD_PROJECT;
27+
// Use list-build-triggers.js to figure out the ID of the trigger
28+
// you would like to execute.
29+
const TRIGGER_ID =
30+
process.env.TRIGGER || 'c9033094-51a9-44c5-b3a0-1d882deb4464';
31+
32+
describe('Sample Integration Tests', () => {
33+
it('should run quickstart.js', async () => {
34+
const stdout = execSync(
35+
`node ./quickstart.js ${PROJECT_ID} ${TRIGGER_ID} cloud-build-mvp`,
36+
{cwd}
37+
);
38+
// build should have exited with success status.
39+
assert.include(stdout, 'status: Success');
40+
});
41+
42+
it('should run list-build-triggers.js', async () => {
43+
const stdout = execSync(
44+
`node ./listBuildTriggers.js ${PROJECT_ID} ${TRIGGER_ID} cloud-build-mvp`,
45+
{cwd}
46+
);
47+
assert.include(stdout, 'Push-to-any-branch');
48+
});
49+
});

0 commit comments

Comments
 (0)