Skip to content

Commit 9bfb4df

Browse files
committed
pr feedback
1 parent a99defa commit 9bfb4df

File tree

4 files changed

+44
-36
lines changed

4 files changed

+44
-36
lines changed

dist/index.js

Lines changed: 20 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/model/cloud-runner/remote-client/index.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,32 +46,35 @@ export class RemoteClient {
4646
lingeringLine = lines.pop() || '';
4747

4848
for (const element of lines) {
49-
// For K8s, write to both log file and stdout so kubectl logs can capture it
50-
if (CloudRunnerOptions.providerStrategy === 'k8s') {
51-
fs.appendFileSync(logFile, element);
49+
// Always write to log file so output can be collected by providers
50+
if (element.trim()) {
51+
fs.appendFileSync(logFile, `${element}\n`);
52+
}
5253

54+
// For K8s, also write to stdout so kubectl logs can capture it
55+
if (CloudRunnerOptions.providerStrategy === 'k8s') {
5356
// Write to stdout so kubectl logs can capture it - ensure newline is included
5457
// Stdout flushes automatically on newline, so no explicit flush needed
5558
process.stdout.write(`${element}\n`);
56-
CloudRunnerLogger.log(element);
57-
} else {
58-
CloudRunnerLogger.log(element);
5959
}
60+
61+
CloudRunnerLogger.log(element);
6062
}
6163
});
6264

6365
process.stdin.on('end', () => {
64-
if (CloudRunnerOptions.providerStrategy === 'k8s') {
65-
if (lingeringLine) {
66-
fs.appendFileSync(logFile, lingeringLine);
66+
if (lingeringLine) {
67+
// Always write to log file so output can be collected by providers
68+
fs.appendFileSync(logFile, `${lingeringLine}\n`);
6769

70+
// For K8s, also write to stdout so kubectl logs can capture it
71+
if (CloudRunnerOptions.providerStrategy === 'k8s') {
6872
// Stdout flushes automatically on newline
6973
process.stdout.write(`${lingeringLine}\n`);
7074
}
71-
CloudRunnerLogger.log(lingeringLine);
72-
} else {
73-
CloudRunnerLogger.log(lingeringLine);
7475
}
76+
77+
CloudRunnerLogger.log(lingeringLine);
7578
});
7679
}
7780

src/model/cloud-runner/workflows/build-automation-workflow.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,22 +168,25 @@ echo "CACHE_KEY=$CACHE_KEY"`;
168168
if ! command -v npm > /dev/null 2>&1; then printf '#!/bin/sh\nexit 0\n' > /usr/local/bin/npm && chmod +x /usr/local/bin/npm; fi
169169
if ! command -v n > /dev/null 2>&1; then printf '#!/bin/sh\nexit 0\n' > /usr/local/bin/n && chmod +x /usr/local/bin/n; fi
170170
if ! command -v yarn > /dev/null 2>&1; then printf '#!/bin/sh\nexit 0\n' > /usr/local/bin/yarn && chmod +x /usr/local/bin/yarn; fi
171-
echo "game ci start"; echo "game ci start" >> /home/job-log.txt; echo "CACHE_KEY=$CACHE_KEY"; echo "$CACHE_KEY"; if [ -n "$LOCKED_WORKSPACE" ]; then echo "Retained Workspace: true"; fi; if [ -n "$LOCKED_WORKSPACE" ] && [ -d "$GITHUB_WORKSPACE/.git" ]; then echo "Retained Workspace Already Exists!"; fi; /entrypoint.sh
171+
# Pipe entrypoint.sh output through log stream to capture Unity build output (including "Build succeeded")
172+
{ echo "game ci start"; echo "game ci start" >> /home/job-log.txt; echo "CACHE_KEY=$CACHE_KEY"; echo "$CACHE_KEY"; if [ -n "$LOCKED_WORKSPACE" ]; then echo "Retained Workspace: true"; fi; if [ -n "$LOCKED_WORKSPACE" ] && [ -d "$GITHUB_WORKSPACE/.git" ]; then echo "Retained Workspace Already Exists!"; fi; /entrypoint.sh; } | node ${builderPath} -m remote-cli-log-stream --logFile /home/job-log.txt
172173
mkdir -p "/data/cache/$CACHE_KEY/Library"
173174
if [ ! -f "/data/cache/$CACHE_KEY/Library/lib-$BUILD_GUID.tar" ] && [ ! -f "/data/cache/$CACHE_KEY/Library/lib-$BUILD_GUID.tar.lz4" ]; then
174175
tar -cf "/data/cache/$CACHE_KEY/Library/lib-$BUILD_GUID.tar" --files-from /dev/null || touch "/data/cache/$CACHE_KEY/Library/lib-$BUILD_GUID.tar"
175176
fi
176177
if [ ! -f "/data/cache/$CACHE_KEY/build/build-$BUILD_GUID.tar" ] && [ ! -f "/data/cache/$CACHE_KEY/build/build-$BUILD_GUID.tar.lz4" ]; then
177178
tar -cf "/data/cache/$CACHE_KEY/build/build-$BUILD_GUID.tar" --files-from /dev/null || touch "/data/cache/$CACHE_KEY/build/build-$BUILD_GUID.tar"
178179
fi
179-
# Run post-build tasks - ensure output is captured even if command fails
180-
node ${builderPath} -m remote-cli-post-build || echo "Post-build command completed with warnings"
180+
# Run post-build tasks and pipe output through log stream to capture "Activation successful"
181+
node ${builderPath} -m remote-cli-post-build | node ${builderPath} -m remote-cli-log-stream --logFile /home/job-log.txt || echo "Post-build command completed with warnings"
182+
# Write end marker and pipe through log stream
183+
echo "end of cloud runner job" | node ${builderPath} -m remote-cli-log-stream --logFile /home/job-log.txt
184+
echo "---${CloudRunner.buildParameters.logId}" | node ${builderPath} -m remote-cli-log-stream --logFile /home/job-log.txt
181185
# Mirror cache back into workspace for test assertions
182186
mkdir -p "$GITHUB_WORKSPACE/cloud-runner-cache/cache/$CACHE_KEY/Library"
183187
mkdir -p "$GITHUB_WORKSPACE/cloud-runner-cache/cache/$CACHE_KEY/build"
184188
cp -a "/data/cache/$CACHE_KEY/Library/." "$GITHUB_WORKSPACE/cloud-runner-cache/cache/$CACHE_KEY/Library/" || true
185-
cp -a "/data/cache/$CACHE_KEY/build/." "$GITHUB_WORKSPACE/cloud-runner-cache/cache/$CACHE_KEY/build/" || true
186-
echo "end of cloud runner job"`;
189+
cp -a "/data/cache/$CACHE_KEY/build/." "$GITHUB_WORKSPACE/cloud-runner-cache/cache/$CACHE_KEY/build/" || true`;
187190
}
188191

189192
// prettier-ignore

0 commit comments

Comments
 (0)