Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intercept Xonotic stdout for SDK Integration #218

Merged
merged 1 commit into from
May 24, 2018

Conversation

markmandel
Copy link
Member

Change the Xonotic example to have wrapper around the server execution, and use the content of stdout to determine what to do with the SDK for GameServer lifecycle management.

@markmandel markmandel added the area/examples Examples. Usually found in the `examples` directory label May 23, 2018
@markmandel markmandel added this to the 0.2 milestone May 23, 2018
@markmandel markmandel requested a review from enocom May 23, 2018 00:10
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: ae77ad29-b1c9-4fe5-a4ff-892c099b1530

Build Logs
starting build "ae77ad29-b1c9-4fe5-a4ff-892c099b1530"

FETCHSOURCE
Initialized empty Git repository in /workspace/.git/
From https://source.developers.google.com/p/agones-images/r/agones
 * branch            f5322990a68a00f1552ae27181ac1ab6ccf0ba3e -> FETCH_HEAD
HEAD is now at f532299 Intercept Xonotic stdout for SDK Integration
BUILD
Starting Step #0
Step #0: Already have image (with digest): ubuntu
Finished Step #0
Starting Step #1
Step #1: Already have image (with digest): gcr.io/cloud-builders/docker
Step #1: Sending build context to Docker daemon  131.1MB

Step #1: Step 1/3 : FROM gcr.io/cloud-builders/docker
Step #1:  ---> 633138f1b9a2
Step #1: Step 2/3 : RUN apt-get install make
Step #1:  ---> Running in c2853418edea
Step #1: Reading package lists...
Step #1: Building dependency tree...
Step #1: Reading state information...
Step #1: Suggested packages:
Step #1:   make-doc
Step #1: The following NEW packages will be installed:
Step #1:   make
Step #1: 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Step #1: Need to get 151 kB of archives.
Step #1: After this operation, 365 kB of additional disk space will be used.
Step #1: Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 make amd64 4.1-6 [151 kB]
Step #1: Fetched 151 kB in 0s (230 kB/s)
Step #1: Selecting previously unselected package make.
Step #1: (Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 11239 files and directories currently installed.)
Step #1: Preparing to unpack .../archives/make_4.1-6_amd64.deb ...
Step #1: Unpacking make (4.1-6) ...
Step #1: Setting up make (4.1-6) ...
Step #1: Removing intermediate container c2853418edea
Step #1:  ---> 70a400476fc6
Step #1: Step 3/3 : ENTRYPOINT ["/usr/bin/make"]
Step #1:  ---> Running in 75c6731a7ef6
Step #1: Removing intermediate container 75c6731a7ef6
Step #1:  ---> 5ce6738f2be5
Step #1: Successfully built 5ce6738f2be5
Step #1: Successfully tagged make-docker:latest
Finished Step #1
Starting Step #2
Step #2: Already have image: make-docker
Step #2: docker pull gcr.io/agones-images/agones-build:e52ce865fb && docker tag gcr.io/agones-images/agones-build:e52ce865fb agones-build:e52ce865fb
Step #2: e52ce865fb: Pulling from agones-images/agones-build
Step #2: c73ab1c6897b: Pulling fs layer
Step #2: 3091fac74ac3: Pulling fs layer
Step #2: 32ec8f15f1df: Pulling fs layer
Step #2: 8a19269d40b4: Pulling fs layer
Step #2: e6425ad9525a: Pulling fs layer
Step #2: 16df2efc4858: Pulling fs layer
Step #2: 2b2d73ab4219: Pulling fs layer
Step #2: 5f2d382df949: Pulling fs layer
Step #2: 5b739d0afd39: Pulling fs layer
Step #2: eb921739ae12: Pulling fs layer
Step #2: 2022ec0c796a: Pulling fs layer
Step #2: 3ee570d976e5: Pulling fs layer
Step #2: 59f7198d9c1c: Pulling fs layer
Step #2: 08501ff593d9: Pulling fs layer
Step #2: a5d32e6825a2: Pulling fs layer
Step #2: 42602390dd8d: Pulling fs layer
Step #2: 8a19269d40b4: Waiting
Step #2: e6425ad9525a: Waiting
Step #2: 16df2efc4858: Waiting
Step #2: 2b2d73ab4219: Waiting
Step #2: 5f2d382df949: Waiting
Step #2: 5b739d0afd39: Waiting
Step #2: eb921739ae12: Waiting
Step #2: 2022ec0c796a: Waiting
Step #2: 3ee570d976e5: Waiting
Step #2: 59f7198d9c1c: Waiting
Step #2: 08501ff593d9: Waiting
Step #2: a5d32e6825a2: Waiting
Step #2: 42602390dd8d: Waiting
Step #2: c73ab1c6897b: Verifying Checksum
Step #2: c73ab1c6897b: Download complete
Step #2: 8a19269d40b4: Verifying Checksum
Step #2: 8a19269d40b4: Download complete
Step #2: 3091fac74ac3: Verifying Checksum
Step #2: 3091fac74ac3: Download complete
Step #2: 16df2efc4858: Verifying Checksum
Step #2: 16df2efc4858: Download complete
Step #2: e6425ad9525a: Verifying Checksum
Step #2: e6425ad9525a: Download complete
Step #2: 5f2d382df949: Verifying Checksum
Step #2: 5f2d382df949: Download complete
Step #2: 5b739d0afd39: Verifying Checksum
Step #2: 5b739d0afd39: Download complete
Step #2: eb921739ae12: Verifying Checksum
Step #2: eb921739ae12: Download complete
Step #2: 2b2d73ab4219: Verifying Checksum
Step #2: 2b2d73ab4219: Download complete
Step #2: 3ee570d976e5: Verifying Checksum
Step #2: 3ee570d976e5: Download complete
Step #2: 59f7198d9c1c: Verifying Checksum
Step #2: 59f7198d9c1c: Download complete
Step #2: 08501ff593d9: Verifying Checksum
Step #2: 08501ff593d9: Download complete
Step #2: 2022ec0c796a: Verifying Checksum
Step #2: 2022ec0c796a: Download complete
Step #2: 42602390dd8d: Verifying Checksum
Step #2: 42602390dd8d: Download complete
Step #2: a5d32e6825a2: Verifying Checksum
Step #2: a5d32e6825a2: Download complete
Step #2: c73ab1c6897b: Pull complete
Step #2: 3091fac74ac3: Pull complete
Step #2: 32ec8f15f1df: Verifying Checksum
Step #2: 32ec8f15f1df: Download complete
Step #2: 32ec8f15f1df: Pull complete
Step #2: 8a19269d40b4: Pull complete
Step #2: e6425ad9525a: Pull complete
Step #2: 16df2efc4858: Pull complete
Step #2: 2b2d73ab4219: Pull complete
Step #2: 5f2d382df949: Pull complete
Step #2: 5b739d0afd39: Pull complete
Step #2: eb921739ae12: Pull complete
Step #2: 2022ec0c796a: Pull complete
Step #2: 3ee570d976e5: Pull complete
Step #2: 59f7198d9c1c: Pull complete
Step #2: 08501ff593d9: Pull complete
Step #2: a5d32e6825a2: Pull complete
Step #2: 42602390dd8d: Pull complete
Step #2: Digest: sha256:0344289d4121c2024d5b7d8790a8f3a5043b2149c0632928a2d4d9d0b8473f24
Step #2: Status: Downloaded newer image for gcr.io/agones-images/agones-build:e52ce865fb
Finished Step #2
Starting Step #3
Step #3: Already have image: make-docker
Step #3: mkdir -p ~/.kube
Step #3: mkdir -p /workspace/build//.config/gcloud
Step #3: docker run --rm -v /workspace/build//.config/gcloud:/root/.config/gcloud -v ~/.kube:/root/.kube -v /workspace:/go/src/agones.dev/agones -w /go/src/agones.dev/agones  agones-build:e52ce865fb bash -c \
Step #3: 	"/root/gen-lint-exclude.sh && gometalinter --config .exclude.gometalinter.json --deadline 100s -t --skip vendor ./..."
Step #3: examples/xonotic/main.go:73::warning: Subprocess launching with variable.,HIGH,HIGH (gas)
Step #3: WARNING: deadline exceeded by linter megacheck (try increasing --deadline)
Step #3: make: *** [lint] Error 3
Step #3: Makefile:136: recipe for target 'lint' failed
Finished Step #3
ERROR
ERROR: build step 3 "make-docker" failed: exit status 2

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 61ae0bd9-e3fc-4e3b-a325-d3a9d9726145

Build Logs
starting build "61ae0bd9-e3fc-4e3b-a325-d3a9d9726145"

FETCHSOURCE
Initialized empty Git repository in /workspace/.git/
From https://source.developers.google.com/p/agones-images/r/agones
 * branch            f5322990a68a00f1552ae27181ac1ab6ccf0ba3e -> FETCH_HEAD
HEAD is now at f532299 Intercept Xonotic stdout for SDK Integration
BUILD
Starting Step #0
Step #0: Already have image (with digest): ubuntu
Finished Step #0
Starting Step #1
Step #1: Already have image (with digest): gcr.io/cloud-builders/docker
Step #1: Sending build context to Docker daemon  131.1MB

Step #1: Step 1/3 : FROM gcr.io/cloud-builders/docker
Step #1:  ---> 633138f1b9a2
Step #1: Step 2/3 : RUN apt-get install make
Step #1:  ---> Running in 457f6443cdd1
Step #1: Reading package lists...
Step #1: Building dependency tree...
Step #1: Reading state information...
Step #1: Suggested packages:
Step #1:   make-doc
Step #1: The following NEW packages will be installed:
Step #1:   make
Step #1: 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Step #1: Need to get 151 kB of archives.
Step #1: After this operation, 365 kB of additional disk space will be used.
Step #1: Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 make amd64 4.1-6 [151 kB]
Step #1: Fetched 151 kB in 0s (186 kB/s)
Step #1: Selecting previously unselected package make.
Step #1: (Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 11239 files and directories currently installed.)
Step #1: Preparing to unpack .../archives/make_4.1-6_amd64.deb ...
Step #1: Unpacking make (4.1-6) ...
Step #1: Setting up make (4.1-6) ...
Step #1: Removing intermediate container 457f6443cdd1
Step #1:  ---> 28d11b08e66d
Step #1: Step 3/3 : ENTRYPOINT ["/usr/bin/make"]
Step #1:  ---> Running in 366620bb9aa0
Step #1: Removing intermediate container 366620bb9aa0
Step #1:  ---> cbf646340c61
Step #1: Successfully built cbf646340c61
Step #1: Successfully tagged make-docker:latest
Finished Step #1
Starting Step #2
Step #2: Already have image: make-docker
Step #2: docker pull gcr.io/agones-images/agones-build:e52ce865fb && docker tag gcr.io/agones-images/agones-build:e52ce865fb agones-build:e52ce865fb
Step #2: e52ce865fb: Pulling from agones-images/agones-build
Step #2: c73ab1c6897b: Pulling fs layer
Step #2: 3091fac74ac3: Pulling fs layer
Step #2: 32ec8f15f1df: Pulling fs layer
Step #2: 8a19269d40b4: Pulling fs layer
Step #2: e6425ad9525a: Pulling fs layer
Step #2: 16df2efc4858: Pulling fs layer
Step #2: 2b2d73ab4219: Pulling fs layer
Step #2: 5f2d382df949: Pulling fs layer
Step #2: 5b739d0afd39: Pulling fs layer
Step #2: eb921739ae12: Pulling fs layer
Step #2: 2022ec0c796a: Pulling fs layer
Step #2: 3ee570d976e5: Pulling fs layer
Step #2: 59f7198d9c1c: Pulling fs layer
Step #2: 08501ff593d9: Pulling fs layer
Step #2: a5d32e6825a2: Pulling fs layer
Step #2: 42602390dd8d: Pulling fs layer
Step #2: 8a19269d40b4: Waiting
Step #2: e6425ad9525a: Waiting
Step #2: 16df2efc4858: Waiting
Step #2: 2b2d73ab4219: Waiting
Step #2: 5f2d382df949: Waiting
Step #2: 5b739d0afd39: Waiting
Step #2: eb921739ae12: Waiting
Step #2: 2022ec0c796a: Waiting
Step #2: 3ee570d976e5: Waiting
Step #2: 59f7198d9c1c: Waiting
Step #2: 08501ff593d9: Waiting
Step #2: a5d32e6825a2: Waiting
Step #2: 42602390dd8d: Waiting
Step #2: c73ab1c6897b: Verifying Checksum
Step #2: c73ab1c6897b: Download complete
Step #2: 8a19269d40b4: Verifying Checksum
Step #2: 8a19269d40b4: Download complete
Step #2: c73ab1c6897b: Pull complete
Step #2: 3091fac74ac3: Verifying Checksum
Step #2: 3091fac74ac3: Download complete
Step #2: 16df2efc4858: Verifying Checksum
Step #2: 16df2efc4858: Download complete
Step #2: e6425ad9525a: Verifying Checksum
Step #2: e6425ad9525a: Download complete
Step #2: 5f2d382df949: Verifying Checksum
Step #2: 5f2d382df949: Download complete
Step #2: 5b739d0afd39: Verifying Checksum
Step #2: 5b739d0afd39: Download complete
Step #2: 2b2d73ab4219: Verifying Checksum
Step #2: 2b2d73ab4219: Download complete
Step #2: eb921739ae12: Verifying Checksum
Step #2: eb921739ae12: Download complete
Step #2: 3ee570d976e5: Verifying Checksum
Step #2: 3ee570d976e5: Download complete
Step #2: 32ec8f15f1df: Verifying Checksum
Step #2: 32ec8f15f1df: Download complete
Step #2: 3091fac74ac3: Pull complete
Step #2: 2022ec0c796a: Verifying Checksum
Step #2: 2022ec0c796a: Download complete
Step #2: a5d32e6825a2: Verifying Checksum
Step #2: a5d32e6825a2: Download complete
Step #2: 59f7198d9c1c: Verifying Checksum
Step #2: 59f7198d9c1c: Download complete
Step #2: 08501ff593d9: Verifying Checksum
Step #2: 08501ff593d9: Download complete
Step #2: 42602390dd8d: Verifying Checksum
Step #2: 42602390dd8d: Download complete
Step #2: 32ec8f15f1df: Pull complete
Step #2: 8a19269d40b4: Pull complete
Step #2: e6425ad9525a: Pull complete
Step #2: 16df2efc4858: Pull complete
Step #2: 2b2d73ab4219: Pull complete
Step #2: 5f2d382df949: Pull complete
Step #2: 5b739d0afd39: Pull complete
Step #2: eb921739ae12: Pull complete
Step #2: 2022ec0c796a: Pull complete
Step #2: 3ee570d976e5: Pull complete
Step #2: 59f7198d9c1c: Pull complete
Step #2: 08501ff593d9: Pull complete
Step #2: a5d32e6825a2: Pull complete
Step #2: 42602390dd8d: Pull complete
Step #2: Digest: sha256:0344289d4121c2024d5b7d8790a8f3a5043b2149c0632928a2d4d9d0b8473f24
Step #2: Status: Downloaded newer image for gcr.io/agones-images/agones-build:e52ce865fb
Finished Step #2
Starting Step #3
Step #3: Already have image: make-docker
Step #3: mkdir -p ~/.kube
Step #3: mkdir -p /workspace/build//.config/gcloud
Step #3: docker run --rm -v /workspace/build//.config/gcloud:/root/.config/gcloud -v ~/.kube:/root/.kube -v /workspace:/go/src/agones.dev/agones -w /go/src/agones.dev/agones  agones-build:e52ce865fb bash -c \
Step #3: 	"/root/gen-lint-exclude.sh && gometalinter --config .exclude.gometalinter.json --deadline 100s -t --skip vendor ./..."
Step #3: examples/xonotic/main.go:73::warning: Subprocess launching with variable.,HIGH,HIGH (gas)
Step #3: Makefile:136: recipe for target 'lint' failed
Step #3: make: *** [lint] Error 1
Finished Step #3
ERROR
ERROR: build step 3 "make-docker" failed: exit status 2

Copy link
Contributor

@enocom enocom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small nits, but otherwise LGTM.

ENTRYPOINT /home/xonotic/wrapper -i /home/xonotic/Xonotic/server_linux.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small thing here: missing newline at end of file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -2,6 +2,10 @@

Example using a [Xonotic](http://www.xonotic.org) dedicated game server.

*Note:* This example doesn't directly integrate the SDK (yet), but calls it via a separate binary.
This example wraps the Xonotic server with a [Go](https://golang.org) binary, and introspect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short to "introspects stdout"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Done.

This example wraps the Xonotic server with a [Go](https://golang.org) binary, and introspect
the stdout output to provide the event hooks for the SDK integration.

It is not a direct integration, but is a nice way of demoing an approach for to integrate with existing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an approach for integrating

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

image: gcr.io/agones-images/xonotic-example:0.2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -23,5 +23,5 @@ spec:
spec:
containers:
- name: xonotic
image: gcr.io/agones-images/xonotic-example:0.1
image: gcr.io/agones-images/xonotic-example:0.2
# imagePullPolicy: Always # add for development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note part of the diff technically, but since you're in the neighborhood, maybe add a newline here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -18,22 +18,93 @@ import (
"log"
"time"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following imports can be moved up one line to be next to log and time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

// Write will intercept the incoming stream, and forward
// the contents to it's `forward` Writer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Change the Xonotic example to have wrapper
around the server execution, and use the
content of stdout to determine what to do
with the SDK for GameServer lifecycle management.
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 89a804d1-addb-4d39-b61c-25bed3af95db

The following development artifacts have been built, and will exist for the next 30 days:

@enocom enocom closed this May 24, 2018
@enocom enocom reopened this May 24, 2018
@enocom enocom merged commit f25a3c7 into googleforgames:master May 24, 2018
@markmandel markmandel deleted the feature/xonotic-wrapper branch May 24, 2018 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/examples Examples. Usually found in the `examples` directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants