Skip to content

Commit

Permalink
Release NPM package, and Node update
Browse files Browse the repository at this point in the history
Made sense to do these two parts together, since they were intertwined.

1. Closed #679 - create an interactive shell, so we can publish to
   @google-cloud/agones-sdk, since it requires some internal tools to
   make it happen.
2. Also update the Node version to 12.x, since 11.x is deprecated
3. Updated the image to use the new NPM package, and also while in there
   updated Node to 12.x and the Debian base to Buster. (Node image
   update for #1261)
4. Updated the release checklist to use the interactive shell, rather
   than the `publish` command, which has now been removed.
  • Loading branch information
markmandel committed Feb 22, 2020
1 parent 7d4789e commit d87fde9
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 64 deletions.
2 changes: 1 addition & 1 deletion build/build-sdk-images/node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
ARG BASE_IMAGE=agones-build-sdk-base:latest
FROM $BASE_IMAGE

RUN curl -sL https://deb.nodesource.com/setup_11.x | bash - && \
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get install -y nodejs

# code generation scripts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2019 Google LLC All Rights Reserved.
# Copyright 2020 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,7 @@
# limitations under the License.

set -ex

cd sdks/nodejs
npm login --registry=https://npm.pkg.github.com
npm publish
mkdir -p /root/.ssh || true
cp /tmp/.ssh/* /root/.ssh/
cd ./sdks/nodejs
bash
7 changes: 0 additions & 7 deletions build/includes/release.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ gen-changelog:
--release-branch=$(RELEASE_BRANCH) \
--token $$TOKEN

# public the node sdk package
pubish-sdk-node:
$(MAKE) run-sdk-command-node DOCKER_RUN_ARGS=-it COMMAND=publish

# publish all the sdk packages
publish-sdk-packages: pubish-sdk-node

# Creates a release. Version defaults to the base_version
# - Checks out a release branch
# - Build binaries and images
Expand Down
11 changes: 11 additions & 0 deletions build/includes/sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ run-sdk-conformance-tests: run-sdk-conformance-test-node run-sdk-conformance-tes
clean-sdk-conformance-tests:
$(MAKE) run-all-sdk-command COMMAND=clean

# Start a shell in the SDK image. This is primarily used for publishing packages.
# Usig a shell is the easiest, because of Google internal processes and interactive commands required.
sdk-shell:
$(MAKE) ensure-build-sdk-image SDK_FOLDER=$(SDK_FOLDER)
docker run --rm -it $(common_mounts) -v ~/.ssh:/tmp/.ssh:ro $(DOCKER_RUN_ARGS) \
--entrypoint=/root/shell.sh $(SDK_IMAGE_TAG)

# 1SDK shell for node
sdk-shell-node:
$(MAKE) sdk-shell SDK_FOLDER=node

# Perform make build for all examples
build-examples: build-example-xonotic build-example-cpp-simple build-example-simple-udp build-example-autoscaler-webhook build-example-nodejs-simple

Expand Down
3 changes: 2 additions & 1 deletion docs/governance/templates/release_issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ and copy it into a release issue. Fill in relevant values, found inside {}
- [ ] Create PR with these changes, and merge them with approval
- [ ] Confirm local git remote `upstream` points at `git@github.com:googleforgames/agones.git`
- [ ] Run `git remote update && git checkout master && git reset --hard upstream/master` to ensure your code is in line with upstream (unless this is a hotfix, then do the same, but for the release branch)
- [ ] Run `make publish-sdk-packages` to deploy SDK packages to registries
- [ ] Publish SDK packages
- [ ] Run `make sdk-shell-node` to get interactive shell to publish node package
- [ ] Run `make do-release`. (if release candidate: `make do-release RELEASE_VERSION={version}-rc`) to create and push the docker images and helm chart.
- [ ] Do a `helm repo add agones https://agones.dev/chart/stable` and verify that the new version is available via the command `helm search agones/`
- [ ] Do a `helm install` and a smoke test to confirm everything is working.
Expand Down
7 changes: 3 additions & 4 deletions examples/nodejs-simple/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM debian:stretch
FROM debian:buster
RUN useradd -u 1000 -m server
RUN apt-get update && apt-get install -y curl && apt-get clean
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash - && \
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get install -y nodejs

WORKDIR /home/server

COPY ./sdks/nodejs sdks/nodejs
COPY ./examples/nodejs-simple examples/nodejs-simple
RUN cd examples/nodejs-simple && \
npm install

RUN chown -R server /home/server
USER 1000
ENTRYPOINT cd /home/server/examples/nodejs-simple && npm start
2 changes: 1 addition & 1 deletion examples/nodejs-simple/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"@googleforgames/agones": "1.2.0"
"@google-cloud/agones-sdk": "1.3.0"
},
"scripts": {
"start": "node src/index.js"
Expand Down
2 changes: 1 addition & 1 deletion examples/nodejs-simple/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

const AgonesSDK = require('@googleforgames/agones');
const AgonesSDK = require('@google-cloud/agones-sdk');

const agonesSDK = new AgonesSDK();

Expand Down
1 change: 0 additions & 1 deletion sdks/nodejs/.npmrc

This file was deleted.

4 changes: 2 additions & 2 deletions sdks/nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 28 additions & 28 deletions sdks/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"author": "Google LLC",
"bugs": {
"url": "https://github.com/googleforgames/agones/issues"
},
"dependencies": {
"google-protobuf": "3.9.0",
"grpc": "1.22.2"
},
"description": "SDK for Agones",
"devDependencies": {
"eslint": "^6.1.0",
"jasmine": "^3.4.0",
"nyc": "^14.1.1"
},
"homepage": "https://agones.dev",
"license": "Apache-2.0",
"main": "src/index.js",
"name": "@googleforgames/agones",
"repository": {
"type": "git",
"url": "git+https://github.com/googleforgames/agones.git"
},
"scripts": {
"cover": "nyc jasmine",
"lint": "eslint --fix src spec",
"test": "jasmine"
},
"version": "1.4.0"
"author": "Google LLC",
"bugs": {
"url": "https://github.com/googleforgames/agones/issues"
},
"dependencies": {
"google-protobuf": "3.9.0",
"grpc": "1.22.2"
},
"description": "Game Server SDK for Agones, the open source project for hosting dedicated game servers on Kubernetes",
"devDependencies": {
"eslint": "^6.1.0",
"jasmine": "^3.4.0",
"nyc": "^14.1.1"
},
"homepage": "https://agones.dev",
"license": "Apache-2.0",
"main": "src/index.js",
"name": "@google-cloud/agones-sdk",
"repository": "googleforgames/agones",
"scripts": {
"cover": "nyc jasmine",
"lint": "eslint --fix src spec",
"test": "jasmine"
},
"publishConfig": {
"access": "public"
},
"version": "1.4.0"
}
11 changes: 5 additions & 6 deletions site/content/en/docs/Guides/Client SDKs/nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ description: "This is the Node.js version of the Agones Game Server Client SDK."

Check the [Client SDK Documentation]({{< relref "_index.md" >}}) for more details on each of the SDK functions and how to run the SDK locally.

## Download

Download the source {{< ghlink href="sdks/nodejs" >}}directly from GitHub{{< /ghlink >}}.

## Prerequisites

- Node.js >= 10.13.0
Expand All @@ -22,13 +18,16 @@ Download the source {{< ghlink href="sdks/nodejs" >}}directly from GitHub{{< /gh
Add the agones dependency to your project:

```sh
$ npm install @googleforgames/agones
$ npm install @google-cloud/agones-sdk
```

If you need to download the source, rather than install from NPM, you can find it on
{{< ghlink href="sdks/nodejs" >}}GitHub{{< /ghlink >}}.

To begin working with the SDK, create an instance of it.

```javascript
const AgonesSDK = require('@googleforgames/agones');
const AgonesSDK = require('@google-cloud/agones-sdk');

let agonesSDK = new AgonesSDK();
```
Expand Down
12 changes: 6 additions & 6 deletions test/sdk/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"dependencies": {
"@googleforgames/agones": "../../../sdks/nodejs"
},
"scripts": {
"testSDK": "node ./testSDKClient.js"
}
"dependencies": {
"@google-cloud/agones-sdk": "../../../sdks/nodejs"
},
"scripts": {
"testSDK": "node ./testSDKClient.js"
}
}
2 changes: 1 addition & 1 deletion test/sdk/nodejs/testSDKClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

const AgonesSDK = require('@googleforgames/agones');
const AgonesSDK = require('@google-cloud/agones-sdk');
const agonesSDK = new AgonesSDK();

const connect = async () => {
Expand Down

0 comments on commit d87fde9

Please sign in to comment.