From 7524c99be2d308e7aef0dfdbdd433106ca1655d2 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Mon, 3 Dec 2018 23:10:04 +0200 Subject: [PATCH] fix(docs-infra): log the successful creation of previews (#27436) This can help with debugging issues, e.g. with the communication between the preview server and CI, as it gives a better idea of exactly when was the preview made available and how long it took. PR Close #27436 --- .../scripts-js/lib/preview-server/preview-server-factory.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aio/aio-builds-setup/dockerbuild/scripts-js/lib/preview-server/preview-server-factory.ts b/aio/aio-builds-setup/dockerbuild/scripts-js/lib/preview-server/preview-server-factory.ts index 21186f4539..8058a64597 100644 --- a/aio/aio-builds-setup/dockerbuild/scripts-js/lib/preview-server/preview-server-factory.ts +++ b/aio/aio-builds-setup/dockerbuild/scripts-js/lib/preview-server/preview-server-factory.ts @@ -7,7 +7,7 @@ import {CircleCiApi} from '../common/circle-ci-api'; import {GithubApi} from '../common/github-api'; import {GithubPullRequests} from '../common/github-pull-requests'; import {GithubTeams} from '../common/github-teams'; -import {assert, assertNotMissingOrEmpty, Logger} from '../common/utils'; +import {assert, assertNotMissingOrEmpty, computeShortSha, Logger} from '../common/utils'; import {BuildCreator} from './build-creator'; import {ChangedPrVisibilityEvent, CreatedBuildEvent} from './build-events'; import {BuildRetriever} from './build-retriever'; @@ -144,7 +144,10 @@ export class PreviewServerFactory { const artifactPath = await buildRetriever.downloadBuildArtifact(buildNum, pr, sha, cfg.buildArtifactPath); const isPublic = await buildVerifier.getPrIsTrusted(pr); await buildCreator.create(pr, sha, artifactPath, isPublic); + res.sendStatus(isPublic ? 201 : 202); + logger.log(`PR:${pr}, SHA:${computeShortSha(sha)}, Build:${buildNum} - ` + + `Successfully created ${isPublic ? 'public' : 'non-public'} preview.`); } catch (err) { logger.error('CircleCI webhook error', err); respondWithError(res, err);