From 027e3867881ce34e87f057a046077d4ede4a1aad Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Mon, 10 Feb 2020 13:56:48 -0800 Subject: [PATCH 01/51] Initial client library creation --- game-servers/snippets/package.json | 23 ++++++++++++++++ game-servers/snippets/quickstart.js | 29 ++++++++++++++++++++ game-servers/snippets/test/quickstart.js | 34 ++++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 game-servers/snippets/package.json create mode 100644 game-servers/snippets/quickstart.js create mode 100644 game-servers/snippets/test/quickstart.js diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json new file mode 100644 index 0000000000..1202f25b5d --- /dev/null +++ b/game-servers/snippets/package.json @@ -0,0 +1,23 @@ +{ + "name": "nodejs-game-server-samples", + "private": true, + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=8" + }, + "files": [ + "*.js" + ], + "scripts": { + "test": "c8 mocha --timeout 600000 test/*.js" + }, + "dependencies": { + "@google-cloud/game-servers": "^1.0.1" + }, + "devDependencies": { + "c8": "^5.0.1", + "chai": "^4.2.0", + "mocha": "^6.1.4" + } +} diff --git a/game-servers/snippets/quickstart.js b/game-servers/snippets/quickstart.js new file mode 100644 index 0000000000..4b8eca19b8 --- /dev/null +++ b/game-servers/snippets/quickstart.js @@ -0,0 +1,29 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** +* DESCRIBE WHAT THIS SAMPLE DOES. +* @param {string} LIST EXPECTED ARGUMENTS. +*/ +async function main() { +// [START LIBRARY_NAME_quickstart] + +// [END LIBRARY_NAME_quickstart] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/test/quickstart.js b/game-servers/snippets/test/quickstart.js new file mode 100644 index 0000000000..5a021415dc --- /dev/null +++ b/game-servers/snippets/test/quickstart.js @@ -0,0 +1,34 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +"use strict"; + +const path = require("path"); +const { assert } = require("chai"); +const cp = require("child_process"); +const { describe, it } = require("mocha"); + +const execSync = cmd => cp.execSync(cmd, { encoding: "utf-8" }); + +const cwd = path.join(__dirname, ".."); + +describe("Quickstart", () => { + it("should run quickstart", async () => { + const stdout = execSync(`node ./samples/quickstart.js`, { cwd }); + }); +}); From af278cdb4b3e44b42a2e86577394a27cad9e79ab Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Tue, 11 Feb 2020 14:21:43 -0800 Subject: [PATCH 02/51] feat: updates package.json files and quickstart --- game-servers/snippets/package.json | 2 +- game-servers/snippets/test/quickstart.js | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 1202f25b5d..7e445c2d4a 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^1.0.1" + "@google-cloud/game-servers": "^0.1.0" }, "devDependencies": { "c8": "^5.0.1", diff --git a/game-servers/snippets/test/quickstart.js b/game-servers/snippets/test/quickstart.js index 5a021415dc..e8365800a0 100644 --- a/game-servers/snippets/test/quickstart.js +++ b/game-servers/snippets/test/quickstart.js @@ -16,19 +16,19 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -"use strict"; +'use strict'; -const path = require("path"); -const { assert } = require("chai"); -const cp = require("child_process"); -const { describe, it } = require("mocha"); +const path = require('path'); +const {assert} = require('chai'); +const cp = require('child_process'); +const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, { encoding: "utf-8" }); +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); -const cwd = path.join(__dirname, ".."); +const cwd = path.join(__dirname, '..'); -describe("Quickstart", () => { - it("should run quickstart", async () => { - const stdout = execSync(`node ./samples/quickstart.js`, { cwd }); +describe('Quickstart', () => { + it('should run quickstart', async () => { + const stdout = execSync(`node quickstart.js`, {cwd}); }); }); From 8caa8927fe2832f49b464c242b52c7a7c95d4f32 Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Fri, 21 Feb 2020 14:50:55 -0800 Subject: [PATCH 03/51] Adds quickstart --- game-servers/snippets/quickstart.js | 36 ++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/game-servers/snippets/quickstart.js b/game-servers/snippets/quickstart.js index 4b8eca19b8..197b63d827 100644 --- a/game-servers/snippets/quickstart.js +++ b/game-servers/snippets/quickstart.js @@ -14,13 +14,37 @@ 'use strict'; /** -* DESCRIBE WHAT THIS SAMPLE DOES. -* @param {string} LIST EXPECTED ARGUMENTS. -*/ -async function main() { -// [START LIBRARY_NAME_quickstart] + * Create a Game Servers realm. + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + */ +async function main(projectId, location) { + // [START game_servers_quickstart] + const {RealmsServiceClient} = require('@google-cloud/game-servers'); -// [END LIBRARY_NAME_quickstart] + const client = new RealmsServiceClient(); + + const request = { + parent: `projects/${projectId}/locations/${location}`, + realmId: 'my-realm', + realm: { + // Must use a valid support time zone. + // See https://cloud.google.com/dataprep/docs/html/Supported-Time-Zone-Values_66194188 + timeZone: 'US/Pacific', + description: 'My Game Server realm', + }, + }; + + const [operation] = await client.createRealm(request); + const results = await operation.promise(); + const [realm] = results; + + console.log('Realm created:'); + + console.log(`\tRealm name: ${realm.name}`); + console.log(`\tRealm description: ${realm.description}`); + console.log(`\tRealm time zone: ${realm.timeZone}`); + // [END game_servers_quickstart] } main(...process.argv.slice(2)).catch(err => { From 5ca79e0d4d5ef9721180bbeace198c279ade33c4 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sun, 1 Mar 2020 10:11:21 -0800 Subject: [PATCH 04/51] build: get the build passing (#17) --- game-servers/snippets/package.json | 3 +- game-servers/snippets/quickstart.js | 51 +++++++++++++++--------- game-servers/snippets/test/quickstart.js | 28 ++++++++++--- 3 files changed, 57 insertions(+), 25 deletions(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 7e445c2d4a..c844a88d0c 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -18,6 +18,7 @@ "devDependencies": { "c8": "^5.0.1", "chai": "^4.2.0", - "mocha": "^6.1.4" + "mocha": "^6.1.4", + "uuid": "^7.0.1" } } diff --git a/game-servers/snippets/quickstart.js b/game-servers/snippets/quickstart.js index 197b63d827..a6dc596f2b 100644 --- a/game-servers/snippets/quickstart.js +++ b/game-servers/snippets/quickstart.js @@ -13,37 +13,50 @@ 'use strict'; +// sample-metadata: +// title: Create Game Server Realm +// description: Creates a new Realm within Cloud Game Servers +// usage: node quickstart.js + /** * Create a Game Servers realm. * @param {string} projectId string project identifier. * @param {string} location Compute Engine region. */ -async function main(projectId, location) { +async function main(projectId, location, realmId) { // [START game_servers_quickstart] const {RealmsServiceClient} = require('@google-cloud/game-servers'); - const client = new RealmsServiceClient(); + async function quickstart() { + const client = new RealmsServiceClient(); + + // TODO(developer): uncomment the following section, and add values + // const projectId = 'YOUR_PROJECT_ID'; + // const location = 'us-central1; + // const realIm = 'DESIRED_REALM_ID'; - const request = { - parent: `projects/${projectId}/locations/${location}`, - realmId: 'my-realm', - realm: { - // Must use a valid support time zone. - // See https://cloud.google.com/dataprep/docs/html/Supported-Time-Zone-Values_66194188 - timeZone: 'US/Pacific', - description: 'My Game Server realm', - }, - }; + const request = { + parent: `projects/${projectId}/locations/${location}`, + realmId, + realm: { + // Must use a valid support time zone. + // See https://cloud.google.com/dataprep/docs/html/Supported-Time-Zone-Values_66194188 + timeZone: 'US/Pacific', + description: 'My Game Server realm', + }, + }; - const [operation] = await client.createRealm(request); - const results = await operation.promise(); - const [realm] = results; + const [operation] = await client.createRealm(request); + const results = await operation.promise(); + const [realm] = results; - console.log('Realm created:'); + console.log('Realm created:'); - console.log(`\tRealm name: ${realm.name}`); - console.log(`\tRealm description: ${realm.description}`); - console.log(`\tRealm time zone: ${realm.timeZone}`); + console.log(`\tRealm name: ${realm.name}`); + console.log(`\tRealm description: ${realm.description}`); + console.log(`\tRealm time zone: ${realm.timeZone}`); + } + quickstart(); // [END game_servers_quickstart] } diff --git a/game-servers/snippets/test/quickstart.js b/game-servers/snippets/test/quickstart.js index e8365800a0..1c04c5ac07 100644 --- a/game-servers/snippets/test/quickstart.js +++ b/game-servers/snippets/test/quickstart.js @@ -18,17 +18,35 @@ 'use strict'; -const path = require('path'); const {assert} = require('chai'); const cp = require('child_process'); -const {describe, it} = require('mocha'); +const {describe, it, after, before} = require('mocha'); +const uuid = require('uuid'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); -const cwd = path.join(__dirname, '..'); - describe('Quickstart', () => { + let projectId; + let client; + const location = 'us-central1'; + const realmId = `realm-${uuid.v4().split('-')[0]}`; + + before(async () => { + client = new RealmsServiceClient(); + projectId = await client.getProjectId(); + }); + it('should run quickstart', async () => { - const stdout = execSync(`node quickstart.js`, {cwd}); + const stdout = execSync( + `node quickstart.js ${projectId} ${location} ${realmId}` + ); + assert.include(stdout, 'Realm created:'); + }); + + after(async () => { + await client.deleteRealm({ + name: client.realmPath(projectId, location, realmId), + }); }); }); From 19e1a8ce83aec6b62942407913bc9450850f5e27 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Sun, 1 Mar 2020 10:25:06 -0800 Subject: [PATCH 05/51] build: get sample and system tests passing (#18) --- game-servers/snippets/test/quickstart.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/game-servers/snippets/test/quickstart.js b/game-servers/snippets/test/quickstart.js index 1c04c5ac07..e9faf4f075 100644 --- a/game-servers/snippets/test/quickstart.js +++ b/game-servers/snippets/test/quickstart.js @@ -45,8 +45,9 @@ describe('Quickstart', () => { }); after(async () => { - await client.deleteRealm({ + const [operation] = await client.deleteRealm({ name: client.realmPath(projectId, location, realmId), }); + await operation.promise(); }); }); From bcb3db63432b7f87252571fa1798ae97edb4c09c Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sun, 1 Mar 2020 19:32:03 +0100 Subject: [PATCH 06/51] chore(deps): update dependency @types/mocha (#1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/mocha](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | devDependencies | major | [`^5.2.5` -> `^7.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/5.2.7/7.0.1) | | [mocha](https://mochajs.org/) ([source](https://togithub.com/mochajs/mocha)) | devDependencies | major | [`^6.1.4` -> `^7.0.0`](https://renovatebot.com/diffs/npm/mocha/6.2.2/7.1.0) | --- ### Release Notes
mochajs/mocha ### [`v7.1.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​710--2020-02-26) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.0.1...v7.1.0) #### :tada: Enhancements [#​4038](https://togithub.com/mochajs/mocha/issues/4038): Add Node.js native ESM support ([**@​giltayar**](https://togithub.com/giltayar)) Mocha supports writing your test files as ES modules: - Node.js only v12.11.0 and above - Node.js below v13.2.0, you must set `--experimental-modules` option - current limitations: please check our [documentation](https://mochajs.org/#nodejs-native-esm-support) - for programmatic usage: see [API: loadFilesAsync()](https://mochajs.org/api/mocha#loadFilesAsync) **Note:** Node.JS native [ECMAScript Modules](https://nodejs.org/api/esm.html) implementation has status: **Stability: 1 - Experimental** #### :bug: Fixes - [#​4181](https://togithub.com/mochajs/mocha/issues/4181): Programmatic API cannot access retried test objects ([**@​juergba**](https://togithub.com/juergba)) - [#​4174](https://togithub.com/mochajs/mocha/issues/4174): Browser: fix `allowUncaught` option ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4058](https://togithub.com/mochajs/mocha/issues/4058): Manage author list in AUTHORS instead of `package.json` ([**@​outsideris**](https://togithub.com/outsideris)) #### :nut_and_bolt: Other - [#​4138](https://togithub.com/mochajs/mocha/issues/4138): Upgrade ESLint v6.8 ([**@​kaicataldo**](https://togithub.com/kaicataldo)) ### [`v7.0.1`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​701--2020-01-25) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.0.0...v7.0.1) #### :bug: Fixes - [#​4165](https://togithub.com/mochajs/mocha/issues/4165): Fix exception when skipping tests programmatically ([**@​juergba**](https://togithub.com/juergba)) - [#​4153](https://togithub.com/mochajs/mocha/issues/4153): Restore backwards compatibility for `reporterOptions` ([**@​holm**](https://togithub.com/holm)) - [#​4150](https://togithub.com/mochajs/mocha/issues/4150): Fix recovery of an open test upon uncaught exception ([**@​juergba**](https://togithub.com/juergba)) - [#​4147](https://togithub.com/mochajs/mocha/issues/4147): Fix regression of leaking uncaught exception handler ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4146](https://togithub.com/mochajs/mocha/issues/4146): Update copyright & trademark notices per OJSF ([**@​boneskull**](https://togithub.com/boneskull)) - [#​4140](https://togithub.com/mochajs/mocha/issues/4140): Fix broken links ([**@​KyoungWan**](https://togithub.com/KyoungWan)) #### :nut_and_bolt: Other - [#​4133](https://togithub.com/mochajs/mocha/issues/4133): Print more descriptive error message ([**@​Zirak**](https://togithub.com/Zirak)) ### [`v7.0.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​700--2020-01-05) [Compare Source](https://togithub.com/mochajs/mocha/compare/v6.2.2...v7.0.0) #### :boom: Breaking Changes - [#​3885](https://togithub.com/mochajs/mocha/issues/3885): **Drop Node.js v6.x support** ([**@​mojosoeun**](https://togithub.com/mojosoeun)) - [#​3890](https://togithub.com/mochajs/mocha/issues/3890): Remove Node.js debug-related flags `--debug`/`--debug-brk` and deprecate `debug` argument ([**@​juergba**](https://togithub.com/juergba)) - [#​3962](https://togithub.com/mochajs/mocha/issues/3962): Changes to command-line options ([**@​ParkSB**](https://togithub.com/ParkSB)): - `--list-interfaces` replaces `--interfaces` - `--list-reporters` replaces `--reporters` - Hook pattern of `this.skip()` ([**@​juergba**](https://togithub.com/juergba)): - [#​3859](https://togithub.com/mochajs/mocha/issues/3859): When conditionally skipping in a `it` test, related `afterEach` hooks are now executed - [#​3741](https://togithub.com/mochajs/mocha/issues/3741): When conditionally skipping in a `beforeEach` hook, subsequent inner `beforeEach` hooks are now skipped and related `afterEach` hooks are executed - [#​4136](https://togithub.com/mochajs/mocha/issues/4136): Disallow `this.skip()` within `after` hooks - [#​3967](https://togithub.com/mochajs/mocha/issues/3967): Remove deprecated `getOptions()` and `lib/cli/options.js` ([**@​juergba**](https://togithub.com/juergba)) - [#​4083](https://togithub.com/mochajs/mocha/issues/4083): Uncaught exception in `pending` test: don't swallow, but retrospectively fail the test for correct exit code ([**@​juergba**](https://togithub.com/juergba)) - [#​4004](https://togithub.com/mochajs/mocha/issues/4004): Align `Mocha` constructor's option names with command-line options ([**@​juergba**](https://togithub.com/juergba)) #### :tada: Enhancements - [#​3980](https://togithub.com/mochajs/mocha/issues/3980): Refactor and improve `--watch` mode with chokidar ([**@​geigerzaehler**](https://togithub.com/geigerzaehler)): - adds command-line options `--watch-files` and `--watch-ignore` - removes `--watch-extensions` - [#​3979](https://togithub.com/mochajs/mocha/issues/3979): Type "rs\\n" to restart tests ([**@​broofa**](https://togithub.com/broofa)) #### :fax: Deprecations These are _soft_-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha: - [#​3968](https://togithub.com/mochajs/mocha/issues/3968): Deprecate legacy configuration via `mocha.opts` ([**@​juergba**](https://togithub.com/juergba)) #### :bug: Fixes - [#​4125](https://togithub.com/mochajs/mocha/issues/4125): Fix timeout handling with `--inspect-brk`/`--inspect` ([**@​juergba**](https://togithub.com/juergba)) - [#​4070](https://togithub.com/mochajs/mocha/issues/4070): `Mocha` constructor: improve browser setup ([**@​juergba**](https://togithub.com/juergba)) - [#​4068](https://togithub.com/mochajs/mocha/issues/4068): XUnit reporter should handle exceptions during diff generation ([**@​rgroothuijsen**](https://togithub.com/rgroothuijsen)) - [#​4030](https://togithub.com/mochajs/mocha/issues/4030): Fix `--allow-uncaught` with `this.skip()` ([**@​juergba**](https://togithub.com/juergba)) #### :mag: Coverage - [#​4109](https://togithub.com/mochajs/mocha/issues/4109): Add Node.js v13.x to CI test matrix ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4129](https://togithub.com/mochajs/mocha/issues/4129): Fix broken links ([**@​SaeromB**](https://togithub.com/SaeromB)) - [#​4127](https://togithub.com/mochajs/mocha/issues/4127): Add reporter alias names to docs ([**@​khg0712**](https://togithub.com/khg0712)) - [#​4101](https://togithub.com/mochajs/mocha/issues/4101): Clarify invalid usage of `done()` ([**@​jgehrcke**](https://togithub.com/jgehrcke)) - [#​4092](https://togithub.com/mochajs/mocha/issues/4092): Replace `:coffee:` with emoji ☕️ ([**@​pzrq**](https://togithub.com/pzrq)) - [#​4088](https://togithub.com/mochajs/mocha/issues/4088): Initial draft of project charter ([**@​boneskull**](https://togithub.com/boneskull)) - [#​4066](https://togithub.com/mochajs/mocha/issues/4066): Change `sh` to `bash` for code block in docs/index.md ([**@​HyunSangHan**](https://togithub.com/HyunSangHan)) - [#​4045](https://togithub.com/mochajs/mocha/issues/4045): Update README.md concerning GraphicsMagick installation ([**@​HyunSangHan**](https://togithub.com/HyunSangHan)) - [#​3988](https://togithub.com/mochajs/mocha/issues/3988): Fix sponsors background color for readability ([**@​outsideris**](https://togithub.com/outsideris)) #### :nut_and_bolt: Other - [#​4118](https://togithub.com/mochajs/mocha/issues/4118): Update node-environment-flags to 1.0.6 ([**@​kylef**](https://togithub.com/kylef)) - [#​4097](https://togithub.com/mochajs/mocha/issues/4097): Add GH Funding Metadata ([**@​SheetJSDev**](https://togithub.com/SheetJSDev)) - [#​4089](https://togithub.com/mochajs/mocha/issues/4089): Add funding information to `package.json` ([**@​Munter**](https://togithub.com/Munter)) - [#​4077](https://togithub.com/mochajs/mocha/issues/4077): Improve integration tests ([**@​soobing**](https://togithub.com/soobing))
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :ghost: **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/config-help/issues) if that's undesired. --- - [ ] 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-game-servers). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index c844a88d0c..d1d2cdd902 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -18,7 +18,7 @@ "devDependencies": { "c8": "^5.0.1", "chai": "^4.2.0", - "mocha": "^6.1.4", + "mocha": "^7.0.0", "uuid": "^7.0.1" } } From 0e2442daa8bc8a90190b40f2629fa5e7d5ffc562 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sun, 1 Mar 2020 19:38:03 +0100 Subject: [PATCH 07/51] chore(deps): update dependency c8 to v7 (#2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [c8](https://togithub.com/bcoe/c8) | devDependencies | major | [`^5.0.1` -> `^7.0.0`](https://renovatebot.com/diffs/npm/c8/5.0.4/7.1.0) | | [c8](https://togithub.com/bcoe/c8) | devDependencies | major | [`^6.0.0` -> `^7.0.0`](https://renovatebot.com/diffs/npm/c8/6.0.1/7.1.0) | --- ### Release Notes
bcoe/c8 ### [`v7.1.0`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​710httpswwwgithubcombcoec8comparev701v710-2020-02-09) [Compare Source](https://togithub.com/bcoe/c8/compare/v7.0.1...v7.1.0) ##### Features - adds TypeScript definitions ([d39801b](https://www.github.com/bcoe/c8/commit/d39801bc9b2713aa56592010e6394a295bd12b0b)), closes [#​195](https://www.github.com/bcoe/c8/issues/195) ##### Bug Fixes - **deps:** update dependency furi to v2 ([#​193](https://www.github.com/bcoe/c8/issues/193)) ([6b9af6e](https://www.github.com/bcoe/c8/commit/6b9af6ee8cbbacd85eea91dc49bb269fe3651c12)) - **deps:** v8-to-istanbul with patch for crasher ([#​200](https://www.github.com/bcoe/c8/issues/200)) ([d4b7d80](https://www.github.com/bcoe/c8/commit/d4b7d80d78f3d1cb2e9a2e9e106af0cef327b446)) ##### [7.0.1](https://www.github.com/bcoe/c8/compare/v7.0.0...v7.0.1) (2020-01-13) ##### Bug Fixes - all flag not propagated to check-coverage command ([#​188](https://www.github.com/bcoe/c8/issues/188)) ([86eaf72](https://www.github.com/bcoe/c8/commit/86eaf72a8c7af93d6ec9699b741d11df50017a8d)) ### [`v7.0.1`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​710httpswwwgithubcombcoec8comparev701v710-2020-02-09) [Compare Source](https://togithub.com/bcoe/c8/compare/v7.0.0...v7.0.1) ##### Features - adds TypeScript definitions ([d39801b](https://www.github.com/bcoe/c8/commit/d39801bc9b2713aa56592010e6394a295bd12b0b)), closes [#​195](https://www.github.com/bcoe/c8/issues/195) ##### Bug Fixes - **deps:** update dependency furi to v2 ([#​193](https://www.github.com/bcoe/c8/issues/193)) ([6b9af6e](https://www.github.com/bcoe/c8/commit/6b9af6ee8cbbacd85eea91dc49bb269fe3651c12)) - **deps:** v8-to-istanbul with patch for crasher ([#​200](https://www.github.com/bcoe/c8/issues/200)) ([d4b7d80](https://www.github.com/bcoe/c8/commit/d4b7d80d78f3d1cb2e9a2e9e106af0cef327b446)) ##### [7.0.1](https://www.github.com/bcoe/c8/compare/v7.0.0...v7.0.1) (2020-01-13) ##### Bug Fixes - all flag not propagated to check-coverage command ([#​188](https://www.github.com/bcoe/c8/issues/188)) ([86eaf72](https://www.github.com/bcoe/c8/commit/86eaf72a8c7af93d6ec9699b741d11df50017a8d)) ### [`v7.0.0`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​700httpswwwgithubcombcoec8comparev601v700-2019-12-22) [Compare Source](https://togithub.com/bcoe/c8/compare/v6.0.1...v7.0.0) ##### ⚠ BREAKING CHANGES - new test-exclude with modified exclude rules ([#​179](https://togithub.com/bcoe/c8/issues/179)) - **istanbul-reports:** lcov reports now use relative paths ([#​168](https://togithub.com/bcoe/c8/issues/168)) ##### Features - adds --all functionality ([#​158](https://www.github.com/bcoe/c8/issues/158)) ([2eb631e](https://www.github.com/bcoe/c8/commit/2eb631e460eba3d06925ee1d128e0db82ec50b6c)) - **istanbul-reports:** lcov reports now use relative paths ([#​168](https://www.github.com/bcoe/c8/issues/168)) ([35d9338](https://www.github.com/bcoe/c8/commit/35d9338b69ba803c19a19d16ff601e3ec5692fa6)) - new test-exclude with modified exclude rules ([#​179](https://www.github.com/bcoe/c8/issues/179)) ([af7d94d](https://www.github.com/bcoe/c8/commit/af7d94d715ab98d67e6b5bff5dfba19430681c9c)) ##### Bug Fixes - **deps:** update dependency v8-to-istanbul to v4 ([#​167](https://www.github.com/bcoe/c8/issues/167)) ([97b9769](https://www.github.com/bcoe/c8/commit/97b97699870ddc4af780cedb25cbb3a87e0eb777)) - **deps:** update dependency yargs to v15 ([#​164](https://www.github.com/bcoe/c8/issues/164)) ([e41a483](https://www.github.com/bcoe/c8/commit/e41a4831aac92591f303d48038a327e9631affee)) - **deps:** update dependency yargs-parser to v16 ([#​157](https://www.github.com/bcoe/c8/issues/157)) ([15746e5](https://www.github.com/bcoe/c8/commit/15746e51640e6e172f27f02c12056e2977342005)) ##### [6.0.1](https://togithub.com/bcoe/c8/compare/v6.0.0...v6.0.1) (2019-10-26) ##### Bug Fixes - regex flags in dependency were breaking Node 8 ([a9d9645](https://togithub.com/bcoe/c8/commit/a9d9645858031cee985087828f5e04cfd8922868)) ### [`v6.0.1`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​700httpswwwgithubcombcoec8comparev601v700-2019-12-22) [Compare Source](https://togithub.com/bcoe/c8/compare/v6.0.0...v6.0.1) ##### ⚠ BREAKING CHANGES - new test-exclude with modified exclude rules ([#​179](https://togithub.com/bcoe/c8/issues/179)) - **istanbul-reports:** lcov reports now use relative paths ([#​168](https://togithub.com/bcoe/c8/issues/168)) ##### Features - adds --all functionality ([#​158](https://www.github.com/bcoe/c8/issues/158)) ([2eb631e](https://www.github.com/bcoe/c8/commit/2eb631e460eba3d06925ee1d128e0db82ec50b6c)) - **istanbul-reports:** lcov reports now use relative paths ([#​168](https://www.github.com/bcoe/c8/issues/168)) ([35d9338](https://www.github.com/bcoe/c8/commit/35d9338b69ba803c19a19d16ff601e3ec5692fa6)) - new test-exclude with modified exclude rules ([#​179](https://www.github.com/bcoe/c8/issues/179)) ([af7d94d](https://www.github.com/bcoe/c8/commit/af7d94d715ab98d67e6b5bff5dfba19430681c9c)) ##### Bug Fixes - **deps:** update dependency v8-to-istanbul to v4 ([#​167](https://www.github.com/bcoe/c8/issues/167)) ([97b9769](https://www.github.com/bcoe/c8/commit/97b97699870ddc4af780cedb25cbb3a87e0eb777)) - **deps:** update dependency yargs to v15 ([#​164](https://www.github.com/bcoe/c8/issues/164)) ([e41a483](https://www.github.com/bcoe/c8/commit/e41a4831aac92591f303d48038a327e9631affee)) - **deps:** update dependency yargs-parser to v16 ([#​157](https://www.github.com/bcoe/c8/issues/157)) ([15746e5](https://www.github.com/bcoe/c8/commit/15746e51640e6e172f27f02c12056e2977342005)) ##### [6.0.1](https://togithub.com/bcoe/c8/compare/v6.0.0...v6.0.1) (2019-10-26) ##### Bug Fixes - regex flags in dependency were breaking Node 8 ([a9d9645](https://togithub.com/bcoe/c8/commit/a9d9645858031cee985087828f5e04cfd8922868)) ### [`v6.0.0`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​600httpsgithubcombcoec8comparev504v600-2019-10-24) [Compare Source](https://togithub.com/bcoe/c8/compare/v5.0.4...v6.0.0) ##### ⚠ BREAKING CHANGES - Node.js' source-map and lineLength cache is now used to remap coverage output (this allows tools like ts-node to be supported, which transpile at runtime). ##### Features - use Node.js' source-map cache, to support tools like ts-node ([#​152](https://togithub.com/bcoe/c8/issues/152)) ([53bba15](https://togithub.com/bcoe/c8/commit/53bba15bee07e8f0446fd85cc59d2b562fe34a21)) ##### Bug Fixes - **deps:** update dependency yargs-parser to v15 ([#​153](https://togithub.com/bcoe/c8/issues/153)) ([80153de](https://togithub.com/bcoe/c8/commit/80153de61be8e5830f1c228945184e4878f8cf0c)) ##### [5.0.4](https://togithub.com/bcoe/c8/compare/v5.0.3...v5.0.4) (2019-09-06) ##### Bug Fixes - **deps:** merging failed when the same script occurred multiple times in the same report ([#​147](https://togithub.com/bcoe/c8/issues/147)) ([1ebcaf9](https://togithub.com/bcoe/c8/commit/1ebcaf9)) - don't load JSON that does not look like coverage ([#​146](https://togithub.com/bcoe/c8/issues/146)) ([a6481f1](https://togithub.com/bcoe/c8/commit/a6481f1)) - **deps:** update dependency yargs-parser to v14 ([#​144](https://togithub.com/bcoe/c8/issues/144)) ([9b3d089](https://togithub.com/bcoe/c8/commit/9b3d089)) ##### [5.0.3](https://www.github.com/bcoe/c8/compare/v5.0.2...v5.0.3) (2019-09-06) ##### Bug Fixes - **deps:** update dependency rimraf to v3 ([#​132](https://www.github.com/bcoe/c8/issues/132)) ([7601748](https://www.github.com/bcoe/c8/commit/7601748)) - **deps:** update dependency yargs to v14 ([#​134](https://www.github.com/bcoe/c8/issues/134)) ([e49737f](https://www.github.com/bcoe/c8/commit/e49737f)) - **deps:** update deps to address warning in cross-spawn ([#​141](https://www.github.com/bcoe/c8/issues/141)) ([4b66221](https://www.github.com/bcoe/c8/commit/4b66221)) ##### [5.0.2](https://www.github.com/bcoe/c8/compare/v5.0.1...v5.0.2) (2019-06-24) ##### Bug Fixes - HTML report now has correct source positions for Node >10.16.0 ([#​125](https://www.github.com/bcoe/c8/issues/125)) ([c49fa7f](https://www.github.com/bcoe/c8/commit/c49fa7f)) - **deps:** update dependency find-up to v4 ([#​119](https://www.github.com/bcoe/c8/issues/119)) ([c568d96](https://www.github.com/bcoe/c8/commit/c568d96)) - **deps:** update dependency yargs-parser to v13 ([#​124](https://www.github.com/bcoe/c8/issues/124)) ([1eb3394](https://www.github.com/bcoe/c8/commit/1eb3394)) - do not override NODE_V8_COVERAGE if set ([#​70](https://www.github.com/bcoe/c8/issues/70)) ([8bb67b0](https://www.github.com/bcoe/c8/commit/8bb67b0)) ##### [5.0.1](https://www.github.com/bcoe/c8/compare/v5.0.0...v5.0.1) (2019-05-20) ##### Bug Fixes - temporary files should be in tmp folder ([#​106](https://www.github.com/bcoe/c8/issues/106)) ([64dd2e6](https://www.github.com/bcoe/c8/commit/64dd2e6))
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] 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-game-servers). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index d1d2cdd902..91be2ba1fd 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -16,7 +16,7 @@ "@google-cloud/game-servers": "^0.1.0" }, "devDependencies": { - "c8": "^5.0.1", + "c8": "^7.0.0", "chai": "^4.2.0", "mocha": "^7.0.0", "uuid": "^7.0.1" From 20bb010e8726488a9faf8b33e73700b43bd714b1 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 08:34:51 -0800 Subject: [PATCH 08/51] chore: release 1.0.0 (#4) * created CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] Co-authored-by: Justin Beckwith --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 91be2ba1fd..8d05ef4a00 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^0.1.0" + "@google-cloud/game-servers": "^1.0.0" }, "devDependencies": { "c8": "^7.0.0", From f0f2cd18bb564b5039e2d4e947cbcdfd2070fc0f Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Mon, 2 Mar 2020 16:42:59 -0800 Subject: [PATCH 09/51] feat: adds CRUD samples for GS realms (#21) * Adds Game Servers realm samples * feat: adds realm CRUD tests * feat: adds quickstart test * fix: updates region tags --- game-servers/snippets/create_realm.js | 65 +++++++++++++++++++ game-servers/snippets/delete_realm.js | 55 ++++++++++++++++ game-servers/snippets/get_realm.js | 54 +++++++++++++++ game-servers/snippets/list_realms.js | 49 ++++++++++++++ game-servers/snippets/quickstart.js | 7 +- .../snippets/test/create_realm.test.js | 50 ++++++++++++++ .../snippets/test/delete_realm.test.js | 54 +++++++++++++++ game-servers/snippets/test/get_realm.test.js | 63 ++++++++++++++++++ .../snippets/test/list_realms.test.js | 63 ++++++++++++++++++ game-servers/snippets/test/quickstart.test.js | 50 ++++++++++++++ 10 files changed, 507 insertions(+), 3 deletions(-) create mode 100644 game-servers/snippets/create_realm.js create mode 100644 game-servers/snippets/delete_realm.js create mode 100644 game-servers/snippets/get_realm.js create mode 100644 game-servers/snippets/list_realms.js create mode 100644 game-servers/snippets/test/create_realm.test.js create mode 100644 game-servers/snippets/test/delete_realm.test.js create mode 100644 game-servers/snippets/test/get_realm.test.js create mode 100644 game-servers/snippets/test/list_realms.test.js create mode 100644 game-servers/snippets/test/quickstart.test.js diff --git a/game-servers/snippets/create_realm.js b/game-servers/snippets/create_realm.js new file mode 100644 index 0000000000..8ce712035f --- /dev/null +++ b/game-servers/snippets/create_realm.js @@ -0,0 +1,65 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Create a Game Servers realm. + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + * @param {string} realmId a unique identifier for the new realm + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_create_realm] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'A unique identifier for the realm'; + const {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function createRealm() { + const request = { + parent: `projects/${projectId}/locations/${location}`, + realmId: realmId, + realm: { + // Must use a supported time zone name. + // See https://cloud.google.com/dataprep/docs/html/Supported-Time-Zone-Values_66194188 + timeZone: 'US/Pacific', + description: 'My Game Server realm', + }, + }; + + const [operation] = await client.createRealm(request); + const results = await operation.promise(); + const [realm] = results; + + console.log('Realm created:'); + + console.log(`\tRealm name: ${realm.name}`); + console.log(`\tRealm description: ${realm.description}`); + console.log(`\tRealm time zone: ${realm.timeZone}`); + // [END cloud_game_servers_create_realm] + } + + createRealm(); +} + +main(...process.argv.slice(2)); diff --git a/game-servers/snippets/delete_realm.js b/game-servers/snippets/delete_realm.js new file mode 100644 index 0000000000..f5224437c3 --- /dev/null +++ b/game-servers/snippets/delete_realm.js @@ -0,0 +1,55 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Delete a realm by ID + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + * @param {string} realmId the unique ID of the realm + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_delete_realm] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'Unique identifier of the realm'; + const {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function deleteRealm() { + const request = { + // Realm name is the full resource name including project ID,location, + // and the realm ID. + name: `projects/${projectId}/locations/${location}/realms/${realmId}`, + }; + + const [operation] = await client.deleteRealm(request); + await operation.promise(); + console.log(`Realm with ID ${realmId} deleted.`); + + // [END cloud_game_servers_delete_realm] + } + + deleteRealm(); +} + +main(...process.argv.slice(2)); diff --git a/game-servers/snippets/get_realm.js b/game-servers/snippets/get_realm.js new file mode 100644 index 0000000000..f2379ad5ae --- /dev/null +++ b/game-servers/snippets/get_realm.js @@ -0,0 +1,54 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Get a realm by ID + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + * @param {string} realmId the unique ID of the realm + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_get_realm] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'Unique identifier of the realm'; + const {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function getRealm() { + const request = { + // Realm name is the full resource name including project ID and location + name: `projects/${projectId}/locations/${location}/realms/${realmId}`, + }; + + const [realm] = await client.getRealm(request); + console.log(`Realm name: ${realm.name}`); + console.log(`Realm description: ${realm.description}`); + console.log(`Realm time zone: ${realm.timeZone}`); + // [END cloud_game_servers_get_realm] + } + + getRealm(); +} + +main(...process.argv.slice(2)); diff --git a/game-servers/snippets/list_realms.js b/game-servers/snippets/list_realms.js new file mode 100644 index 0000000000..d8a7f9c6d8 --- /dev/null +++ b/game-servers/snippets/list_realms.js @@ -0,0 +1,49 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * List all of the realms in a project. + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + */ +function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { + // [START cloud_game_servers_list_realms] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + const {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function listRealms() { + const request = { + parent: `projects/${projectId}/locations/${location}`, + }; + + const [results] = await client.listRealms(request); + for (const realm of results.realms) { + console.log(`Realm name: ${realm.name}`); + console.log(`Realm description: ${realm.description}`); + console.log(`Realm time zone: ${realm.timeZone}\n`); + } + // [END cloud_game_servers_list_realms] + } + + listRealms(); +} + +main(...process.argv.slice(2)); diff --git a/game-servers/snippets/quickstart.js b/game-servers/snippets/quickstart.js index a6dc596f2b..3a9c542322 100644 --- a/game-servers/snippets/quickstart.js +++ b/game-servers/snippets/quickstart.js @@ -22,9 +22,10 @@ * Create a Game Servers realm. * @param {string} projectId string project identifier. * @param {string} location Compute Engine region. + * @param {string} realmId unique identifier for the realm. */ async function main(projectId, location, realmId) { - // [START game_servers_quickstart] + // [START cloud_game_servers_quickstart] const {RealmsServiceClient} = require('@google-cloud/game-servers'); async function quickstart() { @@ -33,7 +34,7 @@ async function main(projectId, location, realmId) { // TODO(developer): uncomment the following section, and add values // const projectId = 'YOUR_PROJECT_ID'; // const location = 'us-central1; - // const realIm = 'DESIRED_REALM_ID'; + // const realmId = 'DESIRED_REALM_ID'; const request = { parent: `projects/${projectId}/locations/${location}`, @@ -57,7 +58,7 @@ async function main(projectId, location, realmId) { console.log(`\tRealm time zone: ${realm.timeZone}`); } quickstart(); - // [END game_servers_quickstart] + // [END cloud_game_servers_quickstart] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/test/create_realm.test.js b/game-servers/snippets/test/create_realm.test.js new file mode 100644 index 0000000000..293298a2dc --- /dev/null +++ b/game-servers/snippets/test/create_realm.test.js @@ -0,0 +1,50 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const {describe, it, after} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers Create Realm Test', () => { + const client = new RealmsServiceClient(); + let realmId; + + it('should create a realm', async () => { + const projectId = await client.getProjectId(); + realmId = `test-${uuid.v4()}`; + + const create_output = execSync( + `node create_realm.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(create_output, /Realm time zone:/); + }); + + after(async () => { + const projectId = await client.getProjectId(); + const request = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation] = await client.deleteRealm(request); + await operation.promise(); + }); +}); diff --git a/game-servers/snippets/test/delete_realm.test.js b/game-servers/snippets/test/delete_realm.test.js new file mode 100644 index 0000000000..e88a1d3530 --- /dev/null +++ b/game-servers/snippets/test/delete_realm.test.js @@ -0,0 +1,54 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const {describe, it, before} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers Delete Realm Test', () => { + const client = new RealmsServiceClient(); + let realmId; + + before(async () => { + const projectId = await client.getProjectId(); + realmId = `test-${uuid.v4()}`; + + await client.createRealm({ + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Realm', + }, + }); + }); + + it('should delete a realm', async () => { + const projectId = await client.getProjectId(); + + const delete_output = execSync( + `node delete_realm.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(delete_output, /deleted./); + }); +}); diff --git a/game-servers/snippets/test/get_realm.test.js b/game-servers/snippets/test/get_realm.test.js new file mode 100644 index 0000000000..4eb9ebc9c8 --- /dev/null +++ b/game-servers/snippets/test/get_realm.test.js @@ -0,0 +1,63 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const {describe, it, before, after} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers Get Realms Test', () => { + const client = new RealmsServiceClient(); + let realmId; + + before(async () => { + const projectId = await client.getProjectId(); + realmId = `test-${uuid.v4()}`; + + await client.createRealm({ + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Realm', + }, + }); + }); + + it('should get a realm', async () => { + const projectId = await client.getProjectId(); + + const get_output = execSync( + `node get_realm.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(get_output, /Realm description:/); + }); + + after(async () => { + const projectId = await client.getProjectId(); + const request = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation] = await client.deleteRealm(request); + await operation.promise(); + }); +}); diff --git a/game-servers/snippets/test/list_realms.test.js b/game-servers/snippets/test/list_realms.test.js new file mode 100644 index 0000000000..35c78613bd --- /dev/null +++ b/game-servers/snippets/test/list_realms.test.js @@ -0,0 +1,63 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const {describe, it, before, after} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers List Realms Test', () => { + const client = new RealmsServiceClient(); + let realmId; + + before(async () => { + const projectId = await client.getProjectId(); + realmId = `test-${uuid.v4()}`; + + await client.createRealm({ + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Realm', + }, + }); + }); + + it('should list realms', async () => { + const projectId = await client.getProjectId(); + + const list_output = execSync( + `node list_realms.js ${projectId} ${LOCATION}` + ); + assert.match(list_output, /Realm name:/); + }); + + after(async () => { + const projectId = await client.getProjectId(); + const request = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation] = await client.deleteRealm(request); + await operation.promise(); + }); +}); diff --git a/game-servers/snippets/test/quickstart.test.js b/game-servers/snippets/test/quickstart.test.js new file mode 100644 index 0000000000..74b1644527 --- /dev/null +++ b/game-servers/snippets/test/quickstart.test.js @@ -0,0 +1,50 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const {describe, it, after} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers Quickstart Test', () => { + const client = new RealmsServiceClient(); + let realmId; + + it('should create a realm', async () => { + const projectId = await client.getProjectId(); + realmId = `test-${uuid.v4()}`; + + const quickstart_output = execSync( + `node quickstart.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(quickstart_output, /Realm time zone:/); + }); + + after(async () => { + const projectId = await client.getProjectId(); + const request = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation] = await client.deleteRealm(request); + await operation.promise(); + }); +}); From f707d56cbef1a216ba43849ebf088802e8b01372 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 16:55:19 -0800 Subject: [PATCH 10/51] chore: release 1.1.0 (#22) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 8d05ef4a00..b738ce91b0 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^1.0.0" + "@google-cloud/game-servers": "^1.1.0" }, "devDependencies": { "c8": "^7.0.0", From 437958d63f43b3dfe9a0b6b82c3b8ef04930652b Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Tue, 10 Mar 2020 10:13:20 -0700 Subject: [PATCH 11/51] test: adds cleanup function for tests (#28) * feat: adds cleanup function for tests --- game-servers/snippets/get_realm.js | 5 ++ game-servers/snippets/list_realms.js | 6 +- game-servers/snippets/test/clean.js | 73 +++++++++++++++++++ .../snippets/test/create_realm.test.js | 7 +- .../snippets/test/delete_realm.test.js | 5 ++ game-servers/snippets/test/get_realm.test.js | 5 ++ .../snippets/test/list_realms.test.js | 5 ++ game-servers/snippets/test/quickstart.test.js | 7 +- 8 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 game-servers/snippets/test/clean.js diff --git a/game-servers/snippets/get_realm.js b/game-servers/snippets/get_realm.js index f2379ad5ae..620deadc14 100644 --- a/game-servers/snippets/get_realm.js +++ b/game-servers/snippets/get_realm.js @@ -45,6 +45,11 @@ function main( console.log(`Realm name: ${realm.name}`); console.log(`Realm description: ${realm.description}`); console.log(`Realm time zone: ${realm.timeZone}`); + + const createTime = realm.createTime; + const createDate = new Date(createTime.seconds * 1000); + + console.log(`Realm created on: ${createDate.toLocaleDateString()}`); // [END cloud_game_servers_get_realm] } diff --git a/game-servers/snippets/list_realms.js b/game-servers/snippets/list_realms.js index d8a7f9c6d8..18039dfce3 100644 --- a/game-servers/snippets/list_realms.js +++ b/game-servers/snippets/list_realms.js @@ -38,7 +38,11 @@ function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { for (const realm of results.realms) { console.log(`Realm name: ${realm.name}`); console.log(`Realm description: ${realm.description}`); - console.log(`Realm time zone: ${realm.timeZone}\n`); + console.log(`Realm time zone: ${realm.timeZone}`); + + const createTime = realm.createTime; + const createDate = new Date(createTime.seconds * 1000); + console.log(`Realm created on: ${createDate.toLocaleDateString()}\n`); } // [END cloud_game_servers_list_realms] } diff --git a/game-servers/snippets/test/clean.js b/game-servers/snippets/test/clean.js new file mode 100644 index 0000000000..814852c614 --- /dev/null +++ b/game-servers/snippets/test/clean.js @@ -0,0 +1,73 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const {GameServerClustersServiceClient} = require('@google-cloud/game-servers'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const gameServerClusterClient = new GameServerClustersServiceClient(); +const realmsClient = new RealmsServiceClient(); + +/** + * Utility function for removing unneeded realms from project. + */ +module.exports = async () => { + const projectId = await realmsClient.getProjectId(); + const location = 'us-central1'; + + const request = { + parent: `projects/${projectId}/locations/${location}`, + }; + + const MAX_REALM_LIFESPAN = 3600000; // One hour (in milliseconds) + const NOW = new Date(); + + const [results] = await realmsClient.listRealms(request); + for (const realm of results.realms) { + // Check age of realm. If older than maximum life span, delete. + const ageOfRealm = new Date(realm.createTime.seconds * 1000); + if (NOW - ageOfRealm > MAX_REALM_LIFESPAN) { + // First, delete all clusters associated with this realm. + const clustersRequest = { + parent: realm.name, + }; + + const clustersResult = await gameServerClusterClient.listGameServerClusters( + clustersRequest + ); + const [clusters] = clustersResult; + for (const cluster of clusters.gameServerClusters) { + const deleteClusterRequest = { + name: cluster.name, + }; + + const [ + deleteClusterOperation, + ] = await gameServerClusterClient.deleteGameServerCluster( + deleteClusterRequest + ); + await deleteClusterOperation.promise(); + } + + // Then delete the realm itself. + const realmDeleteRequest = { + name: realm.name, + }; + + const [deleteRealmOperation] = await realmsClient.deleteRealm( + realmDeleteRequest + ); + await deleteRealmOperation.promise(); + } + } +}; diff --git a/game-servers/snippets/test/create_realm.test.js b/game-servers/snippets/test/create_realm.test.js index 293298a2dc..93a49344e7 100644 --- a/game-servers/snippets/test/create_realm.test.js +++ b/game-servers/snippets/test/create_realm.test.js @@ -15,7 +15,8 @@ 'use strict'; const {assert} = require('chai'); -const {describe, it, after} = require('mocha'); +const cleanup = require('./clean.js'); +const {describe, before, it, after} = require('mocha'); const {RealmsServiceClient} = require('@google-cloud/game-servers'); const cp = require('child_process'); @@ -29,6 +30,10 @@ describe('Game Servers Create Realm Test', () => { const client = new RealmsServiceClient(); let realmId; + before(async () => { + await cleanup(); + }); + it('should create a realm', async () => { const projectId = await client.getProjectId(); realmId = `test-${uuid.v4()}`; diff --git a/game-servers/snippets/test/delete_realm.test.js b/game-servers/snippets/test/delete_realm.test.js index e88a1d3530..915aa83b8e 100644 --- a/game-servers/snippets/test/delete_realm.test.js +++ b/game-servers/snippets/test/delete_realm.test.js @@ -15,6 +15,7 @@ 'use strict'; const {assert} = require('chai'); +const cleanup = require('./clean.js'); const {describe, it, before} = require('mocha'); const {RealmsServiceClient} = require('@google-cloud/game-servers'); @@ -31,6 +32,10 @@ describe('Game Servers Delete Realm Test', () => { before(async () => { const projectId = await client.getProjectId(); + + // Clean up any stray realms + await cleanup(); + realmId = `test-${uuid.v4()}`; await client.createRealm({ diff --git a/game-servers/snippets/test/get_realm.test.js b/game-servers/snippets/test/get_realm.test.js index 4eb9ebc9c8..43b6ecb494 100644 --- a/game-servers/snippets/test/get_realm.test.js +++ b/game-servers/snippets/test/get_realm.test.js @@ -15,6 +15,7 @@ 'use strict'; const {assert} = require('chai'); +const cleanup = require('./clean.js'); const {describe, it, before, after} = require('mocha'); const {RealmsServiceClient} = require('@google-cloud/game-servers'); @@ -31,6 +32,10 @@ describe('Game Servers Get Realms Test', () => { before(async () => { const projectId = await client.getProjectId(); + + // Clean up any stray realms + await cleanup(); + realmId = `test-${uuid.v4()}`; await client.createRealm({ diff --git a/game-servers/snippets/test/list_realms.test.js b/game-servers/snippets/test/list_realms.test.js index 35c78613bd..574b6a5187 100644 --- a/game-servers/snippets/test/list_realms.test.js +++ b/game-servers/snippets/test/list_realms.test.js @@ -15,6 +15,7 @@ 'use strict'; const {assert} = require('chai'); +const cleanup = require('./clean.js'); const {describe, it, before, after} = require('mocha'); const {RealmsServiceClient} = require('@google-cloud/game-servers'); @@ -31,6 +32,10 @@ describe('Game Servers List Realms Test', () => { before(async () => { const projectId = await client.getProjectId(); + + // Clean up any stray realms + await cleanup(); + realmId = `test-${uuid.v4()}`; await client.createRealm({ diff --git a/game-servers/snippets/test/quickstart.test.js b/game-servers/snippets/test/quickstart.test.js index 74b1644527..8d370fa7d5 100644 --- a/game-servers/snippets/test/quickstart.test.js +++ b/game-servers/snippets/test/quickstart.test.js @@ -15,7 +15,8 @@ 'use strict'; const {assert} = require('chai'); -const {describe, it, after} = require('mocha'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); const {RealmsServiceClient} = require('@google-cloud/game-servers'); const cp = require('child_process'); @@ -29,6 +30,10 @@ describe('Game Servers Quickstart Test', () => { const client = new RealmsServiceClient(); let realmId; + before(async () => { + await cleanup(); + }); + it('should create a realm', async () => { const projectId = await client.getProjectId(); realmId = `test-${uuid.v4()}`; From eb25adfa3b959ae5f6066978aaab3af9187c8102 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 27 Apr 2020 10:36:01 -0700 Subject: [PATCH 12/51] build: generator updates and new coverage approach (#59) --- game-servers/snippets/list_realms.js | 2 +- game-servers/snippets/test/clean.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/game-servers/snippets/list_realms.js b/game-servers/snippets/list_realms.js index 18039dfce3..fbeb7256f8 100644 --- a/game-servers/snippets/list_realms.js +++ b/game-servers/snippets/list_realms.js @@ -35,7 +35,7 @@ function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { }; const [results] = await client.listRealms(request); - for (const realm of results.realms) { + for (const realm of results) { console.log(`Realm name: ${realm.name}`); console.log(`Realm description: ${realm.description}`); console.log(`Realm time zone: ${realm.timeZone}`); diff --git a/game-servers/snippets/test/clean.js b/game-servers/snippets/test/clean.js index 814852c614..7436f1870a 100644 --- a/game-servers/snippets/test/clean.js +++ b/game-servers/snippets/test/clean.js @@ -33,7 +33,7 @@ module.exports = async () => { const NOW = new Date(); const [results] = await realmsClient.listRealms(request); - for (const realm of results.realms) { + for (const realm of results) { // Check age of realm. If older than maximum life span, delete. const ageOfRealm = new Date(realm.createTime.seconds * 1000); if (NOW - ageOfRealm > MAX_REALM_LIFESPAN) { From cd1fe756a4aaf5efe19cdbc9575f8145b204e314 Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Wed, 29 Apr 2020 14:44:17 -0700 Subject: [PATCH 13/51] feat: adds CRUD samples, tests for GS clusters (#24) --- game-servers/snippets/create_cluster.js | 79 ++++++++++++ game-servers/snippets/delete_cluster.js | 58 +++++++++ game-servers/snippets/get_cluster.js | 63 ++++++++++ game-servers/snippets/list_clusters.js | 63 ++++++++++ game-servers/snippets/test/clean.js | 2 +- .../snippets/test/create_cluster.test.js | 91 ++++++++++++++ .../snippets/test/delete_cluster.test.js | 112 ++++++++++++++++++ .../snippets/test/get_cluster.test.js | 111 +++++++++++++++++ .../snippets/test/list_clusters.test.js | 111 +++++++++++++++++ 9 files changed, 689 insertions(+), 1 deletion(-) create mode 100644 game-servers/snippets/create_cluster.js create mode 100644 game-servers/snippets/delete_cluster.js create mode 100644 game-servers/snippets/get_cluster.js create mode 100644 game-servers/snippets/list_clusters.js create mode 100644 game-servers/snippets/test/create_cluster.test.js create mode 100644 game-servers/snippets/test/delete_cluster.test.js create mode 100644 game-servers/snippets/test/get_cluster.test.js create mode 100644 game-servers/snippets/test/list_clusters.test.js diff --git a/game-servers/snippets/create_cluster.js b/game-servers/snippets/create_cluster.js new file mode 100644 index 0000000000..57f19fc1ff --- /dev/null +++ b/game-servers/snippets/create_cluster.js @@ -0,0 +1,79 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Create a Game Servers cluster. + * @param {string} projectId string project identifier + * @param {string} location Compute Engine region + * @param {string} realmId the realm to use + * @param {string} gameClusterId unique identifier for the new Game Cluster + * @param {string} gkeClusterId the GKE cluster to connect to + * @param {string} gkeLocation the location of the GKE cluster + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID', + gameClusterId = 'GAME_CLUSTER_ID', + gkeClusterName = 'GKE_CLUSTER_NAME' +) { + // [START cloud_game_servers_create_cluster] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; + // const gameClusterId = 'A unique ID for this Game Server Cluster'; + // const gkeClusterName= 'The full resource name of the GKE cluster to use'; + const { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function createGameServerCluster() { + const request = { + // Provide full resource name of a Game Server Realm + parent: `projects/${projectId}/locations/${location}/realms/${realmId}`, + gameServerClusterId: gameClusterId, + gameServerCluster: { + description: 'My Game Server Cluster', + connectionInfo: { + gkeClusterReference: { + // Provide full resource name of a Kubernetes Engine cluster + cluster: gkeClusterName, + }, + namespace: 'default', + }, + }, + }; + + const [operation] = await client.createGameServerCluster(request); + const [result] = await operation.promise(); + + console.log('Game Server Cluster created:'); + console.log(`\tCluster name: ${result.name}`); + console.log(`\tCluster description: ${result.description}`); + console.log( + `\tGKE cluster: ${result.connectionInfo.gkeClusterReference.cluster}` + ); + // [END cloud_game_servers_create_cluster] + } + + createGameServerCluster(); +} + +main(...process.argv.slice(2)); diff --git a/game-servers/snippets/delete_cluster.js b/game-servers/snippets/delete_cluster.js new file mode 100644 index 0000000000..8ef0e09fea --- /dev/null +++ b/game-servers/snippets/delete_cluster.js @@ -0,0 +1,58 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Delete a Game Server cluster + * @param {string} projectId string project identifier + * @param {string} location Compute Engine region + * @param {string} realmId the realm to use + * @param {string} gameClusterId the game cluster to delete + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID', + gameClusterId = 'GAME_CLUSTER_ID' +) { + // [START cloud_game_servers_delete_cluster] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; + // const gameClusterId = 'The unique ID for this Game Server Cluster'; + const { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function deleteGameServerCluster() { + const request = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${location}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + + await client.deleteGameServerCluster(request); + + console.log('Game Server cluster deleted'); + // [END cloud_game_servers_delete_cluster] + } + + deleteGameServerCluster(); +} + +main(...process.argv.slice(2)); diff --git a/game-servers/snippets/get_cluster.js b/game-servers/snippets/get_cluster.js new file mode 100644 index 0000000000..8cebc8ff75 --- /dev/null +++ b/game-servers/snippets/get_cluster.js @@ -0,0 +1,63 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Get a Game Server cluster + * @param {string} projectId string project identifier + * @param {string} location Compute Engine region + * @param {string} realmId the realm to use + * @param {string} gameClusterId the game cluster to get + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID', + gameClusterId = 'GAME_CLUSTER_ID' +) { + // [START cloud_game_servers_get_cluster] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; + // const gameClusterId = 'The unique ID for this Game Server Cluster'; + const { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function getGameServerCluster() { + const request = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${location}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + + const [cluster] = await client.getGameServerCluster(request); + + console.log('Game Server Cluster:'); + console.log(`\tCluster name: ${cluster.name}`); + console.log(`\tCluster description: ${cluster.description}`); + console.log( + `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` + ); + // [END cloud_game_servers_get_cluster] + } + + getGameServerCluster(); +} + +main(...process.argv.slice(2)); diff --git a/game-servers/snippets/list_clusters.js b/game-servers/snippets/list_clusters.js new file mode 100644 index 0000000000..d2faa73f53 --- /dev/null +++ b/game-servers/snippets/list_clusters.js @@ -0,0 +1,63 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * List Game Server clusters + * @param {string} projectId string project identifier + * @param {string} location Compute Engine region + * @param {string} realmId the realm to use + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_list_clusters] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; + const { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function listGameServerClusters() { + const request = { + // Provide full resource name of a Game Server Realm + parent: `projects/${projectId}/locations/${location}/realms/${realmId}`, + }; + + const results = await client.listGameServerClusters(request); + const [clusters] = results; + + for (const cluster of clusters) { + console.log('Game Server Cluster:'); + console.log(`\tCluster name: ${cluster.name}`); + console.log(`\tCluster description: ${cluster.description}`); + console.log( + `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` + ); + } + // [END cloud_game_servers_list_clusters] + } + + listGameServerClusters(); +} + +main(...process.argv.slice(2)); diff --git a/game-servers/snippets/test/clean.js b/game-servers/snippets/test/clean.js index 7436f1870a..cf62661619 100644 --- a/game-servers/snippets/test/clean.js +++ b/game-servers/snippets/test/clean.js @@ -46,7 +46,7 @@ module.exports = async () => { clustersRequest ); const [clusters] = clustersResult; - for (const cluster of clusters.gameServerClusters) { + for (const cluster of clusters) { const deleteClusterRequest = { name: cluster.name, }; diff --git a/game-servers/snippets/test/create_cluster.test.js b/game-servers/snippets/test/create_cluster.test.js new file mode 100644 index 0000000000..dc0bb66235 --- /dev/null +++ b/game-servers/snippets/test/create_cluster.test.js @@ -0,0 +1,91 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const { + RealmsServiceClient, + GameServerClustersServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; +const GKE_CLUSTER_NAME = + process.env.SAMPLE_CLUSTER_NAME || + 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + +describe('Game Servers Create Cluster Test', () => { + const realmsClient = new RealmsServiceClient(); + const gameClustersClient = new GameServerClustersServiceClient(); + let realmId, gameClusterId; + + before(async () => { + await cleanup(); + + // Create a realm + const projectId = await realmsClient.getProjectId(); + realmId = `create-realm-${uuid.v4()}`; + gameClusterId = `test-${uuid.v4()}`; + + const request = { + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation] = await realmsClient.createRealm(request); + await operation.promise(); + }); + + it('should create a Game Server cluster', async () => { + const projectId = await realmsClient.getProjectId(); + gameClusterId = `test-${uuid.v4()}`; + + const create_output = execSync( + `node create_cluster.js ${projectId} ${LOCATION} ${realmId} ${gameClusterId} ${GKE_CLUSTER_NAME}` + ); + assert.match(create_output, /Cluster name:/); + }); + + after(async () => { + const projectId = await realmsClient.getProjectId(); + + // Delete the Game Server cluster + const deleteClusterRequest = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + const [operation1] = await gameClustersClient.deleteGameServerCluster( + deleteClusterRequest + ); + await operation1.promise(); + + // Delete the realm + const deleteRealmRequest = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation2.promise(); + }); +}); diff --git a/game-servers/snippets/test/delete_cluster.test.js b/game-servers/snippets/test/delete_cluster.test.js new file mode 100644 index 0000000000..c09a1b528a --- /dev/null +++ b/game-servers/snippets/test/delete_cluster.test.js @@ -0,0 +1,112 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const { + RealmsServiceClient, + GameServerClustersServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; +const GKE_CLUSTER_NAME = + process.env.SAMPLE_CLUSTER_NAME || + 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + +describe('Game Servers Delete Cluster Test', () => { + const realmsClient = new RealmsServiceClient(); + const gameClustersClient = new GameServerClustersServiceClient(); + let projectId, realmId, gameClusterId; + + before(async () => { + await cleanup(); + + // Create a realm + projectId = await realmsClient.getProjectId(); + realmId = `delete-realm-${uuid.v4()}`; + gameClusterId = `test-${uuid.v4()}`; + + const createRealmRequest = { + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation1] = await realmsClient.createRealm(createRealmRequest); + await operation1.promise(); + + // Create a cluster + const createClusterRequest = { + parent: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + gameServerClusterId: gameClusterId, + gameServerCluster: { + description: 'My Game Server Cluster', + connectionInfo: { + gkeClusterReference: { + // Provide full resource name of a Kubernetes Engine cluster + cluster: GKE_CLUSTER_NAME, + }, + namespace: 'default', + }, + }, + }; + + const [operation2] = await gameClustersClient.createGameServerCluster( + createClusterRequest + ); + await operation2.promise(); + }); + + it('should delete a Game Server cluster in a realm', async () => { + const create_output = execSync( + `node delete_cluster.js ${projectId} ${LOCATION} ${realmId} ${gameClusterId}` + ); + assert.match(create_output, /Game Server cluster deleted/); + }); + + after(async () => { + // Delete the Game Server cluster + const deleteClusterRequest = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + try { + const [operation1] = await gameClustersClient.deleteGameServerCluster( + deleteClusterRequest + ); + await operation1.promise(); + } catch (ex) { + console.log(ex); + console.log(`Realm ID: ${realmId}`); + console.log(`Cluster ID: ${gameClusterId}`); + } + // Delete the realm + const deleteRealmRequest = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation2.promise(); + }); +}); diff --git a/game-servers/snippets/test/get_cluster.test.js b/game-servers/snippets/test/get_cluster.test.js new file mode 100644 index 0000000000..fc0a761ae2 --- /dev/null +++ b/game-servers/snippets/test/get_cluster.test.js @@ -0,0 +1,111 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const { + RealmsServiceClient, + GameServerClustersServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; +const GKE_CLUSTER_NAME = + process.env.SAMPLE_CLUSTER_NAME || + 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + +describe('Game Servers Get Cluster Test', () => { + const realmsClient = new RealmsServiceClient(); + const gameClustersClient = new GameServerClustersServiceClient(); + let realmId, gameClusterId; + + before(async () => { + await cleanup(); + + // Create a realm + const projectId = await realmsClient.getProjectId(); + realmId = `get-realm-${uuid.v4()}`; + gameClusterId = `test-${uuid.v4()}`; + + const createRealmRequest = { + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation1] = await realmsClient.createRealm(createRealmRequest); + await operation1.promise(); + + // Create a cluster + const createClusterRequest = { + parent: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + gameServerClusterId: gameClusterId, + gameServerCluster: { + description: 'My Game Server Cluster', + connectionInfo: { + gkeClusterReference: { + // Provide full resource name of a Kubernetes Engine cluster + cluster: GKE_CLUSTER_NAME, + }, + namespace: 'default', + }, + }, + }; + + const [operation2] = await gameClustersClient.createGameServerCluster( + createClusterRequest + ); + await operation2.promise(); + }); + + it('should get a Game Server cluster in a realm', async () => { + const projectId = await realmsClient.getProjectId(); + + const create_output = execSync( + `node get_cluster.js ${projectId} ${LOCATION} ${realmId} ${gameClusterId}` + ); + assert.match(create_output, /Cluster name:/); + }); + + after(async () => { + const projectId = await realmsClient.getProjectId(); + + // Delete the Game Server cluster + const deleteClusterRequest = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + const [operation1] = await gameClustersClient.deleteGameServerCluster( + deleteClusterRequest + ); + await operation1.promise(); + + // Delete the realm + const deleteRealmRequest = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation2.promise(); + }); +}); diff --git a/game-servers/snippets/test/list_clusters.test.js b/game-servers/snippets/test/list_clusters.test.js new file mode 100644 index 0000000000..51d5478742 --- /dev/null +++ b/game-servers/snippets/test/list_clusters.test.js @@ -0,0 +1,111 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const { + RealmsServiceClient, + GameServerClustersServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; +const GKE_CLUSTER_NAME = + process.env.SAMPLE_CLUSTER_NAME || + 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + +describe('Game Servers List Clusters Test', () => { + const realmsClient = new RealmsServiceClient(); + const gameClustersClient = new GameServerClustersServiceClient(); + let realmId, gameClusterId; + + before(async () => { + await cleanup(); + + // Create a realm + const projectId = await realmsClient.getProjectId(); + realmId = `list-realm-${uuid.v4()}`; + gameClusterId = `test-${uuid.v4()}`; + + const createRealmRequest = { + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation1] = await realmsClient.createRealm(createRealmRequest); + await operation1.promise(); + + // Create a cluster + const createClusterRequest = { + parent: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + gameServerClusterId: gameClusterId, + gameServerCluster: { + description: 'My Game Server Cluster', + connectionInfo: { + gkeClusterReference: { + // Provide full resource name of a Kubernetes Engine cluster + cluster: GKE_CLUSTER_NAME, + }, + namespace: 'default', + }, + }, + }; + + const [operation2] = await gameClustersClient.createGameServerCluster( + createClusterRequest + ); + await operation2.promise(); + }); + + it('should list Game Server clusters in a realm', async () => { + const projectId = await realmsClient.getProjectId(); + + const create_output = execSync( + `node list_clusters.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(create_output, /Cluster name:/); + }); + + after(async () => { + const projectId = await realmsClient.getProjectId(); + + // Delete the Game Server cluster + const deleteClusterRequest = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + const [operation1] = await gameClustersClient.deleteGameServerCluster( + deleteClusterRequest + ); + await operation1.promise(); + + // Delete the realm + const deleteRealmRequest = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation2.promise(); + }); +}); From 55e4774cbbc0f6639a506b24fb2996b1c6178548 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 1 May 2020 06:54:18 +0200 Subject: [PATCH 14/51] chore(deps): update dependency uuid to v8 (#63) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [uuid](https://togithub.com/uuidjs/uuid) | devDependencies | major | [`^7.0.1` -> `^8.0.0`](https://renovatebot.com/diffs/npm/uuid/7.0.3/8.0.0) | --- ### Release Notes
uuidjs/uuid ### [`v8.0.0`](https://togithub.com/uuidjs/uuid/blob/master/CHANGELOG.md#​800-httpsgithubcomuuidjsuuidcomparev703v800-2020-04-29) [Compare Source](https://togithub.com/uuidjs/uuid/compare/v7.0.3...v8.0.0) ##### ⚠ BREAKING CHANGES - For native ECMAScript Module (ESM) usage in Node.js only named exports are exposed, there is no more default export. ```diff -import uuid from 'uuid'; -console.log(uuid.v4()); // -> 'cd6c3b08-0adc-4f4b-a6ef-36087a1c9869' +import { v4 as uuidv4 } from 'uuid'; +uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d' ``` - Deep requiring specific algorithms of this library like `require('uuid/v4')`, which has been deprecated in `uuid@7`, is no longer supported. Instead use the named exports that this module exports. For ECMAScript Modules (ESM): ```diff -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; uuidv4(); ``` For CommonJS: ```diff -const uuidv4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); uuidv4(); ``` ##### Features - native Node.js ES Modules (wrapper approach) ([#​423](https://togithub.com/uuidjs/uuid/issues/423)) ([2d9f590](https://togithub.com/uuidjs/uuid/commit/2d9f590ad9701d692625c07ed62f0a0f91227991)), closes [#​245](https://togithub.com/uuidjs/uuid/issues/245) [#​419](https://togithub.com/uuidjs/uuid/issues/419) [#​342](https://togithub.com/uuidjs/uuid/issues/342) - remove deep requires ([#​426](https://togithub.com/uuidjs/uuid/issues/426)) ([daf72b8](https://togithub.com/uuidjs/uuid/commit/daf72b84ceb20272a81bb5fbddb05dd95922cbba)) ##### Bug Fixes - add CommonJS syntax example to README quickstart section ([#​417](https://togithub.com/uuidjs/uuid/issues/417)) ([e0ec840](https://togithub.com/uuidjs/uuid/commit/e0ec8402c7ad44b7ef0453036c612f5db513fda0)) ##### [7.0.3](https://togithub.com/uuidjs/uuid/compare/v7.0.2...v7.0.3) (2020-03-31) ##### Bug Fixes - make deep require deprecation warning work in browsers ([#​409](https://togithub.com/uuidjs/uuid/issues/409)) ([4b71107](https://togithub.com/uuidjs/uuid/commit/4b71107d8c0d2ef56861ede6403fc9dc35a1e6bf)), closes [#​408](https://togithub.com/uuidjs/uuid/issues/408) ##### [7.0.2](https://togithub.com/uuidjs/uuid/compare/v7.0.1...v7.0.2) (2020-03-04) ##### Bug Fixes - make access to msCrypto consistent ([#​393](https://togithub.com/uuidjs/uuid/issues/393)) ([8bf2a20](https://togithub.com/uuidjs/uuid/commit/8bf2a20f3565df743da7215eebdbada9d2df118c)) - simplify link in deprecation warning ([#​391](https://togithub.com/uuidjs/uuid/issues/391)) ([bb2c8e4](https://togithub.com/uuidjs/uuid/commit/bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7)) - update links to match content in readme ([#​386](https://togithub.com/uuidjs/uuid/issues/386)) ([44f2f86](https://togithub.com/uuidjs/uuid/commit/44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4)) ##### [7.0.1](https://togithub.com/uuidjs/uuid/compare/v7.0.0...v7.0.1) (2020-02-25) ##### Bug Fixes - clean up esm builds for node and browser ([#​383](https://togithub.com/uuidjs/uuid/issues/383)) ([59e6a49](https://togithub.com/uuidjs/uuid/commit/59e6a49e7ce7b3e8fb0f3ee52b9daae72af467dc)) - provide browser versions independent from module system ([#​380](https://togithub.com/uuidjs/uuid/issues/380)) ([4344a22](https://togithub.com/uuidjs/uuid/commit/4344a22e7aed33be8627eeaaf05360f256a21753)), closes [#​378](https://togithub.com/uuidjs/uuid/issues/378)
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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-game-servers). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index b738ce91b0..4743b60f84 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -19,6 +19,6 @@ "c8": "^7.0.0", "chai": "^4.2.0", "mocha": "^7.0.0", - "uuid": "^7.0.1" + "uuid": "^8.0.0" } } From dbd676627764b1423c075465ce186e35bac47a49 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 4 Jun 2020 11:05:54 -0700 Subject: [PATCH 15/51] chore: release 2.0.0 (#38) * 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> --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 4743b60f84..e6a9411fa7 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^1.1.0" + "@google-cloud/game-servers": "^2.0.0" }, "devDependencies": { "c8": "^7.0.0", From 3a4ed175f11827d53391e81484c9058953939f9a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 11 Jun 2020 17:46:07 +0200 Subject: [PATCH 16/51] chore(deps): update dependency mocha to v8 (#72) 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
mochajs/mocha ### [`v8.0.1`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​801--2020-06-10) [Compare Source](https://togithub.com/mochajs/mocha/compare/v8.0.0...v8.0.1) The obligatory patch after a major. #### :bug: Fixes - [#​4328](https://togithub.com/mochajs/mocha/issues/4328): Fix `--parallel` when combined with `--watch` ([**@​boneskull**](https://togithub.com/boneskull)) ### [`v8.0.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​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 [**@​giltayar**](https://togithub.com/giltayar) and [**@​nicojs**](https://togithub.com/nicojs) to the maintenance team! #### :boom: Breaking Changes - [#​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 ([**@​UlisesGascon**](https://togithub.com/UlisesGascon)) - [#​4175](https://togithub.com/mochajs/mocha/issues/4175): Having been deprecated with a warning since v7.0.0, **`mocha.opts` is no longer supported** ([**@​juergba**](https://togithub.com/juergba)) :sparkles: **WORKAROUND:** Replace `mocha.opts` with a [configuration file](https://mochajs.org/#configuring-mocha-nodejs). - [#​4260](https://togithub.com/mochajs/mocha/issues/4260): Remove `enableTimeout()` (`this.enableTimeout()`) from the context object ([**@​craigtaub**](https://togithub.com/craigtaub)) :sparkles: **WORKAROUND:** Replace usage of `this.enableTimeout(false)` in your tests with `this.timeout(0)`. - [#​4315](https://togithub.com/mochajs/mocha/issues/4315): The `spec` option no longer supports a comma-delimited list of files ([**@​juergba**](https://togithub.com/juergba)) :sparkles: **WORKAROUND**: Use an array instead (e.g., `"spec": "foo.js,bar.js"` becomes `"spec": ["foo.js", "bar.js"]`). - [#​4309](https://togithub.com/mochajs/mocha/issues/4309): Drop support for Node.js v13.x line, which is now End-of-Life ([**@​juergba**](https://togithub.com/juergba)) - [#​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 ([**@​arvidOtt**](https://togithub.com/arvidOtt)) - [#​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 ([**@​juergba**](https://togithub.com/juergba)) - [#​4178](https://togithub.com/mochajs/mocha/issues/4178): Remove previously soft-deprecated APIs ([**@​wnghdcjfe**](https://togithub.com/wnghdcjfe)): - `Mocha.prototype.ignoreLeaks()` - `Mocha.prototype.useColors()` - `Mocha.prototype.useInlineDiffs()` - `Mocha.prototype.hideDiff()` #### :tada: Enhancements - [#​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)) ([**@​boneskull**](https://togithub.com/boneskull)) :exclamation: See also [#​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_ - [#​4304](https://togithub.com/mochajs/mocha/issues/4304): `--require` now works with ES modules ([**@​JacobLey**](https://togithub.com/JacobLey)) - [#​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!_ ([**@​giltayar**](https://togithub.com/giltayar)) #### :book: Documentation - [#​4246](https://togithub.com/mochajs/mocha/issues/4246): Add documentation for parallel mode and Root Hook plugins ([**@​boneskull**](https://togithub.com/boneskull)) #### :bug: Fixes (All bug fixes in Mocha v8.0.0 are also breaking changes, and are listed above)
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] 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-game-servers). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index e6a9411fa7..b24d1d469b 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -18,7 +18,7 @@ "devDependencies": { "c8": "^7.0.0", "chai": "^4.2.0", - "mocha": "^7.0.0", + "mocha": "^8.0.0", "uuid": "^8.0.0" } } From f640609ccb8923a24d2097a7ce22430f30530350 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2020 09:01:48 -0700 Subject: [PATCH 17/51] chore: release 2.0.1 (#75) * 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> --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index b24d1d469b..9b6401e6c3 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.0.0" + "@google-cloud/game-servers": "^2.0.1" }, "devDependencies": { "c8": "^7.0.0", From cdd0d5e39ddbdd6349ec0e033ab71efae8f0aa98 Mon Sep 17 00:00:00 2001 From: xwxw-g <58997759+xwxw-g@users.noreply.github.com> Date: Wed, 8 Jul 2020 18:03:04 -0700 Subject: [PATCH 18/51] test: fix sample test by pointing at a shared cluster with Agones (#81) --- game-servers/snippets/test/create_cluster.test.js | 2 +- game-servers/snippets/test/delete_cluster.test.js | 2 +- game-servers/snippets/test/get_cluster.test.js | 2 +- game-servers/snippets/test/list_clusters.test.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/game-servers/snippets/test/create_cluster.test.js b/game-servers/snippets/test/create_cluster.test.js index dc0bb66235..a13ea88e66 100644 --- a/game-servers/snippets/test/create_cluster.test.js +++ b/game-servers/snippets/test/create_cluster.test.js @@ -30,7 +30,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const LOCATION = 'us-central1'; const GKE_CLUSTER_NAME = process.env.SAMPLE_CLUSTER_NAME || - 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; describe('Game Servers Create Cluster Test', () => { const realmsClient = new RealmsServiceClient(); diff --git a/game-servers/snippets/test/delete_cluster.test.js b/game-servers/snippets/test/delete_cluster.test.js index c09a1b528a..832e51737b 100644 --- a/game-servers/snippets/test/delete_cluster.test.js +++ b/game-servers/snippets/test/delete_cluster.test.js @@ -30,7 +30,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const LOCATION = 'us-central1'; const GKE_CLUSTER_NAME = process.env.SAMPLE_CLUSTER_NAME || - 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; describe('Game Servers Delete Cluster Test', () => { const realmsClient = new RealmsServiceClient(); diff --git a/game-servers/snippets/test/get_cluster.test.js b/game-servers/snippets/test/get_cluster.test.js index fc0a761ae2..d62765c3f5 100644 --- a/game-servers/snippets/test/get_cluster.test.js +++ b/game-servers/snippets/test/get_cluster.test.js @@ -30,7 +30,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const LOCATION = 'us-central1'; const GKE_CLUSTER_NAME = process.env.SAMPLE_CLUSTER_NAME || - 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; describe('Game Servers Get Cluster Test', () => { const realmsClient = new RealmsServiceClient(); diff --git a/game-servers/snippets/test/list_clusters.test.js b/game-servers/snippets/test/list_clusters.test.js index 51d5478742..b32b7ed245 100644 --- a/game-servers/snippets/test/list_clusters.test.js +++ b/game-servers/snippets/test/list_clusters.test.js @@ -30,7 +30,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const LOCATION = 'us-central1'; const GKE_CLUSTER_NAME = process.env.SAMPLE_CLUSTER_NAME || - 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; describe('Game Servers List Clusters Test', () => { const realmsClient = new RealmsServiceClient(); From 3a801b2dc13c01db3a338aa910adc11587f1938b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2020 01:14:15 +0000 Subject: [PATCH 19/51] chore: release 2.0.2 (#82) :robot: I have created a release \*beep\* \*boop\* --- ### [2.0.2](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.0.1...v2.0.2) (2020-07-09) ### Bug Fixes * correct return type of delete operations ([#79](https://www.github.com/googleapis/nodejs-game-servers/issues/79)) ([e946632](https://www.github.com/googleapis/nodejs-game-servers/commit/e9466329399c62c0f6f49a713f68ecf8ef96213b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 9b6401e6c3..92c20f638d 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.0.1" + "@google-cloud/game-servers": "^2.0.2" }, "devDependencies": { "c8": "^7.0.0", From df6a3235cf97dc513f42926490c02f76353bba1b Mon Sep 17 00:00:00 2001 From: pooneh-m <46979170+pooneh-m@users.noreply.github.com> Date: Thu, 16 Jul 2020 09:23:07 -0700 Subject: [PATCH 20/51] docs(samples): fix sample formatting issues (#94) --- game-servers/snippets/create_cluster.js | 31 +++++++++++++--------- game-servers/snippets/create_realm.js | 25 +++++++++++------- game-servers/snippets/delete_cluster.js | 34 +++++++++++++++++-------- game-servers/snippets/delete_realm.js | 28 ++++++++++++-------- game-servers/snippets/get_cluster.js | 34 +++++++++++++++++-------- game-servers/snippets/get_realm.js | 27 ++++++++++++-------- game-servers/snippets/list_clusters.js | 27 ++++++++++++-------- game-servers/snippets/list_realms.js | 23 +++++++++++------ 8 files changed, 147 insertions(+), 82 deletions(-) diff --git a/game-servers/snippets/create_cluster.js b/game-servers/snippets/create_cluster.js index 57f19fc1ff..120e5f83b7 100644 --- a/game-servers/snippets/create_cluster.js +++ b/game-servers/snippets/create_cluster.js @@ -22,7 +22,7 @@ * @param {string} gkeClusterId the GKE cluster to connect to * @param {string} gkeLocation the location of the GKE cluster */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID', @@ -30,14 +30,6 @@ function main( gkeClusterName = 'GKE_CLUSTER_NAME' ) { // [START cloud_game_servers_create_cluster] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - // const projectId = 'Your Google Cloud Project ID'; - // const location = 'A Compute Engine region, e.g. "us-central1"'; - // const realmId = 'The ID of the realm to locate this cluster in'; - // const gameClusterId = 'A unique ID for this Game Server Cluster'; - // const gkeClusterName= 'The full resource name of the GKE cluster to use'; const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -45,9 +37,17 @@ function main( const client = new GameServerClustersServiceClient(); async function createGameServerCluster() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; + // const gameClusterId = 'A unique ID for this Game Server Cluster'; + // const gkeClusterName= 'The full resource name of the GKE cluster to use'; const request = { // Provide full resource name of a Game Server Realm - parent: `projects/${projectId}/locations/${location}/realms/${realmId}`, + parent: client.realmPath(projectId, location, realmId), gameServerClusterId: gameClusterId, gameServerCluster: { description: 'My Game Server Cluster', @@ -70,10 +70,17 @@ function main( console.log( `\tGKE cluster: ${result.connectionInfo.gkeClusterReference.cluster}` ); - // [END cloud_game_servers_create_cluster] } createGameServerCluster(); + // [END cloud_game_servers_create_cluster] } -main(...process.argv.slice(2)); +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/create_realm.js b/game-servers/snippets/create_realm.js index 8ce712035f..517b440313 100644 --- a/game-servers/snippets/create_realm.js +++ b/game-servers/snippets/create_realm.js @@ -19,23 +19,23 @@ * @param {string} location Compute Engine region. * @param {string} realmId a unique identifier for the new realm */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID' ) { // [START cloud_game_servers_create_realm] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - // const projectId = 'Your Google Cloud Project ID'; - // const location = 'A Compute Engine region, e.g. "us-central1"'; - // const realmId = 'A unique identifier for the realm'; const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); async function createRealm() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'A unique identifier for the realm'; const request = { parent: `projects/${projectId}/locations/${location}`, realmId: realmId, @@ -56,10 +56,17 @@ function main( console.log(`\tRealm name: ${realm.name}`); console.log(`\tRealm description: ${realm.description}`); console.log(`\tRealm time zone: ${realm.timeZone}`); - // [END cloud_game_servers_create_realm] } createRealm(); + // [END cloud_game_servers_create_realm] } -main(...process.argv.slice(2)); +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/delete_cluster.js b/game-servers/snippets/delete_cluster.js index 8ef0e09fea..4b4c4d4778 100644 --- a/game-servers/snippets/delete_cluster.js +++ b/game-servers/snippets/delete_cluster.js @@ -20,20 +20,13 @@ * @param {string} realmId the realm to use * @param {string} gameClusterId the game cluster to delete */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID', gameClusterId = 'GAME_CLUSTER_ID' ) { // [START cloud_game_servers_delete_cluster] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - // const projectId = 'Your Google Cloud Project ID'; - // const location = 'A Compute Engine region, e.g. "us-central1"'; - // const realmId = 'The ID of the realm to locate this cluster in'; - // const gameClusterId = 'The unique ID for this Game Server Cluster'; const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -41,18 +34,37 @@ function main( const client = new GameServerClustersServiceClient(); async function deleteGameServerCluster() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; + // const gameClusterId = 'The unique ID for this Game Server Cluster'; const request = { // Provide full resource name of a Game Server Realm - name: `projects/${projectId}/locations/${location}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + name: client.gameServerClusterPath( + projectId, + location, + realmId, + gameClusterId + ), }; await client.deleteGameServerCluster(request); console.log('Game Server cluster deleted'); - // [END cloud_game_servers_delete_cluster] } deleteGameServerCluster(); + // [END cloud_game_servers_delete_cluster] } -main(...process.argv.slice(2)); +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/delete_realm.js b/game-servers/snippets/delete_realm.js index f5224437c3..d5ba2ed6fc 100644 --- a/game-servers/snippets/delete_realm.js +++ b/game-servers/snippets/delete_realm.js @@ -19,37 +19,43 @@ * @param {string} location Compute Engine region. * @param {string} realmId the unique ID of the realm */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID' ) { // [START cloud_game_servers_delete_realm] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - // const projectId = 'Your Google Cloud Project ID'; - // const location = 'A Compute Engine region, e.g. "us-central1"'; - // const realmId = 'Unique identifier of the realm'; const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); async function deleteRealm() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'Unique identifier of the realm'; const request = { // Realm name is the full resource name including project ID,location, // and the realm ID. - name: `projects/${projectId}/locations/${location}/realms/${realmId}`, + name: client.realmPath(projectId, location, realmId), }; const [operation] = await client.deleteRealm(request); await operation.promise(); console.log(`Realm with ID ${realmId} deleted.`); - - // [END cloud_game_servers_delete_realm] } deleteRealm(); + // [END cloud_game_servers_delete_realm] } -main(...process.argv.slice(2)); +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/get_cluster.js b/game-servers/snippets/get_cluster.js index 8cebc8ff75..5fb715e544 100644 --- a/game-servers/snippets/get_cluster.js +++ b/game-servers/snippets/get_cluster.js @@ -20,20 +20,13 @@ * @param {string} realmId the realm to use * @param {string} gameClusterId the game cluster to get */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID', gameClusterId = 'GAME_CLUSTER_ID' ) { // [START cloud_game_servers_get_cluster] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - // const projectId = 'Your Google Cloud Project ID'; - // const location = 'A Compute Engine region, e.g. "us-central1"'; - // const realmId = 'The ID of the realm to locate this cluster in'; - // const gameClusterId = 'The unique ID for this Game Server Cluster'; const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -41,9 +34,21 @@ function main( const client = new GameServerClustersServiceClient(); async function getGameServerCluster() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; + // const gameClusterId = 'The unique ID for this Game Server Cluster'; const request = { // Provide full resource name of a Game Server Realm - name: `projects/${projectId}/locations/${location}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + name: client.gameServerClusterPath( + projectId, + location, + realmId, + gameClusterId + ), }; const [cluster] = await client.getGameServerCluster(request); @@ -54,10 +59,17 @@ function main( console.log( `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` ); - // [END cloud_game_servers_get_cluster] } getGameServerCluster(); + // [END cloud_game_servers_get_cluster] } -main(...process.argv.slice(2)); +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/get_realm.js b/game-servers/snippets/get_realm.js index 620deadc14..b87e2f02d7 100644 --- a/game-servers/snippets/get_realm.js +++ b/game-servers/snippets/get_realm.js @@ -19,26 +19,26 @@ * @param {string} location Compute Engine region. * @param {string} realmId the unique ID of the realm */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID' ) { // [START cloud_game_servers_get_realm] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - // const projectId = 'Your Google Cloud Project ID'; - // const location = 'A Compute Engine region, e.g. "us-central1"'; - // const realmId = 'Unique identifier of the realm'; const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); async function getRealm() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'Unique identifier of the realm'; const request = { // Realm name is the full resource name including project ID and location - name: `projects/${projectId}/locations/${location}/realms/${realmId}`, + name: client.realmPath(projectId, location, realmId), }; const [realm] = await client.getRealm(request); @@ -50,10 +50,17 @@ function main( const createDate = new Date(createTime.seconds * 1000); console.log(`Realm created on: ${createDate.toLocaleDateString()}`); - // [END cloud_game_servers_get_realm] } getRealm(); + // [END cloud_game_servers_get_realm] } -main(...process.argv.slice(2)); +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/list_clusters.js b/game-servers/snippets/list_clusters.js index d2faa73f53..88c1b8e101 100644 --- a/game-servers/snippets/list_clusters.js +++ b/game-servers/snippets/list_clusters.js @@ -19,18 +19,12 @@ * @param {string} location Compute Engine region * @param {string} realmId the realm to use */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID' ) { // [START cloud_game_servers_list_clusters] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - // const projectId = 'Your Google Cloud Project ID'; - // const location = 'A Compute Engine region, e.g. "us-central1"'; - // const realmId = 'The ID of the realm to locate this cluster in'; const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -38,9 +32,15 @@ function main( const client = new GameServerClustersServiceClient(); async function listGameServerClusters() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; const request = { // Provide full resource name of a Game Server Realm - parent: `projects/${projectId}/locations/${location}/realms/${realmId}`, + parent: client.realmPath(projectId, location, realmId), }; const results = await client.listGameServerClusters(request); @@ -54,10 +54,17 @@ function main( `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` ); } - // [END cloud_game_servers_list_clusters] } listGameServerClusters(); + // [END cloud_game_servers_list_clusters] } -main(...process.argv.slice(2)); +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/list_realms.js b/game-servers/snippets/list_realms.js index fbeb7256f8..b3c2253c4c 100644 --- a/game-servers/snippets/list_realms.js +++ b/game-servers/snippets/list_realms.js @@ -18,18 +18,18 @@ * @param {string} projectId string project identifier. * @param {string} location Compute Engine region. */ -function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { +async function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { // [START cloud_game_servers_list_realms] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - // const projectId = 'Your Google Cloud Project ID'; - // const location = 'A Compute Engine region, e.g. "us-central1"'; const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); async function listRealms() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; const request = { parent: `projects/${projectId}/locations/${location}`, }; @@ -44,10 +44,17 @@ function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { const createDate = new Date(createTime.seconds * 1000); console.log(`Realm created on: ${createDate.toLocaleDateString()}\n`); } - // [END cloud_game_servers_list_realms] } listRealms(); + // [END cloud_game_servers_list_realms] } -main(...process.argv.slice(2)); +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); From f9bee80023e14b3eea4a860b56d79ed30c2da8db Mon Sep 17 00:00:00 2001 From: pooneh-m <46979170+pooneh-m@users.noreply.github.com> Date: Thu, 16 Jul 2020 09:31:19 -0700 Subject: [PATCH 21/51] docs(samples): Add Game Server deployment samples (#92) Co-authored-by: Justin Beckwith --- game-servers/snippets/create_cluster.js | 4 +- game-servers/snippets/create_deployment.js | 66 ++++++++++++++++++ game-servers/snippets/delete_deployment.js | 60 ++++++++++++++++ game-servers/snippets/get_deployment.js | 64 +++++++++++++++++ game-servers/snippets/list_deployments.js | 62 +++++++++++++++++ game-servers/snippets/package.json | 2 +- .../snippets/test/crud_deployment.test.js | 68 +++++++++++++++++++ 7 files changed, 323 insertions(+), 3 deletions(-) create mode 100644 game-servers/snippets/create_deployment.js create mode 100644 game-servers/snippets/delete_deployment.js create mode 100644 game-servers/snippets/get_deployment.js create mode 100644 game-servers/snippets/list_deployments.js create mode 100644 game-servers/snippets/test/crud_deployment.test.js diff --git a/game-servers/snippets/create_cluster.js b/game-servers/snippets/create_cluster.js index 120e5f83b7..3455b846c6 100644 --- a/game-servers/snippets/create_cluster.js +++ b/game-servers/snippets/create_cluster.js @@ -19,8 +19,7 @@ * @param {string} location Compute Engine region * @param {string} realmId the realm to use * @param {string} gameClusterId unique identifier for the new Game Cluster - * @param {string} gkeClusterId the GKE cluster to connect to - * @param {string} gkeLocation the location of the GKE cluster + * @param {string} gkeClusterName The full resource name of the GKE cluster to use */ async function main( projectId = 'YOUR_PROJECT_ID', @@ -54,6 +53,7 @@ async function main( connectionInfo: { gkeClusterReference: { // Provide full resource name of a Kubernetes Engine cluster + // In the form of 'projects//locations//clusters/' cluster: gkeClusterName, }, namespace: 'default', diff --git a/game-servers/snippets/create_deployment.js b/game-servers/snippets/create_deployment.js new file mode 100644 index 0000000000..d4d9813259 --- /dev/null +++ b/game-servers/snippets/create_deployment.js @@ -0,0 +1,66 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Create a Game Servers Deployment. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_create_deployment] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function createGameServerDeployment() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + const request = { + parent: `projects/${projectId}/locations/global`, + deploymentId: deploymentId, + gameServerDeployment: { + description: 'nodejs test deployment', + }, + }; + + const [operation] = await client.createGameServerDeployment(request); + const [result] = await operation.promise(); + + console.log('Game Server Deployment created:'); + console.log(`\t Deployment name: ${result.name}`); + console.log(`\t Deployment description: ${result.description}`); + } + + createGameServerDeployment(); + + // [END cloud_game_servers_create_deployment] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/delete_deployment.js b/game-servers/snippets/delete_deployment.js new file mode 100644 index 0000000000..7dbebde90b --- /dev/null +++ b/game-servers/snippets/delete_deployment.js @@ -0,0 +1,60 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Delete a Game Servers Deployment. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_delete_deployment] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function deleteGameServerDeployment() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + const request = { + // The full resource name + name: client.gameServerDeploymentPath(projectId, 'global', deploymentId), + }; + + await client.deleteGameServerDeployment(request); + + console.log('deleted.'); + } + + deleteGameServerDeployment(); + + // [END cloud_game_servers_delete_deployment] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/get_deployment.js b/game-servers/snippets/get_deployment.js new file mode 100644 index 0000000000..70361bfd51 --- /dev/null +++ b/game-servers/snippets/get_deployment.js @@ -0,0 +1,64 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Get a Game Servers Deployment. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_get_deployment] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function getGameServerDeployment() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + const request = { + // The full resource name + name: client.gameServerDeploymentPath(projectId, 'global', deploymentId), + }; + + const [deployment] = await client.getGameServerDeployment(request); + console.log(`Deployment name: ${deployment.name}`); + console.log(`Deployment description: ${deployment.description}`); + + const createTime = deployment.createTime; + const createDate = new Date(createTime.seconds * 1000); + console.log(`Deployment created on: ${createDate.toLocaleDateString()}\n`); + } + + getGameServerDeployment(); + + // [END cloud_game_servers_get_deployment] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/list_deployments.js b/game-servers/snippets/list_deployments.js new file mode 100644 index 0000000000..4c39dbbb9e --- /dev/null +++ b/game-servers/snippets/list_deployments.js @@ -0,0 +1,62 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * List all the Game Servers Deployments. + * @param {string} projectId string project identifier + */ +async function main(projectId = 'YOUR_PROJECT_ID') { + // [START cloud_game_servers_list_deployments] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function listGameServerDeployments() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + const request = { + parent: `projects/${projectId}/locations/global`, + }; + + const [results] = await client.listGameServerDeployments(request); + for (const deployment of results) { + console.log(`Deployment name: ${deployment.name}`); + console.log(`Deployment description: ${deployment.description}`); + + const createTime = deployment.createTime; + const createDate = new Date(createTime.seconds * 1000); + console.log( + `Deployment created on: ${createDate.toLocaleDateString()}\n` + ); + } + } + + listGameServerDeployments(); + + // [END cloud_game_servers_list_deployments] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 92c20f638d..d6364f03a0 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -16,7 +16,7 @@ "@google-cloud/game-servers": "^2.0.2" }, "devDependencies": { - "c8": "^7.0.0", + "c8": "^7.2.1", "chai": "^4.2.0", "mocha": "^8.0.0", "uuid": "^8.0.0" diff --git a/game-servers/snippets/test/crud_deployment.test.js b/game-servers/snippets/test/crud_deployment.test.js new file mode 100644 index 0000000000..229c5c0f8e --- /dev/null +++ b/game-servers/snippets/test/crud_deployment.test.js @@ -0,0 +1,68 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, before, it} = require('mocha'); +const { + GameServerDeploymentsServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +describe('Game Server Deployment Test', () => { + const client = new GameServerDeploymentsServiceClient(); + let deploymentId; + let projectId; + + before(async () => { + projectId = await client.getProjectId(); + deploymentId = `test-${uuid.v4()}`; + + await cleanup(); + }); + + it('should create a game server deployment', async () => { + const create_output = execSync( + `node create_deployment.js ${projectId} ${deploymentId}` + ); + assert.match(create_output, /Deployment name:/); + }); + + it('should get a game server deployment', async () => { + const get_output = execSync( + `node get_deployment.js ${projectId} ${deploymentId}` + ); + assert.match(get_output, /Deployment name:/); + }); + + it('should list a game server deployment', async () => { + const list_output = execSync( + `node list_deployments.js ${projectId} ${deploymentId}` + ); + assert.match(list_output, /Deployment name:/); + }); + + it('should delete a game server deployment', async () => { + const delete_output = execSync( + `node delete_deployment.js ${projectId} ${deploymentId}` + ); + assert.match(delete_output, /deleted./); + }); +}); From b3744defb2d506f486fa9614cb1f88aad02f63b3 Mon Sep 17 00:00:00 2001 From: pooneh-m <46979170+pooneh-m@users.noreply.github.com> Date: Thu, 16 Jul 2020 13:21:44 -0700 Subject: [PATCH 22/51] docs(samples): change tags to be aligned with golang samples (#97) --- game-servers/snippets/create_cluster.js | 4 ++-- game-servers/snippets/create_deployment.js | 4 ++-- game-servers/snippets/create_realm.js | 4 ++-- game-servers/snippets/delete_cluster.js | 4 ++-- game-servers/snippets/delete_deployment.js | 4 ++-- game-servers/snippets/delete_realm.js | 4 ++-- game-servers/snippets/get_cluster.js | 4 ++-- game-servers/snippets/get_deployment.js | 4 ++-- game-servers/snippets/get_realm.js | 4 ++-- game-servers/snippets/list_clusters.js | 4 ++-- game-servers/snippets/list_deployments.js | 4 ++-- game-servers/snippets/list_realms.js | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/game-servers/snippets/create_cluster.js b/game-servers/snippets/create_cluster.js index 3455b846c6..71b177fe07 100644 --- a/game-servers/snippets/create_cluster.js +++ b/game-servers/snippets/create_cluster.js @@ -28,7 +28,7 @@ async function main( gameClusterId = 'GAME_CLUSTER_ID', gkeClusterName = 'GKE_CLUSTER_NAME' ) { - // [START cloud_game_servers_create_cluster] + // [START cloud_game_servers_cluster_create] const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -73,7 +73,7 @@ async function main( } createGameServerCluster(); - // [END cloud_game_servers_create_cluster] + // [END cloud_game_servers_cluster_create] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/create_deployment.js b/game-servers/snippets/create_deployment.js index d4d9813259..4b057352f7 100644 --- a/game-servers/snippets/create_deployment.js +++ b/game-servers/snippets/create_deployment.js @@ -22,7 +22,7 @@ async function main( projectId = 'YOUR_PROJECT_ID', deploymentId = 'DEPLOYMENT_ID' ) { - // [START cloud_game_servers_create_deployment] + // [START cloud_game_servers_deployment_create] const { GameServerDeploymentsServiceClient, } = require('@google-cloud/game-servers'); @@ -53,7 +53,7 @@ async function main( createGameServerDeployment(); - // [END cloud_game_servers_create_deployment] + // [END cloud_game_servers_deployment_create] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/create_realm.js b/game-servers/snippets/create_realm.js index 517b440313..456de890f7 100644 --- a/game-servers/snippets/create_realm.js +++ b/game-servers/snippets/create_realm.js @@ -24,7 +24,7 @@ async function main( location = 'LOCATION_ID', realmId = 'REALM_ID' ) { - // [START cloud_game_servers_create_realm] + // [START cloud_game_servers_realm_create] const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); @@ -59,7 +59,7 @@ async function main( } createRealm(); - // [END cloud_game_servers_create_realm] + // [END cloud_game_servers_realm_create] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/delete_cluster.js b/game-servers/snippets/delete_cluster.js index 4b4c4d4778..7c0b327870 100644 --- a/game-servers/snippets/delete_cluster.js +++ b/game-servers/snippets/delete_cluster.js @@ -26,7 +26,7 @@ async function main( realmId = 'REALM_ID', gameClusterId = 'GAME_CLUSTER_ID' ) { - // [START cloud_game_servers_delete_cluster] + // [START cloud_game_servers_cluster_delete] const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -57,7 +57,7 @@ async function main( } deleteGameServerCluster(); - // [END cloud_game_servers_delete_cluster] + // [END cloud_game_servers_cluster_delete] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/delete_deployment.js b/game-servers/snippets/delete_deployment.js index 7dbebde90b..b85ee6e266 100644 --- a/game-servers/snippets/delete_deployment.js +++ b/game-servers/snippets/delete_deployment.js @@ -22,7 +22,7 @@ async function main( projectId = 'YOUR_PROJECT_ID', deploymentId = 'DEPLOYMENT_ID' ) { - // [START cloud_game_servers_delete_deployment] + // [START cloud_game_servers_deployment_delete] const { GameServerDeploymentsServiceClient, } = require('@google-cloud/game-servers'); @@ -47,7 +47,7 @@ async function main( deleteGameServerDeployment(); - // [END cloud_game_servers_delete_deployment] + // [END cloud_game_servers_deployment_delete] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/delete_realm.js b/game-servers/snippets/delete_realm.js index d5ba2ed6fc..da1f98ba19 100644 --- a/game-servers/snippets/delete_realm.js +++ b/game-servers/snippets/delete_realm.js @@ -24,7 +24,7 @@ async function main( location = 'LOCATION_ID', realmId = 'REALM_ID' ) { - // [START cloud_game_servers_delete_realm] + // [START cloud_game_servers_realm_delete] const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); @@ -48,7 +48,7 @@ async function main( } deleteRealm(); - // [END cloud_game_servers_delete_realm] + // [END cloud_game_servers_realm_delete] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/get_cluster.js b/game-servers/snippets/get_cluster.js index 5fb715e544..cbe3ee4641 100644 --- a/game-servers/snippets/get_cluster.js +++ b/game-servers/snippets/get_cluster.js @@ -26,7 +26,7 @@ async function main( realmId = 'REALM_ID', gameClusterId = 'GAME_CLUSTER_ID' ) { - // [START cloud_game_servers_get_cluster] + // [START cloud_game_servers_cluster_get] const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -62,7 +62,7 @@ async function main( } getGameServerCluster(); - // [END cloud_game_servers_get_cluster] + // [END cloud_game_servers_cluster_get] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/get_deployment.js b/game-servers/snippets/get_deployment.js index 70361bfd51..d1b65c936f 100644 --- a/game-servers/snippets/get_deployment.js +++ b/game-servers/snippets/get_deployment.js @@ -22,7 +22,7 @@ async function main( projectId = 'YOUR_PROJECT_ID', deploymentId = 'DEPLOYMENT_ID' ) { - // [START cloud_game_servers_get_deployment] + // [START cloud_game_servers_deployment_get] const { GameServerDeploymentsServiceClient, } = require('@google-cloud/game-servers'); @@ -51,7 +51,7 @@ async function main( getGameServerDeployment(); - // [END cloud_game_servers_get_deployment] + // [END cloud_game_servers_deployment_get] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/get_realm.js b/game-servers/snippets/get_realm.js index b87e2f02d7..ae35dd99c0 100644 --- a/game-servers/snippets/get_realm.js +++ b/game-servers/snippets/get_realm.js @@ -24,7 +24,7 @@ async function main( location = 'LOCATION_ID', realmId = 'REALM_ID' ) { - // [START cloud_game_servers_get_realm] + // [START cloud_game_servers_realm_get] const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); @@ -53,7 +53,7 @@ async function main( } getRealm(); - // [END cloud_game_servers_get_realm] + // [END cloud_game_servers_realm_get] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/list_clusters.js b/game-servers/snippets/list_clusters.js index 88c1b8e101..5a8d92a819 100644 --- a/game-servers/snippets/list_clusters.js +++ b/game-servers/snippets/list_clusters.js @@ -24,7 +24,7 @@ async function main( location = 'LOCATION_ID', realmId = 'REALM_ID' ) { - // [START cloud_game_servers_list_clusters] + // [START cloud_game_servers_cluster_list] const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -57,7 +57,7 @@ async function main( } listGameServerClusters(); - // [END cloud_game_servers_list_clusters] + // [END cloud_game_servers_cluster_list] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/list_deployments.js b/game-servers/snippets/list_deployments.js index 4c39dbbb9e..d79534ecd0 100644 --- a/game-servers/snippets/list_deployments.js +++ b/game-servers/snippets/list_deployments.js @@ -18,7 +18,7 @@ * @param {string} projectId string project identifier */ async function main(projectId = 'YOUR_PROJECT_ID') { - // [START cloud_game_servers_list_deployments] + // [START cloud_game_servers_deployment_list] const { GameServerDeploymentsServiceClient, } = require('@google-cloud/game-servers'); @@ -49,7 +49,7 @@ async function main(projectId = 'YOUR_PROJECT_ID') { listGameServerDeployments(); - // [END cloud_game_servers_list_deployments] + // [END cloud_game_servers_deployment_list] } main(...process.argv.slice(2)).catch(err => { diff --git a/game-servers/snippets/list_realms.js b/game-servers/snippets/list_realms.js index b3c2253c4c..ded96df687 100644 --- a/game-servers/snippets/list_realms.js +++ b/game-servers/snippets/list_realms.js @@ -19,7 +19,7 @@ * @param {string} location Compute Engine region. */ async function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { - // [START cloud_game_servers_list_realms] + // [START cloud_game_servers_realm_list] const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); @@ -47,7 +47,7 @@ async function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { } listRealms(); - // [END cloud_game_servers_list_realms] + // [END cloud_game_servers_realm_list] } main(...process.argv.slice(2)).catch(err => { From 280fdd5c47937caaa7b798621d875eda29f2bc03 Mon Sep 17 00:00:00 2001 From: pooneh-m <46979170+pooneh-m@users.noreply.github.com> Date: Fri, 24 Jul 2020 09:59:57 -0700 Subject: [PATCH 23/51] Add samples for GameServerConfigs (#98) Co-authored-by: Justin Beckwith --- game-servers/snippets/create_config.js | 144 ++++++++++++++++++ game-servers/snippets/delete_cluster.js | 3 +- game-servers/snippets/delete_config.js | 68 +++++++++ game-servers/snippets/delete_deployment.js | 5 +- game-servers/snippets/get_config.js | 72 +++++++++ game-servers/snippets/list_configs.js | 69 +++++++++ .../snippets/test/crud_config.test.js | 97 ++++++++++++ .../snippets/test/delete_cluster.test.js | 19 +-- 8 files changed, 457 insertions(+), 20 deletions(-) create mode 100644 game-servers/snippets/create_config.js create mode 100644 game-servers/snippets/delete_config.js create mode 100644 game-servers/snippets/get_config.js create mode 100644 game-servers/snippets/list_configs.js create mode 100644 game-servers/snippets/test/crud_config.test.js diff --git a/game-servers/snippets/create_config.js b/game-servers/snippets/create_config.js new file mode 100644 index 0000000000..db1b526157 --- /dev/null +++ b/game-servers/snippets/create_config.js @@ -0,0 +1,144 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Create a Game Servers Config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the parent Game Server Deployment + * @param {string} configId unique identifier for the new Game Server Config + * @param {string} fleetName fleet name to be stored in Agones + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID', + configId = 'CONFIG_ID', + fleetName = 'FLEET_NAME' +) { + // [START cloud_game_servers_config_create] + const { + GameServerConfigsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerConfigsServiceClient(); + + async function createGameServerConfig() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + // const configId = 'A unique ID for the Game Server Config'; + // const fleetName = 'The fleet name to be stored in Agones'; + // fleet is the spec portion of an agones Fleet. It must be in JSON format. + // See https://agones.dev/site/docs/reference/fleet/ for more on fleets. + const fleet = ` +{ + "replicas": 10, + "scheduling": "Packed", + "strategy": { + "type": "RollingUpdate", + "rollingUpdate": { + "maxSurge": "25%", + "maxUnavailable": "25%" + } + }, + "template": { + "metadata": { + "labels": { + "gameName": "udp-server" + } + }, + "spec": { + "ports": [ + { + "name": "default", + "portPolicy": "Dynamic", + "containerPort": 2156, + "protocol": "TCP" + } + ], + "health": { + "initialDelaySeconds": 30, + "periodSeconds": 60 + }, + "sdkServer": { + "logLevel": "Info", + "grpcPort": 9357, + "httpPort": 9358 + }, + "template": { + "spec": { + "containers": [ + { + "name": "dedicated", + "image": "gcr.io/agones-images/udp-server:0.17", + "imagePullPolicy": "Always", + "resources": { + "requests": { + "memory": "200Mi", + "cpu": "500m" + }, + "limits": { + "memory": "200Mi", + "cpu": "500m" + } + } + } + ] + } + } + } + } +} +`; + const request = { + parent: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + configId: configId, + gameServerConfig: { + fleetConfigs: [ + { + name: fleetName, + fleetSpec: fleet, + }, + ], + description: 'nodejs test config', + }, + }; + + const [operation] = await client.createGameServerConfig(request); + const [result] = await operation.promise(); + + console.log('Game Server Config created:'); + console.log(`\t Config name: ${result.name}`); + console.log(`\t Config description: ${result.description}`); + } + + createGameServerConfig(); + + // [END cloud_game_servers_config_create] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/delete_cluster.js b/game-servers/snippets/delete_cluster.js index 7c0b327870..ec1266bc88 100644 --- a/game-servers/snippets/delete_cluster.js +++ b/game-servers/snippets/delete_cluster.js @@ -51,7 +51,8 @@ async function main( ), }; - await client.deleteGameServerCluster(request); + const [operation] = await client.deleteGameServerCluster(request); + await operation.promise(); console.log('Game Server cluster deleted'); } diff --git a/game-servers/snippets/delete_config.js b/game-servers/snippets/delete_config.js new file mode 100644 index 0000000000..b083f29813 --- /dev/null +++ b/game-servers/snippets/delete_config.js @@ -0,0 +1,68 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Delete a Game Servers Config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + * @param {string} configId unique identifier for the new Game Server Config + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID', + configId = 'CONFIG_ID' +) { + // [START cloud_game_servers_config_delete] + const { + GameServerConfigsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerConfigsServiceClient(); + + async function deleteGameServerConfig() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + // const configId = 'A unique ID for the Game Server Config'; + const request = { + // The full resource name + name: client.gameServerConfigPath( + projectId, + 'global', + deploymentId, + configId + ), + }; + + const [operation] = await client.deleteGameServerConfig(request); + await operation.promise(); + console.log(`Config with name ${request.name} deleted.`); + } + + deleteGameServerConfig(); + + // [END cloud_game_servers_config_delete] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/delete_deployment.js b/game-servers/snippets/delete_deployment.js index b85ee6e266..e45b144f50 100644 --- a/game-servers/snippets/delete_deployment.js +++ b/game-servers/snippets/delete_deployment.js @@ -40,9 +40,10 @@ async function main( name: client.gameServerDeploymentPath(projectId, 'global', deploymentId), }; - await client.deleteGameServerDeployment(request); + const [operation] = await client.deleteGameServerDeployment(request); + await operation.promise(); - console.log('deleted.'); + console.log(`Deployment with name ${request.name} deleted.`); } deleteGameServerDeployment(); diff --git a/game-servers/snippets/get_config.js b/game-servers/snippets/get_config.js new file mode 100644 index 0000000000..1272918fec --- /dev/null +++ b/game-servers/snippets/get_config.js @@ -0,0 +1,72 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Get a Game Servers Config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + * @param {string} configId unique identifier for the new Game Server Config + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID', + configId = 'CONFIG_ID' +) { + // [START cloud_game_servers_config_get] + const { + GameServerConfigsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerConfigsServiceClient(); + + async function getGameServerConfig() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + // const configId = 'A unique ID for the Game Server Config'; + const request = { + // The full resource name + name: client.gameServerConfigPath( + projectId, + 'global', + deploymentId, + configId + ), + }; + + const [config] = await client.getGameServerConfig(request); + console.log(`Config name: ${config.name}`); + console.log(`Config description: ${config.description}`); + + const createTime = config.createTime; + const createDate = new Date(createTime.seconds * 1000); + console.log(`Config created on: ${createDate.toLocaleDateString()}\n`); + } + + getGameServerConfig(); + + // [END cloud_game_servers_config_get] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/list_configs.js b/game-servers/snippets/list_configs.js new file mode 100644 index 0000000000..f6a844b50c --- /dev/null +++ b/game-servers/snippets/list_configs.js @@ -0,0 +1,69 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * List all the Game Servers Configs. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_config_list] + const { + GameServerConfigsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerConfigsServiceClient(); + + async function listGameServerConfigs() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + const request = { + parent: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }; + + const [results] = await client.listGameServerConfigs(request); + for (const config of results) { + console.log(`Config name: ${config.name}`); + console.log(`Config description: ${config.description}`); + + const createTime = config.createTime; + const createDate = new Date(createTime.seconds * 1000); + console.log(`Config created on: ${createDate.toLocaleDateString()}\n`); + } + } + + listGameServerConfigs(); + + // [END cloud_game_servers_config_list] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/test/crud_config.test.js b/game-servers/snippets/test/crud_config.test.js new file mode 100644 index 0000000000..d5c533c3d1 --- /dev/null +++ b/game-servers/snippets/test/crud_config.test.js @@ -0,0 +1,97 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, before, after, it} = require('mocha'); +const { + GameServerConfigsServiceClient, + GameServerDeploymentsServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +describe('Game Server Config Test', () => { + const client = new GameServerConfigsServiceClient(); + const deploymentClient = new GameServerDeploymentsServiceClient(); + let deploymentId; + let configId; + let projectId; + + before(async () => { + await cleanup(); + + projectId = await client.getProjectId(); + deploymentId = `test-${uuid.v4()}`; + configId = `test-${uuid.v4()}`; + + const request = { + parent: `projects/${projectId}/locations/global`, + deploymentId: deploymentId, + }; + const [operation] = await deploymentClient.createGameServerDeployment( + request + ); + await operation.promise(); + }); + + it('should create a game server config', async () => { + const create_output = execSync( + `node create_config.js ${projectId} ${deploymentId} ${configId} nodejs_fleet_name` + ); + assert.match(create_output, /Config name:/); + }); + + it('should get a game server config', async () => { + const get_output = execSync( + `node get_config.js ${projectId} ${deploymentId} ${configId}` + ); + assert.match(get_output, /Config name:/); + }); + + it('should list a game server config', async () => { + const list_output = execSync( + `node list_configs.js ${projectId} ${deploymentId} ${configId}` + ); + assert.match(list_output, /Config name:/); + }); + + it('should delete a game server config', async () => { + const delete_output = execSync( + `node delete_config.js ${projectId} ${deploymentId} ${configId}` + ); + assert.match(delete_output, /deleted./); + }); + + after(async () => { + // Delete the Game Server Deployment + const request = { + // Provide full resource name of a Game Server Deployment + name: deploymentClient.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }; + const [operation] = await deploymentClient.deleteGameServerDeployment( + request + ); + await operation.promise(); + }); +}); diff --git a/game-servers/snippets/test/delete_cluster.test.js b/game-servers/snippets/test/delete_cluster.test.js index 832e51737b..d6b2003a41 100644 --- a/game-servers/snippets/test/delete_cluster.test.js +++ b/game-servers/snippets/test/delete_cluster.test.js @@ -87,26 +87,11 @@ describe('Game Servers Delete Cluster Test', () => { }); after(async () => { - // Delete the Game Server cluster - const deleteClusterRequest = { - // Provide full resource name of a Game Server Realm - name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}/gameServerClusters/${gameClusterId}`, - }; - try { - const [operation1] = await gameClustersClient.deleteGameServerCluster( - deleteClusterRequest - ); - await operation1.promise(); - } catch (ex) { - console.log(ex); - console.log(`Realm ID: ${realmId}`); - console.log(`Cluster ID: ${gameClusterId}`); - } // Delete the realm const deleteRealmRequest = { name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, }; - const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); - await operation2.promise(); + const [operation] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation.promise(); }); }); From fc11284acb061f867b86efc3fe25ae9b0fbd6967 Mon Sep 17 00:00:00 2001 From: pooneh-m <46979170+pooneh-m@users.noreply.github.com> Date: Fri, 24 Jul 2020 10:34:08 -0700 Subject: [PATCH 24/51] Add sample for game server rollout (#102) Co-authored-by: Justin Beckwith --- game-servers/snippets/get_rollout.js | 70 ++++++ game-servers/snippets/test/rollout.js | 207 ++++++++++++++++++ .../snippets/update_rollout_default.js | 73 ++++++ .../snippets/update_rollout_override.js | 86 ++++++++ .../snippets/update_rollout_remove_default.js | 70 ++++++ .../update_rollout_remove_override.js | 69 ++++++ 6 files changed, 575 insertions(+) create mode 100644 game-servers/snippets/get_rollout.js create mode 100644 game-servers/snippets/test/rollout.js create mode 100644 game-servers/snippets/update_rollout_default.js create mode 100644 game-servers/snippets/update_rollout_override.js create mode 100644 game-servers/snippets/update_rollout_remove_default.js create mode 100644 game-servers/snippets/update_rollout_remove_override.js diff --git a/game-servers/snippets/get_rollout.js b/game-servers/snippets/get_rollout.js new file mode 100644 index 0000000000..72ba1ff80c --- /dev/null +++ b/game-servers/snippets/get_rollout.js @@ -0,0 +1,70 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Get a Game Servers Rollout. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_rollout_get] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function getGameServerDeploymentRollout() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + const request = { + // The full resource name + name: client.gameServerDeploymentPath(projectId, 'global', deploymentId), + }; + + const [rollout] = await client.getGameServerDeploymentRollout(request); + console.log(`Rollout name: ${rollout.name}`); + console.log(`Rollout default: ${rollout.defaultGameServerConfig}`); + for (const override of rollout.gameServerConfigOverrides) { + console.log(`Rollout config overrides: ${override.configVersion}`); + console.log( + `Rollout realm overrides: ${JSON.stringify(override.realmsSelector)}` + ); + } + + const updateTime = rollout.updateTime; + const updateDate = new Date(updateTime.seconds * 1000); + console.log(`Rollout updated on: ${updateDate.toLocaleDateString()}\n`); + } + + getGameServerDeploymentRollout(); + + // [END cloud_game_servers_rollout_get] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/test/rollout.js b/game-servers/snippets/test/rollout.js new file mode 100644 index 0000000000..975a78f936 --- /dev/null +++ b/game-servers/snippets/test/rollout.js @@ -0,0 +1,207 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, before, after, it} = require('mocha'); +const { + GameServerConfigsServiceClient, + GameServerDeploymentsServiceClient, + RealmsServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +describe('Game Server Rollout Test', () => { + const configClient = new GameServerConfigsServiceClient(); + const deploymentClient = new GameServerDeploymentsServiceClient(); + const realmClient = new RealmsServiceClient(); + let projectId; + const deploymentId = `test-nodejs-${uuid.v4()}`; + const configId = `test-nodejs-${uuid.v4()}`; + const realmId = `test-nodejs-${uuid.v4()}`; + const realmLocation = 'us-central1'; + + before(async () => { + await cleanup(); + + projectId = await deploymentClient.getProjectId(); + + const request = { + parent: `projects/${projectId}/locations/global`, + deploymentId: deploymentId, + }; + const [operation] = await deploymentClient.createGameServerDeployment( + request + ); + await operation.promise(); + + const request2 = { + parent: configClient.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + configId: configId, + }; + const [operation2] = await configClient.createGameServerConfig(request2); + await operation2.promise(); + + const request3 = { + parent: `projects/${projectId}/locations/${realmLocation}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation3] = await realmClient.createRealm(request3); + await operation3.promise(); + }); + + it('should update rollout default', async () => { + const updateDefaultOutput = execSync( + `node update_rollout_default.js ${projectId} ${deploymentId} ${configId}` + ); + + assert.match(updateDefaultOutput, /Deployment updated:/); + + const getRolloutOutput = execSync( + `node get_rollout.js ${projectId} ${deploymentId} ${configId}` + ); + + const configName = configClient.gameServerConfigPath( + projectId, + 'global', + deploymentId, + configId + ); + assert.match(getRolloutOutput, /Rollout name:/); + assert.match( + getRolloutOutput, + new RegExp(`Rollout default: ${configName}`) + ); + }); + + it('should remove rollout default', async () => { + const removeDefaultOutput = execSync( + `node update_rollout_remove_default.js ${projectId} ${deploymentId} ${configId}` + ); + + assert.match(removeDefaultOutput, /Deployment updated:/); + + const request = { + // The full resource name + name: deploymentClient.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }; + + const [rollout] = await deploymentClient.getGameServerDeploymentRollout( + request + ); + assert.strictEqual(rollout.defaultGameServerConfig, ''); + }); + + it('should update rollout override', async () => { + const updateOverrideOutput = execSync( + `node update_rollout_override.js ${projectId} ${deploymentId} ${configId} ${realmId} ${realmLocation}` + ); + assert.match(updateOverrideOutput, /Deployment updated:/); + + const getRolloutOutput = execSync( + `node get_rollout.js ${projectId} ${deploymentId} ${configId}` + ); + + const configName = configClient.gameServerConfigPath( + projectId, + 'global', + deploymentId, + configId + ); + const realmName = realmClient.realmPath(projectId, realmLocation, realmId); + assert.match( + getRolloutOutput, + new RegExp(`Rollout config overrides: .*${configName}`) + ); + assert.match(getRolloutOutput, new RegExp(realmName)); + }); + + it('should remove rollout override', async () => { + const removeOverrideOutput = execSync( + `node update_rollout_remove_override.js ${projectId} ${deploymentId}` + ); + + assert.match(removeOverrideOutput, /Deployment updated:/); + + const request = { + // The full resource name + name: deploymentClient.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }; + + const [rollout] = await deploymentClient.getGameServerDeploymentRollout( + request + ); + assert.strictEqual(rollout.gameServerConfigOverrides.length, 0); + }); + + after(async () => { + // Delete the Game Server Config + const request = { + // Provide full resource name of a Game Server Config + name: configClient.gameServerConfigPath( + projectId, + 'global', + deploymentId, + configId + ), + }; + const [operation] = await configClient.deleteGameServerConfig(request); + await operation.promise(); + + // Delete the Game Server Deployment + const request2 = { + // Provide full resource name of a Game Server Deployment + name: deploymentClient.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }; + const [operation2] = await deploymentClient.deleteGameServerDeployment( + request2 + ); + await operation2.promise(); + + // Delete the Realm + const request3 = { + // Provide full resource name of a Realm + name: realmClient.realmPath(projectId, realmLocation, realmId), + }; + const [operation3] = await realmClient.deleteRealm(request3); + await operation3.promise(); + }); +}); diff --git a/game-servers/snippets/update_rollout_default.js b/game-servers/snippets/update_rollout_default.js new file mode 100644 index 0000000000..1aa9edf372 --- /dev/null +++ b/game-servers/snippets/update_rollout_default.js @@ -0,0 +1,73 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Rollout update to add default config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + * @param {string} configId unique identifier for the new Game Server Config + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID', + configId = 'CONFIG_ID' +) { + // [START cloud_game_servers_deployment_rollout_default] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function rolloutDefaultGameServerDeployment() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + // const configId = 'A unique ID for the Game Server Config'; + const request = { + rollout: { + name: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + defaultGameServerConfig: configId, + }, + updateMask: { + paths: ['default_game_server_config'], + }, + }; + + const [operation] = await client.updateGameServerDeploymentRollout(request); + const [deployment] = await operation.promise(); + + console.log(`Deployment updated: ${deployment.name}`); + } + + rolloutDefaultGameServerDeployment(); + + // [END cloud_game_servers_deployment_rollout_default] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/update_rollout_override.js b/game-servers/snippets/update_rollout_override.js new file mode 100644 index 0000000000..ee27d4b738 --- /dev/null +++ b/game-servers/snippets/update_rollout_override.js @@ -0,0 +1,86 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Rollout update to add override config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + * @param {string} configId unique identifier for the new Game Server Config + * @param {string} realmId the unique ID of the realm + * @param {string} realmLocation Compute Engine region for realm location. + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID', + configId = 'CONFIG_ID', + realmId = 'REALM_ID', + realmLocation = 'REALM_LOCATION' +) { + // [START cloud_game_servers_deployment_rollout_override] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function rolloutGameServerDeploymentOverride() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + // const configId = 'A unique ID for the Game Server Config'; + // const realmId = 'A unique ID for the realm' + // const realmLocation = 'compute engine region for realm location' + const request = { + rollout: { + name: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + gameServerConfigOverrides: [ + { + realmsSelector: { + realms: [client.realmPath(projectId, realmLocation, realmId)], + }, + configVersion: configId, + }, + ], + }, + updateMask: { + paths: ['game_server_config_overrides'], + }, + }; + + const [operation] = await client.updateGameServerDeploymentRollout(request); + const [deployment] = await operation.promise(); + + console.log(`Deployment updated: ${deployment.name}`); + } + + rolloutGameServerDeploymentOverride(); + + // [END cloud_game_servers_deployment_rollout_override] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/update_rollout_remove_default.js b/game-servers/snippets/update_rollout_remove_default.js new file mode 100644 index 0000000000..7584a00bfc --- /dev/null +++ b/game-servers/snippets/update_rollout_remove_default.js @@ -0,0 +1,70 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Rollout update to remove default config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_deployment_rollout_remove_default] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function removeRolloutDefaultGameServerDeployment() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + const request = { + rollout: { + name: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + defaultGameServerConfig: '', + }, + updateMask: { + paths: ['default_game_server_config'], + }, + }; + + const [operation] = await client.updateGameServerDeploymentRollout(request); + const [deployment] = await operation.promise(); + + console.log(`Deployment updated: ${deployment.name}`); + } + + removeRolloutDefaultGameServerDeployment(); + + // [END cloud_game_servers_deployment_rollout_remove_default] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/update_rollout_remove_override.js b/game-servers/snippets/update_rollout_remove_override.js new file mode 100644 index 0000000000..031e950c01 --- /dev/null +++ b/game-servers/snippets/update_rollout_remove_override.js @@ -0,0 +1,69 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Rollout update to remove override config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_deployment_rollout_remove_override] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function removeRolloutGameServerDeploymentOverride() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'A unique ID for the Game Server Deployment'; + const request = { + rollout: { + name: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }, + updateMask: { + paths: ['game_server_config_overrides'], + }, + }; + + const [operation] = await client.updateGameServerDeploymentRollout(request); + const [deployment] = await operation.promise(); + + console.log(`Deployment updated: ${deployment.name}`); + } + + removeRolloutGameServerDeploymentOverride(); + + // [END cloud_game_servers_deployment_rollout_remove_override] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); From 88e03b8d9b6aeebb21ac903869288aa0d3c75304 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2020 13:25:11 -0700 Subject: [PATCH 25/51] chore: release 2.1.0 (#110) --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index d6364f03a0..c3fcc34a9d 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.0.2" + "@google-cloud/game-servers": "^2.1.0" }, "devDependencies": { "c8": "^7.2.1", From 7888188c7e6a84c1dbbc66ddbb497d2a543e9065 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 11 Nov 2020 12:53:46 -0800 Subject: [PATCH 26/51] chore: release 2.1.1 (#133) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index c3fcc34a9d..0fa8ddcac8 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.1.0" + "@google-cloud/game-servers": "^2.1.1" }, "devDependencies": { "c8": "^7.2.1", From 53d0d7c6bc634fc7f443e0e83ef1bdc641c5ef1d Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 2 Dec 2020 19:40:31 +0000 Subject: [PATCH 27/51] chore: release 2.1.2 (#137) :robot: I have created a release \*beep\* \*boop\* --- ### [2.1.2](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.1.1...v2.1.2) (2020-11-25) ### Bug Fixes * **browser:** check for fetch on window ([#136](https://www.github.com/googleapis/nodejs-game-servers/issues/136)) ([3c28ff7](https://www.github.com/googleapis/nodejs-game-servers/commit/3c28ff7c610caf58df0dfbd4b3acd2954ae7f019)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 0fa8ddcac8..c90597a47a 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.1.1" + "@google-cloud/game-servers": "^2.1.2" }, "devDependencies": { "c8": "^7.2.1", From e4836ee91b2d365dbacb353761dfd0d0a6d0b8c2 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 12 Jan 2021 18:36:19 +0000 Subject: [PATCH 28/51] chore: release 2.2.0 (#143) :robot: I have created a release \*beep\* \*boop\* --- ## [2.2.0](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.1.2...v2.2.0) (2021-01-09) ### Features * adds style enumeration ([#142](https://www.github.com/googleapis/nodejs-game-servers/issues/142)) ([59f7332](https://www.github.com/googleapis/nodejs-game-servers/commit/59f7332fee754b11e8a395d19013cc78351e5659)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index c90597a47a..e898dd45b9 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.1.2" + "@google-cloud/game-servers": "^2.2.0" }, "devDependencies": { "c8": "^7.2.1", From 034c46ce719e2457095aaeb306f47f8e0c24405b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 16:22:19 -0800 Subject: [PATCH 29/51] chore: release 2.3.0 (#148) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index e898dd45b9..39fa4d8023 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.2.0" + "@google-cloud/game-servers": "^2.3.0" }, "devDependencies": { "c8": "^7.2.1", From 16732775a777c4749f6ae7f83618ec2c1bc1a9d6 Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Mon, 17 May 2021 17:45:33 -0700 Subject: [PATCH 30/51] chore: migrate to owl bot (#153) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: migrate to owl bot * chore: copy files from googleapis-gen fb91803ccef5d7c695139b22788b309e2197856b * chore: run the post processor * 🦉 Updates from OwlBot * fix: help tests pass * 🦉 Updates from OwlBot * update Docker image * 🦉 Updates from OwlBot Co-authored-by: Owl Bot Co-authored-by: Sofia Leon --- game-servers/snippets/test/clean.js | 14 ++++++-------- game-servers/snippets/test/list_clusters.test.js | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/game-servers/snippets/test/clean.js b/game-servers/snippets/test/clean.js index cf62661619..bed48b96ca 100644 --- a/game-servers/snippets/test/clean.js +++ b/game-servers/snippets/test/clean.js @@ -42,20 +42,18 @@ module.exports = async () => { parent: realm.name, }; - const clustersResult = await gameServerClusterClient.listGameServerClusters( - clustersRequest - ); + const clustersResult = + await gameServerClusterClient.listGameServerClusters(clustersRequest); const [clusters] = clustersResult; for (const cluster of clusters) { const deleteClusterRequest = { name: cluster.name, }; - const [ - deleteClusterOperation, - ] = await gameServerClusterClient.deleteGameServerCluster( - deleteClusterRequest - ); + const [deleteClusterOperation] = + await gameServerClusterClient.deleteGameServerCluster( + deleteClusterRequest + ); await deleteClusterOperation.promise(); } diff --git a/game-servers/snippets/test/list_clusters.test.js b/game-servers/snippets/test/list_clusters.test.js index b32b7ed245..419e138fb8 100644 --- a/game-servers/snippets/test/list_clusters.test.js +++ b/game-servers/snippets/test/list_clusters.test.js @@ -79,7 +79,7 @@ describe('Game Servers List Clusters Test', () => { await operation2.promise(); }); - it('should list Game Server clusters in a realm', async () => { + it.only('should list Game Server clusters in a realm', async () => { const projectId = await realmsClient.getProjectId(); const create_output = execSync( From 74b48a7a0fede5b4391d8e90b72faf425c386c64 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 20 May 2021 00:56:04 +0000 Subject: [PATCH 31/51] chore: release 2.3.1 (#163) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.1](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.0...v2.3.1) (2021-05-20) ### Bug Fixes * **deps:** require google-gax v2.12.0 ([#162](https://www.github.com/googleapis/nodejs-game-servers/issues/162)) ([546c13d](https://www.github.com/googleapis/nodejs-game-servers/commit/546c13d64abedafd055fad9c118d58750f0f9f25)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 39fa4d8023..b120a2ad55 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.0" + "@google-cloud/game-servers": "^2.3.1" }, "devDependencies": { "c8": "^7.2.1", From acb1cdc2807f39c92b66332ee9adb57662769fce Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 24 May 2021 23:10:02 +0000 Subject: [PATCH 32/51] chore: release 2.3.2 (#173) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.2](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.1...v2.3.2) (2021-05-24) ### Bug Fixes * use require() to load JSON protos ([#164](https://www.github.com/googleapis/nodejs-game-servers/issues/164)) ([b77e1e5](https://www.github.com/googleapis/nodejs-game-servers/commit/b77e1e5f7fc9396cdb30d4f1bfac370dd85800b8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index b120a2ad55..639c3a8d8b 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.1" + "@google-cloud/game-servers": "^2.3.2" }, "devDependencies": { "c8": "^7.2.1", From 21c26e76792151f6d4d3160bd91e3f2f73123dc0 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 10 Jun 2021 00:34:05 +0000 Subject: [PATCH 33/51] chore: release 2.3.3 (#180) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.3](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.2...v2.3.3) (2021-06-10) ### Bug Fixes * GoogleAdsError missing using generator version after 1.3.0 ([#175](https://www.github.com/googleapis/nodejs-game-servers/issues/175)) ([a0df035](https://www.github.com/googleapis/nodejs-game-servers/commit/a0df03530d0dc438c8c4318854fbcfa8d7752f8d)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 639c3a8d8b..84cd65e15f 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.2" + "@google-cloud/game-servers": "^2.3.3" }, "devDependencies": { "c8": "^7.2.1", From 06073a66d8c83b135429b515aeb0b142cf58f5cb Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 22 Jun 2021 20:40:43 +0000 Subject: [PATCH 34/51] chore: release 2.3.4 (#187) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.4](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.3...v2.3.4) (2021-06-22) ### Bug Fixes * make request optional in all cases ([#186](https://www.github.com/googleapis/nodejs-game-servers/issues/186)) ([99424ec](https://www.github.com/googleapis/nodejs-game-servers/commit/99424ecd0f87341bd4814cdbe092d2820c9a78d7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 84cd65e15f..1d19919d30 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.3" + "@google-cloud/game-servers": "^2.3.4" }, "devDependencies": { "c8": "^7.2.1", From b243b40798c7349e30efddd09ea855b2c95cfafa Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 29 Jun 2021 17:02:27 +0000 Subject: [PATCH 35/51] chore: release 2.3.5 (#193) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.5](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.4...v2.3.5) (2021-06-29) ### Bug Fixes * **deps:** google-gax v2.17.0 with mTLS ([#192](https://www.github.com/googleapis/nodejs-game-servers/issues/192)) ([4d37a74](https://www.github.com/googleapis/nodejs-game-servers/commit/4d37a7497ebe77cbfabc5e2bb0ea925e7ac138bb)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 1d19919d30..61df81ac9d 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.4" + "@google-cloud/game-servers": "^2.3.5" }, "devDependencies": { "c8": "^7.2.1", From a74409eda248b8d0e3e2ed7407d41a3edff58da7 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 12 Jul 2021 22:04:22 +0000 Subject: [PATCH 36/51] chore: release 2.3.6 (#197) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.6](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.5...v2.3.6) (2021-07-12) ### Bug Fixes * **deps:** google-gax v2.17.1 ([#196](https://www.github.com/googleapis/nodejs-game-servers/issues/196)) ([5a65e3f](https://www.github.com/googleapis/nodejs-game-servers/commit/5a65e3f4398667b2aba2295088c1cc0e2ecf0a8c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 61df81ac9d..ab077b18bb 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.5" + "@google-cloud/game-servers": "^2.3.6" }, "devDependencies": { "c8": "^7.2.1", From 5279fddd31773907c338ab5b7bfb664ec29a2737 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 16 Jul 2021 12:53:10 -0700 Subject: [PATCH 37/51] chore: release 2.3.7 (#199) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index ab077b18bb..bcb0f98605 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.6" + "@google-cloud/game-servers": "^2.3.7" }, "devDependencies": { "c8": "^7.2.1", From 9629897ed3ddd6a9afcfe409f2fb904113e7b60f Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 17:20:26 +0000 Subject: [PATCH 38/51] chore: release 2.3.8 (#207) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.8](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.7...v2.3.8) (2021-08-17) ### Bug Fixes * **build:** migrate to using main branch ([#206](https://www.github.com/googleapis/nodejs-game-servers/issues/206)) ([04998bf](https://www.github.com/googleapis/nodejs-game-servers/commit/04998bf4f24613792beb12fff9d1a14da795b74b)) * **deps:** google-gax v2.24.1 ([#208](https://www.github.com/googleapis/nodejs-game-servers/issues/208)) ([8462da4](https://www.github.com/googleapis/nodejs-game-servers/commit/8462da415e3df130356f70e34f97698628f48b2b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index bcb0f98605..ffba77a5fb 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.7" + "@google-cloud/game-servers": "^2.3.8" }, "devDependencies": { "c8": "^7.2.1", From 24a6f069158caaa605d4a2a1d6cf9d1b7823c18e Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 24 Aug 2021 08:31:08 -0700 Subject: [PATCH 39/51] chore: release 2.4.0 (#210) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index ffba77a5fb..5955bdb378 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.8" + "@google-cloud/game-servers": "^2.4.0" }, "devDependencies": { "c8": "^7.2.1", From 6460884fdd38b5b5e605c44842f08df2f04fc76c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 30 Aug 2021 10:58:41 -0500 Subject: [PATCH 40/51] chore: release 2.5.0 (#214) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 5955bdb378..2ea3f59a0b 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.4.0" + "@google-cloud/game-servers": "^2.5.0" }, "devDependencies": { "c8": "^7.2.1", From 9c82bace9f2802208ed0509864aee9bf4a8f34dd Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Wed, 1 Sep 2021 17:20:28 -0700 Subject: [PATCH 41/51] chore: show cluster installation state details for get and list methods (#216) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [X] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/nodejs-game-servers/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [X] Ensure the tests and linter pass - [X] Code coverage does not decrease (if any source code was changed) - [X] Appropriate docs were updated (if necessary) Fixes b:179738605 🦕 --- game-servers/snippets/get_cluster.js | 10 ++++++++++ game-servers/snippets/list_clusters.js | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/game-servers/snippets/get_cluster.js b/game-servers/snippets/get_cluster.js index cbe3ee4641..8701ac805b 100644 --- a/game-servers/snippets/get_cluster.js +++ b/game-servers/snippets/get_cluster.js @@ -49,6 +49,7 @@ async function main( realmId, gameClusterId ), + view: 'FULL', }; const [cluster] = await client.getGameServerCluster(request); @@ -56,6 +57,15 @@ async function main( console.log('Game Server Cluster:'); console.log(`\tCluster name: ${cluster.name}`); console.log(`\tCluster description: ${cluster.description}`); + console.log( + `\tCluster installed Agones version: ${cluster.clusterState.agonesVersionInstalled}` + ); + console.log( + `\tCluster installed Kubernetes version: ${cluster.clusterState.kubernetesVersionInstalled}` + ); + console.log( + `\tCluster installation state: ${cluster.clusterState.installationState}` + ); console.log( `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` ); diff --git a/game-servers/snippets/list_clusters.js b/game-servers/snippets/list_clusters.js index 5a8d92a819..c73a7f0d26 100644 --- a/game-servers/snippets/list_clusters.js +++ b/game-servers/snippets/list_clusters.js @@ -41,6 +41,7 @@ async function main( const request = { // Provide full resource name of a Game Server Realm parent: client.realmPath(projectId, location, realmId), + view: 'FULL', }; const results = await client.listGameServerClusters(request); @@ -50,6 +51,15 @@ async function main( console.log('Game Server Cluster:'); console.log(`\tCluster name: ${cluster.name}`); console.log(`\tCluster description: ${cluster.description}`); + console.log( + `\tCluster installed Agones version: ${cluster.clusterState.agonesVersionInstalled}` + ); + console.log( + `\tCluster installed Kubernetes version: ${cluster.clusterState.kubernetesVersionInstalled}` + ); + console.log( + `\tCluster installation state: ${cluster.clusterState.installationState}` + ); console.log( `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` ); From 4ab00d4b5130e69c2194cd4baf1330d69e7c5111 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 28 Sep 2021 23:36:33 +0000 Subject: [PATCH 42/51] docs(samples): add auto-generated samples for Node with api short name in region tag (#221) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 399287285 Source-Link: https://github.com/googleapis/googleapis/commit/15759865d1c54e3d46429010f7e472fe6c3d3715 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b27fff623a5d8d586b703b5e4919856abe7c2eb3 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9 --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 2ea3f59a0b..589bce6b6a 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=8" + "node": ">=10" }, "files": [ "*.js" From c6dc56c49fb74c9e12e5084d072692894483ca5d Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Thu, 18 Nov 2021 10:07:03 -0800 Subject: [PATCH 43/51] docs: add update samples (#230) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add update samples * Address feedback * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../snippets/test/crud_deployment.test.js | 11 ++ .../snippets/test/list_clusters.test.js | 2 +- .../snippets/test/update_cluster_test.js | 115 ++++++++++++++++++ .../snippets/test/update_realm_test.js | 70 +++++++++++ game-servers/snippets/update_cluster.js | 80 ++++++++++++ game-servers/snippets/update_deployment.js | 73 +++++++++++ game-servers/snippets/update_realm.js | 71 +++++++++++ 7 files changed, 421 insertions(+), 1 deletion(-) create mode 100644 game-servers/snippets/test/update_cluster_test.js create mode 100644 game-servers/snippets/test/update_realm_test.js create mode 100644 game-servers/snippets/update_cluster.js create mode 100644 game-servers/snippets/update_deployment.js create mode 100644 game-servers/snippets/update_realm.js diff --git a/game-servers/snippets/test/crud_deployment.test.js b/game-servers/snippets/test/crud_deployment.test.js index 229c5c0f8e..5dd7218b30 100644 --- a/game-servers/snippets/test/crud_deployment.test.js +++ b/game-servers/snippets/test/crud_deployment.test.js @@ -45,11 +45,22 @@ describe('Game Server Deployment Test', () => { assert.match(create_output, /Deployment name:/); }); + it('should update a game server deployment', async () => { + const update_output = execSync( + `node update_deployment.js ${projectId} ${deploymentId}` + ); + assert.match(update_output, /Deployment updated:/); + }); + it('should get a game server deployment', async () => { const get_output = execSync( `node get_deployment.js ${projectId} ${deploymentId}` ); assert.match(get_output, /Deployment name:/); + assert.match( + get_output, + /Deployment description: My updated Game Server deployment/ + ); }); it('should list a game server deployment', async () => { diff --git a/game-servers/snippets/test/list_clusters.test.js b/game-servers/snippets/test/list_clusters.test.js index 419e138fb8..b32b7ed245 100644 --- a/game-servers/snippets/test/list_clusters.test.js +++ b/game-servers/snippets/test/list_clusters.test.js @@ -79,7 +79,7 @@ describe('Game Servers List Clusters Test', () => { await operation2.promise(); }); - it.only('should list Game Server clusters in a realm', async () => { + it('should list Game Server clusters in a realm', async () => { const projectId = await realmsClient.getProjectId(); const create_output = execSync( diff --git a/game-servers/snippets/test/update_cluster_test.js b/game-servers/snippets/test/update_cluster_test.js new file mode 100644 index 0000000000..7eadb4b428 --- /dev/null +++ b/game-servers/snippets/test/update_cluster_test.js @@ -0,0 +1,115 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const { + RealmsServiceClient, + GameServerClustersServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; +const GKE_CLUSTER_NAME = + process.env.SAMPLE_CLUSTER_NAME || + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; + +describe('Game Servers Update Cluster Test', () => { + const realmsClient = new RealmsServiceClient(); + const gameClustersClient = new GameServerClustersServiceClient(); + let realmId, gameClusterId, projectId; + + before(async () => { + await cleanup(); + + // Create a realm + projectId = await realmsClient.getProjectId(); + realmId = `update-realm-${uuid.v4()}`; + gameClusterId = `test-${uuid.v4()}`; + + const createRealmRequest = { + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation1] = await realmsClient.createRealm(createRealmRequest); + await operation1.promise(); + + // Create a cluster + const createClusterRequest = { + parent: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + gameServerClusterId: gameClusterId, + gameServerCluster: { + description: 'My Game Server Cluster', + connectionInfo: { + gkeClusterReference: { + // Provide full resource name of a Kubernetes Engine cluster + cluster: GKE_CLUSTER_NAME, + }, + namespace: 'default', + }, + }, + }; + + const [operation2] = await gameClustersClient.createGameServerCluster( + createClusterRequest + ); + await operation2.promise(); + }); + + it('should update a Game Server cluster in a realm', async () => { + const update_output = execSync( + `node update_cluster.js ${projectId} ${LOCATION} ${realmId} ${gameClusterId}` + ); + assert.match(update_output, /Cluster updated:/); + + const get_output = execSync( + `node get_cluster.js ${projectId} ${LOCATION} ${realmId} ${gameClusterId}` + ); + assert.match( + get_output, + /Cluster description: My updated Game Server Cluster/ + ); + }); + + after(async () => { + // Delete the Game Server cluster + const deleteClusterRequest = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + const [operation1] = await gameClustersClient.deleteGameServerCluster( + deleteClusterRequest + ); + await operation1.promise(); + + // Delete the realm + const deleteRealmRequest = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation2.promise(); + }); +}); diff --git a/game-servers/snippets/test/update_realm_test.js b/game-servers/snippets/test/update_realm_test.js new file mode 100644 index 0000000000..f55ae28291 --- /dev/null +++ b/game-servers/snippets/test/update_realm_test.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers Update Realms Test', () => { + const client = new RealmsServiceClient(); + let realmId, projectId; + + before(async () => { + projectId = await client.getProjectId(); + + // Clean up any stray realms + await cleanup(); + + realmId = `test-${uuid.v4()}`; + + await client.createRealm({ + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Realm', + }, + }); + }); + + it('should update a realm', async () => { + const update_output = execSync( + `node update_realm.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(update_output, /Realm updated:/); + + const get_output = execSync( + `node get_realm.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(get_output, /Realm description: My updated Game Server realm/); + }); + + after(async () => { + const request = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation] = await client.deleteRealm(request); + await operation.promise(); + }); +}); diff --git a/game-servers/snippets/update_cluster.js b/game-servers/snippets/update_cluster.js new file mode 100644 index 0000000000..b07342fc39 --- /dev/null +++ b/game-servers/snippets/update_cluster.js @@ -0,0 +1,80 @@ +// Copyright 2021, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Update a Game Servers cluster. + * @param {string} projectId string project identifier + * @param {string} location Compute Engine region for the realm + * @param {string} realmId the realm to use + * @param {string} gameClusterId unique identifier for the Game Cluster + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID', + gameClusterId = 'GAME_CLUSTER_ID' +) { + // [START cloud_game_servers_cluster_update] + const { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function updateGameServerCluster() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm of this cluster'; + // const gameClusterId = 'A unique ID for this Game Server Cluster'; + const request = { + // Provide full resource name of a Game Server Cluster + gameServerCluster: { + name: client.gameServerClusterPath( + projectId, + location, + realmId, + gameClusterId + ), + labels: { + 'label-key-1': 'label-value-1', + }, + description: 'My updated Game Server Cluster', + }, + updateMask: { + paths: ['labels', 'description'], + }, + }; + + const [operation] = await client.updateGameServerCluster(request); + const [result] = await operation.promise(); + + console.log(`Cluster updated: ${result.name}`); + } + + updateGameServerCluster(); + // [END cloud_game_servers_cluster_update] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/update_deployment.js b/game-servers/snippets/update_deployment.js new file mode 100644 index 0000000000..dde260eacf --- /dev/null +++ b/game-servers/snippets/update_deployment.js @@ -0,0 +1,73 @@ +// Copyright 2021, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Update a Game Servers Deployment. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_deployment_update] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function updateGameServerDeployment() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'The unique ID for the Game Server Deployment'; + const request = { + gameServerDeployment: { + name: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + labels: { + 'label-key-1': 'label-value-1', + }, + description: 'My updated Game Server deployment', + }, + updateMask: { + paths: ['labels', 'description'], + }, + }; + + const [operation] = await client.updateGameServerDeployment(request); + const [result] = await operation.promise(); + + console.log(`Deployment updated: ${result.name}`); + } + + updateGameServerDeployment(); + + // [END cloud_game_servers_deployment_update] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/game-servers/snippets/update_realm.js b/game-servers/snippets/update_realm.js new file mode 100644 index 0000000000..ffdd19a817 --- /dev/null +++ b/game-servers/snippets/update_realm.js @@ -0,0 +1,71 @@ +// Copyright 2021, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Update a Game Servers realm. + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + * @param {string} realmId unique identifier for the realm + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_realm_update] + const {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function updateRealm() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The unique identifier for the realm'; + const request = { + realm: { + name: client.realmPath(projectId, location, realmId), + labels: { + 'label-key-1': 'label-value-1', + }, + timeZone: 'US/Pacific', + description: 'My updated Game Server realm', + }, + updateMask: { + paths: ['labels', 'time_zone', 'description'], + }, + }; + + const [operation] = await client.updateRealm(request); + const results = await operation.promise(); + const [realm] = results; + + console.log(`Realm updated: ${realm.name}`); + } + + updateRealm(); + // [END cloud_game_servers_realm_update] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); From 0e04fdadcf8d1c9274b691c990e805c9f3857452 Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Mon, 16 May 2022 17:35:19 -0700 Subject: [PATCH 44/51] build!: update library to use Node 12 (#266) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 589bce6b6a..fb42c43aee 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=10" + "node": ">=12.0.0" }, "files": [ "*.js" From d0182928efa2ade66f150487d00c5e4d070f36b4 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 17 May 2022 17:04:19 -0700 Subject: [PATCH 45/51] chore(main): release 3.0.0 (#267) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index fb42c43aee..6efa1c0e16 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.5.0" + "@google-cloud/game-servers": "^3.0.0" }, "devDependencies": { "c8": "^7.2.1", From 2f6b00d8f6c4884641e65e5d363e1038295819db Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 5 Jul 2022 11:21:16 -0400 Subject: [PATCH 46/51] chore(main): release 3.1.0 (#272) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 6efa1c0e16..1a9843e3a4 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^3.0.0" + "@google-cloud/game-servers": "^3.1.0" }, "devDependencies": { "c8": "^7.2.1", From 189fb360ad8fa5d99abcb9f28a12dc9fce303854 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Jul 2022 13:32:03 -0700 Subject: [PATCH 47/51] build: do not test if service is unavailable (#275) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build: do not test if service is unavailable * 🦉 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 --- game-servers/snippets/test/rollout.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/game-servers/snippets/test/rollout.js b/game-servers/snippets/test/rollout.js index 975a78f936..c2bbb53c35 100644 --- a/game-servers/snippets/test/rollout.js +++ b/game-servers/snippets/test/rollout.js @@ -162,9 +162,18 @@ describe('Game Server Rollout Test', () => { ), }; - const [rollout] = await deploymentClient.getGameServerDeploymentRollout( - request - ); + let rollout; + try { + [rollout] = await deploymentClient.getGameServerDeploymentRollout( + request + ); + } catch (err) { + if (err.message.includes(/The service is currently unavailable/)) { + return; + } + throw err; + } + assert.strictEqual(rollout.gameServerConfigOverrides.length, 0); }); From 712e0d0ccb00f9e7e5baed908e96a08c9dbd7ce7 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 7 Sep 2022 17:55:06 -0400 Subject: [PATCH 48/51] chore(main): release 3.1.1 (#307) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 1a9843e3a4..43808d1bbe 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^3.1.0" + "@google-cloud/game-servers": "^3.1.1" }, "devDependencies": { "c8": "^7.2.1", From 909231d0653d83995fb7d068fe8b0b7d3ca92707 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 9 Sep 2022 01:26:20 +0200 Subject: [PATCH 49/51] chore(deps): update dependency uuid to v9 (#312) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [uuid](https://togithub.com/uuidjs/uuid) | [`^8.0.0` -> `^9.0.0`](https://renovatebot.com/diffs/npm/uuid/8.3.2/9.0.0) | [![age](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/compatibility-slim/8.3.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/confidence-slim/8.3.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
uuidjs/uuid ### [`v9.0.0`](https://togithub.com/uuidjs/uuid/blob/HEAD/CHANGELOG.md#​900-httpsgithubcomuuidjsuuidcomparev832v900-2022-09-05) [Compare Source](https://togithub.com/uuidjs/uuid/compare/v8.3.2...v9.0.0) ##### ⚠ BREAKING CHANGES - Drop Node.js 10.x support. This library always aims at supporting one EOLed LTS release which by this time now is 12.x which has reached EOL 30 Apr 2022. - Remove the minified UMD build from the package. Minified code is hard to audit and since this is a widely used library it seems more appropriate nowadays to optimize for auditability than to ship a legacy module format that, at best, serves educational purposes nowadays. For production browser use cases, users should be using a bundler. For educational purposes, today's online sandboxes like replit.com offer convenient ways to load npm modules, so the use case for UMD through repos like UNPKG or jsDelivr has largely vanished. - Drop IE 11 and Safari 10 support. Drop support for browsers that don't correctly implement const/let and default arguments, and no longer transpile the browser build to ES2015. This also removes the fallback on msCrypto instead of the crypto API. Browser tests are run in the first supported version of each supported browser and in the latest (as of this commit) version available on Browserstack. ##### Features - optimize uuid.v1 by 1.3x uuid.v4 by 4.3x (430%) ([#​597](https://togithub.com/uuidjs/uuid/issues/597)) ([3a033f6](https://togithub.com/uuidjs/uuid/commit/3a033f6bab6bb3780ece6d645b902548043280bc)) - remove UMD build ([#​645](https://togithub.com/uuidjs/uuid/issues/645)) ([e948a0f](https://togithub.com/uuidjs/uuid/commit/e948a0f22bf22f4619b27bd913885e478e20fe6f)), closes [#​620](https://togithub.com/uuidjs/uuid/issues/620) - use native crypto.randomUUID when available ([#​600](https://togithub.com/uuidjs/uuid/issues/600)) ([c9e076c](https://togithub.com/uuidjs/uuid/commit/c9e076c852edad7e9a06baaa1d148cf4eda6c6c4)) ##### Bug Fixes - add Jest/jsdom compatibility ([#​642](https://togithub.com/uuidjs/uuid/issues/642)) ([16f9c46](https://togithub.com/uuidjs/uuid/commit/16f9c469edf46f0786164cdf4dc980743984a6fd)) - change default export to named function ([#​545](https://togithub.com/uuidjs/uuid/issues/545)) ([c57bc5a](https://togithub.com/uuidjs/uuid/commit/c57bc5a9a0653273aa639cda9177ce52efabe42a)) - handle error when parameter is not set in v3 and v5 ([#​622](https://togithub.com/uuidjs/uuid/issues/622)) ([fcd7388](https://togithub.com/uuidjs/uuid/commit/fcd73881692d9fabb63872576ba28e30ff852091)) - run npm audit fix ([#​644](https://togithub.com/uuidjs/uuid/issues/644)) ([04686f5](https://togithub.com/uuidjs/uuid/commit/04686f54c5fed2cfffc1b619f4970c4bb8532353)) - upgrading from uuid3 broken link ([#​568](https://togithub.com/uuidjs/uuid/issues/568)) ([1c849da](https://togithub.com/uuidjs/uuid/commit/1c849da6e164259e72e18636726345b13a7eddd6)) ##### build - drop Node.js 8.x from babel transpile target ([#​603](https://togithub.com/uuidjs/uuid/issues/603)) ([aa11485](https://togithub.com/uuidjs/uuid/commit/aa114858260402107ec8a1e1a825dea0a259bcb5)) - drop support for legacy browsers (IE11, Safari 10) ([#​604](https://togithub.com/uuidjs/uuid/issues/604)) ([0f433e5](https://togithub.com/uuidjs/uuid/commit/0f433e5ec444edacd53016de67db021102f36148)) - drop node 10.x to upgrade dev dependencies ([#​653](https://togithub.com/uuidjs/uuid/issues/653)) ([28a5712](https://togithub.com/uuidjs/uuid/commit/28a571283f8abda6b9d85e689f95b7d3ee9e282e)), closes [#​643](https://togithub.com/uuidjs/uuid/issues/643) ##### [8.3.2](https://togithub.com/uuidjs/uuid/compare/v8.3.1...v8.3.2) (2020-12-08) ##### Bug Fixes - lazy load getRandomValues ([#​537](https://togithub.com/uuidjs/uuid/issues/537)) ([16c8f6d](https://togithub.com/uuidjs/uuid/commit/16c8f6df2f6b09b4d6235602d6a591188320a82e)), closes [#​536](https://togithub.com/uuidjs/uuid/issues/536) ##### [8.3.1](https://togithub.com/uuidjs/uuid/compare/v8.3.0...v8.3.1) (2020-10-04) ##### Bug Fixes - support expo>=39.0.0 ([#​515](https://togithub.com/uuidjs/uuid/issues/515)) ([c65a0f3](https://togithub.com/uuidjs/uuid/commit/c65a0f3fa73b901959d638d1e3591dfacdbed867)), closes [#​375](https://togithub.com/uuidjs/uuid/issues/375)
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **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. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-game-servers). --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 43808d1bbe..0575371282 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -19,6 +19,6 @@ "c8": "^7.2.1", "chai": "^4.2.0", "mocha": "^8.0.0", - "uuid": "^8.0.0" + "uuid": "^9.0.0" } } From bae504b32a2856852dc19a7ea9968943a26ccd13 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 22 Sep 2022 14:24:02 -0700 Subject: [PATCH 50/51] chore(main): release 3.1.2 (#314) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game-servers/snippets/package.json b/game-servers/snippets/package.json index 0575371282..e9d4c3a6e8 100644 --- a/game-servers/snippets/package.json +++ b/game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^3.1.1" + "@google-cloud/game-servers": "^3.1.2" }, "devDependencies": { "c8": "^7.2.1", From 15d7bc3b5edee1019f54dd53346b99c824d6168c Mon Sep 17 00:00:00 2001 From: Patti Shin Date: Wed, 9 Nov 2022 16:04:44 -0800 Subject: [PATCH 51/51] chore: generate new workflow for migrating game-servers samples --- .../workflows/apengine-metadata-flexible.yaml | 67 +++++++++++++ .github/workflows/appengine-analytics.yaml | 10 +- .../appengine-building-an-app-build.yaml | 10 +- .../appengine-building-an-app-update.yaml | 10 +- .github/workflows/appengine-datastore.yaml | 11 +-- .github/workflows/appengine-endpoints.yaml | 10 +- .../appengine-hello-world-flexible.yaml | 10 +- .../appengine-hello-world-standard.yaml | 10 +- .github/workflows/appengine-memcached.yaml | 10 +- .../appengine-metadata-standard.yaml | 11 +-- .github/workflows/appengine-pubsub.yaml | 14 +-- .github/workflows/appengine-static-files.yaml | 10 +- .../workflows/appengine-storage-flexible.yaml | 12 +-- .../workflows/appengine-storage-standard.yaml | 11 ++- .github/workflows/appengine-twilio.yaml | 10 +- .github/workflows/appengine-typescript.yaml | 10 +- .github/workflows/appengine-websockets.yaml | 10 +- .github/workflows/auth.yaml | 11 +-- .../cloud-tasks-tutorial-gcf-app.yaml | 67 +++++++++++++ .../cloud-tasks-tutorial-gcf-function.yaml | 67 +++++++++++++ ...er-functions-composer-storage-trigger.yaml | 10 +- .github/workflows/composer.yaml | 10 +- .../containerengine-hello-world.yaml | 10 +- .../workflows/datacatalog-cloud-client.yaml | 10 +- .github/workflows/datacatalog-quickstart.yaml | 10 +- .github/workflows/datalabeling.yaml | 98 +++++++++---------- .github/workflows/datastore-functions.yaml | 10 +- .../endpoints-getting-started-grpc.yaml | 10 +- .../workflows/endpoints-getting-started.yaml | 10 +- .github/workflows/functions-firebase.yaml | 30 ++---- .github/workflows/functions-helloworld.yaml | 31 +++--- .../workflows/functions-http-httpMethods.yaml | 67 +++++++++++++ .github/workflows/functions-http.yaml | 30 ++---- .../workflows/functions-scheduleinstance.yaml | 10 +- .github/workflows/functions-security.yaml | 10 +- .github/workflows/functions-slack.yaml | 18 +--- .github/workflows/functions-spanner.yaml | 10 +- .github/workflows/healthcare-datasets.yaml | 12 +-- .github/workflows/healthcare-dicom.yaml | 12 +-- .github/workflows/healthcare-fhir.yaml | 12 +-- .github/workflows/healthcare-hl7v2.yaml | 12 +-- .github/workflows/monitoring-opencensus.yaml | 12 +-- .github/workflows/monitoring-prometheus.yaml | 12 +-- 43 files changed, 532 insertions(+), 305 deletions(-) create mode 100644 .github/workflows/apengine-metadata-flexible.yaml create mode 100644 .github/workflows/cloud-tasks-tutorial-gcf-app.yaml create mode 100644 .github/workflows/cloud-tasks-tutorial-gcf-function.yaml create mode 100644 .github/workflows/functions-http-httpMethods.yaml diff --git a/.github/workflows/apengine-metadata-flexible.yaml b/.github/workflows/apengine-metadata-flexible.yaml new file mode 100644 index 0000000000..740021cd0e --- /dev/null +++ b/.github/workflows/apengine-metadata-flexible.yaml @@ -0,0 +1,67 @@ +name: apengine-metadata-flexible +on: + push: + branches: + - main + paths: + - 'apengine/metadata/flexible/**' + pull_request: + paths: + - 'apengine/metadata/flexible/**' + pull_request_target: + types: [labeled] + schedule: + - cron: '0 0 * * 0' +jobs: + test: + if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} + runs-on: ubuntu-latest + timeout-minutes: 60 + permissions: + contents: 'write' + pull-requests: 'write' + id-token: 'write' + steps: + - uses: actions/checkout@v3.1.0 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + - uses: 'google-github-actions/auth@v0.8.3' + with: + workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' + service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' + create_credentials_file: 'true' + access_token_lifetime: 600s + - uses: actions/setup-node@v3.5.1 + with: + node-version: 16 + - run: npm install + working-directory: apengine/metadata/flexible + - run: npm test + working-directory: apengine/metadata/flexible + env: + MOCHA_REPORTER_SUITENAME: apengine_metadata_flexible + MOCHA_REPORTER_OUTPUT: apengine_metadata_flexible_sponge_log.xml + MOCHA_REPORTER: xunit + - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + try { + await github.rest.issues.removeLabel({ + name: 'actions:force-run', + owner: 'GoogleCloudPlatform', + repo: 'nodejs-docs-samples', + issue_number: context.payload.pull_request.number + }); + } catch (e) { + if (!e.message.includes('Label does not exist')) { + throw e; + } + } + - if: ${{ github.event_name == 'schedule'}} + run: | + curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L + chmod +x ./flakybot + ./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} diff --git a/.github/workflows/appengine-analytics.yaml b/.github/workflows/appengine-analytics.yaml index 66987a089b..f25e071898 100644 --- a/.github/workflows/appengine-analytics.yaml +++ b/.github/workflows/appengine-analytics.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/analytics - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-building-an-app-build.yaml b/.github/workflows/appengine-building-an-app-build.yaml index c457041862..68997646c6 100644 --- a/.github/workflows/appengine-building-an-app-build.yaml +++ b/.github/workflows/appengine-building-an-app-build.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/building-an-app/build - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-building-an-app-update.yaml b/.github/workflows/appengine-building-an-app-update.yaml index 70ab4ebf4c..fca1a787da 100644 --- a/.github/workflows/appengine-building-an-app-update.yaml +++ b/.github/workflows/appengine-building-an-app-update.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/building-an-app/update - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-datastore.yaml b/.github/workflows/appengine-datastore.yaml index 2dc8c7e02a..eae68e0d99 100644 --- a/.github/workflows/appengine-datastore.yaml +++ b/.github/workflows/appengine-datastore.yaml @@ -22,20 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' - credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/datastore - run: npm test @@ -61,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-endpoints.yaml b/.github/workflows/appengine-endpoints.yaml index 0005f68006..280b51d4c9 100644 --- a/.github/workflows/appengine-endpoints.yaml +++ b/.github/workflows/appengine-endpoints.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/endpoints - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-hello-world-flexible.yaml b/.github/workflows/appengine-hello-world-flexible.yaml index a39f187897..f8c607f012 100644 --- a/.github/workflows/appengine-hello-world-flexible.yaml +++ b/.github/workflows/appengine-hello-world-flexible.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/hello-world/flexible - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-hello-world-standard.yaml b/.github/workflows/appengine-hello-world-standard.yaml index b1d9e1138c..48763c7eb7 100644 --- a/.github/workflows/appengine-hello-world-standard.yaml +++ b/.github/workflows/appengine-hello-world-standard.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/hello-world/standard - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-memcached.yaml b/.github/workflows/appengine-memcached.yaml index e3b03ab507..6413ab553f 100644 --- a/.github/workflows/appengine-memcached.yaml +++ b/.github/workflows/appengine-memcached.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/memcached - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-metadata-standard.yaml b/.github/workflows/appengine-metadata-standard.yaml index 359883d245..61071ec9e3 100644 --- a/.github/workflows/appengine-metadata-standard.yaml +++ b/.github/workflows/appengine-metadata-standard.yaml @@ -22,20 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' - token_format: 'access_token' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/metadata/standard - run: npm test @@ -61,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-pubsub.yaml b/.github/workflows/appengine-pubsub.yaml index 81b3e785c0..38f3d6c1c0 100644 --- a/.github/workflows/appengine-pubsub.yaml +++ b/.github/workflows/appengine-pubsub.yaml @@ -22,23 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' - credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' - id_token_audience: 'example.com' - token_format: 'id_token' - id_token_include_email: true access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/pubsub - run: npm test @@ -64,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-static-files.yaml b/.github/workflows/appengine-static-files.yaml index 3a3185db8c..08e0bd484b 100644 --- a/.github/workflows/appengine-static-files.yaml +++ b/.github/workflows/appengine-static-files.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/static-files - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-storage-flexible.yaml b/.github/workflows/appengine-storage-flexible.yaml index 20ea9398aa..66cc4effb5 100644 --- a/.github/workflows/appengine-storage-flexible.yaml +++ b/.github/workflows/appengine-storage-flexible.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' - token_format: 'access_token' + create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/storage/flexible - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-storage-standard.yaml b/.github/workflows/appengine-storage-standard.yaml index 7282e9571f..2c9a73c16b 100644 --- a/.github/workflows/appengine-storage-standard.yaml +++ b/.github/workflows/appengine-storage-standard.yaml @@ -22,18 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' + create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/storage/standard - run: npm test @@ -59,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-twilio.yaml b/.github/workflows/appengine-twilio.yaml index cc178b1b52..719c041d88 100644 --- a/.github/workflows/appengine-twilio.yaml +++ b/.github/workflows/appengine-twilio.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/twilio - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-typescript.yaml b/.github/workflows/appengine-typescript.yaml index e40d14f74a..89aea01a6b 100644 --- a/.github/workflows/appengine-typescript.yaml +++ b/.github/workflows/appengine-typescript.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/typescript - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/appengine-websockets.yaml b/.github/workflows/appengine-websockets.yaml index d298fc8ad3..d9055576e9 100644 --- a/.github/workflows/appengine-websockets.yaml +++ b/.github/workflows/appengine-websockets.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: appengine/websockets - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/auth.yaml b/.github/workflows/auth.yaml index 58dd257211..5c600fc9eb 100644 --- a/.github/workflows/auth.yaml +++ b/.github/workflows/auth.yaml @@ -22,20 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' - credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: auth - run: npm test @@ -61,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/cloud-tasks-tutorial-gcf-app.yaml b/.github/workflows/cloud-tasks-tutorial-gcf-app.yaml new file mode 100644 index 0000000000..fa79772cf7 --- /dev/null +++ b/.github/workflows/cloud-tasks-tutorial-gcf-app.yaml @@ -0,0 +1,67 @@ +name: cloud-tasks-tutorial-gcf-app +on: + push: + branches: + - main + paths: + - 'cloud-tasks/tutorial-gcf/app/**' + pull_request: + paths: + - 'cloud-tasks/tutorial-gcf/app/**' + pull_request_target: + types: [labeled] + schedule: + - cron: '0 0 * * 0' +jobs: + test: + if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} + runs-on: ubuntu-latest + timeout-minutes: 60 + permissions: + contents: 'write' + pull-requests: 'write' + id-token: 'write' + steps: + - uses: actions/checkout@v3.1.0 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + - uses: 'google-github-actions/auth@v0.8.3' + with: + workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' + service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' + create_credentials_file: 'true' + access_token_lifetime: 600s + - uses: actions/setup-node@v3.5.1 + with: + node-version: 16 + - run: npm install + working-directory: cloud-tasks/tutorial-gcf/app + - run: npm test + working-directory: cloud-tasks/tutorial-gcf/app + env: + MOCHA_REPORTER_SUITENAME: cloud_tasks_tutorial_gcf_app + MOCHA_REPORTER_OUTPUT: cloud_tasks_tutorial_gcf_app_sponge_log.xml + MOCHA_REPORTER: xunit + - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + try { + await github.rest.issues.removeLabel({ + name: 'actions:force-run', + owner: 'GoogleCloudPlatform', + repo: 'nodejs-docs-samples', + issue_number: context.payload.pull_request.number + }); + } catch (e) { + if (!e.message.includes('Label does not exist')) { + throw e; + } + } + - if: ${{ github.event_name == 'schedule'}} + run: | + curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L + chmod +x ./flakybot + ./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} diff --git a/.github/workflows/cloud-tasks-tutorial-gcf-function.yaml b/.github/workflows/cloud-tasks-tutorial-gcf-function.yaml new file mode 100644 index 0000000000..de35279518 --- /dev/null +++ b/.github/workflows/cloud-tasks-tutorial-gcf-function.yaml @@ -0,0 +1,67 @@ +name: cloud-tasks-tutorial-gcf-function +on: + push: + branches: + - main + paths: + - 'cloud-tasks/tutorial-gcf/function/**' + pull_request: + paths: + - 'cloud-tasks/tutorial-gcf/function/**' + pull_request_target: + types: [labeled] + schedule: + - cron: '0 0 * * 0' +jobs: + test: + if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} + runs-on: ubuntu-latest + timeout-minutes: 60 + permissions: + contents: 'write' + pull-requests: 'write' + id-token: 'write' + steps: + - uses: actions/checkout@v3.1.0 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + - uses: 'google-github-actions/auth@v0.8.3' + with: + workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' + service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' + create_credentials_file: 'true' + access_token_lifetime: 600s + - uses: actions/setup-node@v3.5.1 + with: + node-version: 16 + - run: npm install + working-directory: cloud-tasks/tutorial-gcf/function + - run: npm test + working-directory: cloud-tasks/tutorial-gcf/function + env: + MOCHA_REPORTER_SUITENAME: cloud_tasks_tutorial_gcf_function + MOCHA_REPORTER_OUTPUT: cloud_tasks_tutorial_gcf_function_sponge_log.xml + MOCHA_REPORTER: xunit + - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + try { + await github.rest.issues.removeLabel({ + name: 'actions:force-run', + owner: 'GoogleCloudPlatform', + repo: 'nodejs-docs-samples', + issue_number: context.payload.pull_request.number + }); + } catch (e) { + if (!e.message.includes('Label does not exist')) { + throw e; + } + } + - if: ${{ github.event_name == 'schedule'}} + run: | + curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L + chmod +x ./flakybot + ./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} diff --git a/.github/workflows/composer-functions-composer-storage-trigger.yaml b/.github/workflows/composer-functions-composer-storage-trigger.yaml index 770ee9d3f4..66cdf69862 100644 --- a/.github/workflows/composer-functions-composer-storage-trigger.yaml +++ b/.github/workflows/composer-functions-composer-storage-trigger.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: composer/functions/composer-storage-trigger - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/composer.yaml b/.github/workflows/composer.yaml index 4b39cc1c8f..dcce8e3c04 100644 --- a/.github/workflows/composer.yaml +++ b/.github/workflows/composer.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: composer - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/containerengine-hello-world.yaml b/.github/workflows/containerengine-hello-world.yaml index 613d7cc1f3..6f0512ae3f 100644 --- a/.github/workflows/containerengine-hello-world.yaml +++ b/.github/workflows/containerengine-hello-world.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: containerengine/hello-world - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/datacatalog-cloud-client.yaml b/.github/workflows/datacatalog-cloud-client.yaml index f73b21e0dc..abd527dba5 100644 --- a/.github/workflows/datacatalog-cloud-client.yaml +++ b/.github/workflows/datacatalog-cloud-client.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: datacatalog/cloud-client - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/datacatalog-quickstart.yaml b/.github/workflows/datacatalog-quickstart.yaml index f7c22852fe..9c719851c8 100644 --- a/.github/workflows/datacatalog-quickstart.yaml +++ b/.github/workflows/datacatalog-quickstart.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: datacatalog/quickstart - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/datalabeling.yaml b/.github/workflows/datalabeling.yaml index 9106e18a1a..7fd08da827 100644 --- a/.github/workflows/datalabeling.yaml +++ b/.github/workflows/datalabeling.yaml @@ -2,66 +2,66 @@ name: datalabeling on: push: branches: - - main + - main paths: - - "datalabeling/**" + - 'datalabeling/**' pull_request: paths: - - "datalabeling/**" + - 'datalabeling/**' pull_request_target: types: [labeled] schedule: - - cron: "0 0 * * 0" + - cron: '0 0 * * 0' jobs: test: if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} runs-on: ubuntu-latest timeout-minutes: 60 permissions: - contents: "write" - pull-requests: "write" - id-token: "write" + contents: 'write' + pull-requests: 'write' + id-token: 'write' steps: - - uses: actions/checkout@v3.1.0 - with: - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: "google-github-actions/auth@v0.8.3" - with: - workload_identity_provider: "projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider" - service_account: "kokoro-system-test@long-door-651.iam.gserviceaccount.com" - create_credentials_file: "true" - access_token_lifetime: 600s - - uses: actions/setup-node@v3.5.1 - with: - node-version: 16 - - run: npm install - working-directory: datalabeling - - run: npm test - working-directory: datalabeling - env: - MOCHA_REPORTER_SUITENAME: datalabeling - MOCHA_REPORTER_OUTPUT: datalabeling_sponge_log.xml - MOCHA_REPORTER: xunit - - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - try { - await github.rest.issues.removeLabel({ - name: 'actions:force-run', - owner: 'GoogleCloudPlatform', - repo: 'nodejs-docs-samples', - issue_number: context.payload.pull_request.number - }); - } catch (e) { - if (!e.message.includes('Label does not exist')) { - throw e; - } + - uses: actions/checkout@v3.1.0 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + - uses: 'google-github-actions/auth@v0.8.3' + with: + workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' + service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' + create_credentials_file: 'true' + access_token_lifetime: 600s + - uses: actions/setup-node@v3.5.1 + with: + node-version: 16 + - run: npm install + working-directory: datalabeling + - run: npm test + working-directory: datalabeling + env: + MOCHA_REPORTER_SUITENAME: datalabeling + MOCHA_REPORTER_OUTPUT: datalabeling_sponge_log.xml + MOCHA_REPORTER: xunit + - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + try { + await github.rest.issues.removeLabel({ + name: 'actions:force-run', + owner: 'GoogleCloudPlatform', + repo: 'nodejs-docs-samples', + issue_number: context.payload.pull_request.number + }); + } catch (e) { + if (!e.message.includes('Label does not exist')) { + throw e; } - - if: ${{ github.event_name == 'schedule'}} - run: | - curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L - chmod +x ./flakybot - ./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + } + - if: ${{ github.event_name == 'schedule'}} + run: | + curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L + chmod +x ./flakybot + ./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} diff --git a/.github/workflows/datastore-functions.yaml b/.github/workflows/datastore-functions.yaml index 3022d8683f..8d6b929ac7 100644 --- a/.github/workflows/datastore-functions.yaml +++ b/.github/workflows/datastore-functions.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: datastore/functions - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/endpoints-getting-started-grpc.yaml b/.github/workflows/endpoints-getting-started-grpc.yaml index 1f58ecca8e..93b2e6f33e 100644 --- a/.github/workflows/endpoints-getting-started-grpc.yaml +++ b/.github/workflows/endpoints-getting-started-grpc.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: endpoints/getting-started-grpc - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/endpoints-getting-started.yaml b/.github/workflows/endpoints-getting-started.yaml index f6ad9cd663..ca4cc2992c 100644 --- a/.github/workflows/endpoints-getting-started.yaml +++ b/.github/workflows/endpoints-getting-started.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: endpoints/getting-started - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/functions-firebase.yaml b/.github/workflows/functions-firebase.yaml index ea271785c5..986ed36669 100644 --- a/.github/workflows/functions-firebase.yaml +++ b/.github/workflows/functions-firebase.yaml @@ -14,18 +14,6 @@ on: - cron: '0 0 * * 0' jobs: test: - strategy: - matrix: - # Each package in this list will be tested independently. - # New packages must be manually added to this list. - package: - - 'functions/firebase' - - 'functions/firebase/helloAnalytics' - - 'functions/firebase/helloAuth' - - 'functions/firebase/helloFirestore' - - 'functions/firebase/helloRTDB' - - 'functions/firebase/helloRemoteConfig' - - 'functions/firebase/makeUpperCase' if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} runs-on: ubuntu-latest timeout-minutes: 60 @@ -34,24 +22,26 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install - working-directory: ${{ matrix.package }} - - run: npm test -- --reporter xunit --reporter-option output=sponge_log.xml --reporter-option suiteName="${{ matrix.package }}" - working-directory: ${{ matrix.package }} + working-directory: functions/firebase + - run: npm test + working-directory: functions/firebase env: + MOCHA_REPORTER_SUITENAME: functions_firebase + MOCHA_REPORTER_OUTPUT: functions_firebase_sponge_log.xml MOCHA_REPORTER: xunit - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} uses: actions/github-script@v6 @@ -70,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/functions-helloworld.yaml b/.github/workflows/functions-helloworld.yaml index 62e8c504dd..d049f235b7 100644 --- a/.github/workflows/functions-helloworld.yaml +++ b/.github/workflows/functions-helloworld.yaml @@ -14,17 +14,6 @@ on: - cron: '0 0 * * 0' jobs: test: - strategy: - matrix: - # Each package in this list will be tested independently. - # New packages must be manually added to this list. - package: - - 'functions/helloworld' - - 'functions/helloworld/helloError' - - 'functions/helloworld/helloGCS' - - 'functions/helloworld/helloPubSub' - - 'functions/helloworld/helloworldGet' - - 'functions/helloworld/helloworldHttp' if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} runs-on: ubuntu-latest timeout-minutes: 60 @@ -33,23 +22,27 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install - working-directory: ${{ matrix.package }} - - run: npm test -- --reporter xunit --reporter-option output=sponge_log.xml --reporter-option suiteName="${{ matrix.package }}" - working-directory: ${{ matrix.package }} + working-directory: functions/helloworld + - run: npm test + working-directory: functions/helloworld + env: + MOCHA_REPORTER_SUITENAME: functions_helloworld + MOCHA_REPORTER_OUTPUT: functions_helloworld_sponge_log.xml + MOCHA_REPORTER: xunit - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} uses: actions/github-script@v6 with: @@ -67,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/functions-http-httpMethods.yaml b/.github/workflows/functions-http-httpMethods.yaml new file mode 100644 index 0000000000..d8efdad4d1 --- /dev/null +++ b/.github/workflows/functions-http-httpMethods.yaml @@ -0,0 +1,67 @@ +name: functions-http-httpMethods +on: + push: + branches: + - main + paths: + - 'functions/http/httpMethods/**' + pull_request: + paths: + - 'functions/http/httpMethods/**' + pull_request_target: + types: [labeled] + schedule: + - cron: '0 0 * * 0' +jobs: + test: + if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} + runs-on: ubuntu-latest + timeout-minutes: 60 + permissions: + contents: 'write' + pull-requests: 'write' + id-token: 'write' + steps: + - uses: actions/checkout@v3.1.0 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + - uses: 'google-github-actions/auth@v0.8.3' + with: + workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' + service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' + create_credentials_file: 'true' + access_token_lifetime: 600s + - uses: actions/setup-node@v3.5.1 + with: + node-version: 16 + - run: npm install + working-directory: functions/http/httpMethods + - run: npm test + working-directory: functions/http/httpMethods + env: + MOCHA_REPORTER_SUITENAME: functions_http_httpMethods + MOCHA_REPORTER_OUTPUT: functions_http_httpMethods_sponge_log.xml + MOCHA_REPORTER: xunit + - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + try { + await github.rest.issues.removeLabel({ + name: 'actions:force-run', + owner: 'GoogleCloudPlatform', + repo: 'nodejs-docs-samples', + issue_number: context.payload.pull_request.number + }); + } catch (e) { + if (!e.message.includes('Label does not exist')) { + throw e; + } + } + - if: ${{ github.event_name == 'schedule'}} + run: | + curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L + chmod +x ./flakybot + ./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} diff --git a/.github/workflows/functions-http.yaml b/.github/workflows/functions-http.yaml index d84e822d47..557e29d6da 100644 --- a/.github/workflows/functions-http.yaml +++ b/.github/workflows/functions-http.yaml @@ -14,18 +14,6 @@ on: - cron: '0 0 * * 0' jobs: test: - strategy: - matrix: - # Each package in this list will be tested independently. - # New packages must be manually added to this list. - package: - - 'functions/http' - - 'functions/http/corsEnabledFunction' - - 'functions/http/corsEnabledFunctionAuth' - - 'functions/http/httpContent' - - 'functions/http/httpMethods' - - 'functions/http/parseXML' - - 'functions/http/uploadFile' if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} runs-on: ubuntu-latest timeout-minutes: 60 @@ -34,24 +22,26 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install - working-directory: ${{ matrix.package }} - - run: npm test -- --reporter xunit --reporter-option output=sponge_log.xml --reporter-option suiteName="${{ matrix.package }}" - working-directory: ${{ matrix.package }} + working-directory: functions/http + - run: npm test + working-directory: functions/http env: + MOCHA_REPORTER_SUITENAME: functions_http + MOCHA_REPORTER_OUTPUT: functions_http_sponge_log.xml MOCHA_REPORTER: xunit - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} uses: actions/github-script@v6 @@ -70,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/functions-scheduleinstance.yaml b/.github/workflows/functions-scheduleinstance.yaml index 512b1eb1f8..b1b9e43263 100644 --- a/.github/workflows/functions-scheduleinstance.yaml +++ b/.github/workflows/functions-scheduleinstance.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: functions/scheduleinstance - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/functions-security.yaml b/.github/workflows/functions-security.yaml index de9612265e..90615047d0 100644 --- a/.github/workflows/functions-security.yaml +++ b/.github/workflows/functions-security.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: functions/security - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/functions-slack.yaml b/.github/workflows/functions-slack.yaml index 18efc48bf2..94a448c9de 100644 --- a/.github/workflows/functions-slack.yaml +++ b/.github/workflows/functions-slack.yaml @@ -22,25 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - id: secrets - uses: 'google-github-actions/get-secretmanager-secrets@v0' + - uses: actions/setup-node@v3.5.1 with: - secrets: |- - slack_secret:nodejs-docs-samples-tests/nodejs-docs-samples-slack-secret - kg_api_key:nodejs-docs-samples-tests/nodejs-docs-samples-kg-api-key - - uses: actions/setup-node@v3 - with: - node-version: 14 + node-version: 16 - run: npm install working-directory: functions/slack - run: npm test @@ -49,8 +43,6 @@ jobs: MOCHA_REPORTER_SUITENAME: functions_slack MOCHA_REPORTER_OUTPUT: functions_slack_sponge_log.xml MOCHA_REPORTER: xunit - SLACK_SECRET: ${{ steps.secrets.outputs.slack_secret }} - API_KEY: ${{ steps.secrets.outputs.kg_api_key }} - if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }} uses: actions/github-script@v6 with: @@ -68,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/functions-spanner.yaml b/.github/workflows/functions-spanner.yaml index 0724c89d39..6c60035f78 100644 --- a/.github/workflows/functions-spanner.yaml +++ b/.github/workflows/functions-spanner.yaml @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: functions/spanner - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/healthcare-datasets.yaml b/.github/workflows/healthcare-datasets.yaml index e0dfd55aae..d56e5d01da 100644 --- a/.github/workflows/healthcare-datasets.yaml +++ b/.github/workflows/healthcare-datasets.yaml @@ -11,7 +11,7 @@ on: pull_request_target: types: [labeled] schedule: - - cron: '0 2 * * *' + - cron: '0 0 * * 0' jobs: test: if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: healthcare/datasets - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/healthcare-dicom.yaml b/.github/workflows/healthcare-dicom.yaml index 331008c95c..f15f6f6ad6 100644 --- a/.github/workflows/healthcare-dicom.yaml +++ b/.github/workflows/healthcare-dicom.yaml @@ -11,7 +11,7 @@ on: pull_request_target: types: [labeled] schedule: - - cron: '0 2 * * *' + - cron: '0 0 * * 0' jobs: test: if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: healthcare/dicom - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/healthcare-fhir.yaml b/.github/workflows/healthcare-fhir.yaml index 94b39b9b19..c738cdf945 100644 --- a/.github/workflows/healthcare-fhir.yaml +++ b/.github/workflows/healthcare-fhir.yaml @@ -11,7 +11,7 @@ on: pull_request_target: types: [labeled] schedule: - - cron: '0 2 * * *' + - cron: '0 0 * * 0' jobs: test: if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: healthcare/fhir - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/healthcare-hl7v2.yaml b/.github/workflows/healthcare-hl7v2.yaml index fa9284b5ca..938099b4ad 100644 --- a/.github/workflows/healthcare-hl7v2.yaml +++ b/.github/workflows/healthcare-hl7v2.yaml @@ -11,7 +11,7 @@ on: pull_request_target: types: [labeled] schedule: - - cron: '0 2 * * *' + - cron: '0 0 * * 0' jobs: test: if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: healthcare/hl7v2 - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/monitoring-opencensus.yaml b/.github/workflows/monitoring-opencensus.yaml index cf009a9f72..1a4f7e5db1 100644 --- a/.github/workflows/monitoring-opencensus.yaml +++ b/.github/workflows/monitoring-opencensus.yaml @@ -11,7 +11,7 @@ on: pull_request_target: types: [labeled] schedule: - - cron: '0 2 * * *' + - cron: '0 0 * * 0' jobs: test: if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: monitoring/opencensus - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot diff --git a/.github/workflows/monitoring-prometheus.yaml b/.github/workflows/monitoring-prometheus.yaml index c865586f86..be7eb7ae57 100644 --- a/.github/workflows/monitoring-prometheus.yaml +++ b/.github/workflows/monitoring-prometheus.yaml @@ -11,7 +11,7 @@ on: pull_request_target: types: [labeled] schedule: - - cron: '0 2 * * *' + - cron: '0 0 * * 0' jobs: test: if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }} @@ -22,19 +22,19 @@ jobs: pull-requests: 'write' id-token: 'write' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.1.0 with: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: google-github-actions/auth@v0.8.0 + - uses: 'google-github-actions/auth@v0.8.3' with: workload_identity_provider: 'projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider' service_account: 'kokoro-system-test@long-door-651.iam.gserviceaccount.com' create_credentials_file: 'true' access_token_lifetime: 600s - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.5.1 with: - node-version: 14 + node-version: 16 - run: npm install working-directory: monitoring/prometheus - run: npm test @@ -60,7 +60,7 @@ jobs: throw e; } } - - if: ${{ github.event_name == 'schedule' && always() }} + - if: ${{ github.event_name == 'schedule'}} run: | curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L chmod +x ./flakybot