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

Add debug statements #2908

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-build-pr" ]];then
# Docs PR require a full rebuild - so let's boost the builds so they don't take 2 hours
export BUILD_MACHINE_TYPE="n2-highcpu-32"
fi
elif [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-preview-cleaner" ]];then
export GITHUB_TOKEN=$(retry 5 vault kv get -field=value secret/ci/elastic-docs/docs_preview_cleaner)
elif [[ "$BUILDKITE_PIPELINE_SLUG" == "docs-build" ]];then
export BUILD_MACHINE_TYPE="n2-highcpu-32"
fi
2 changes: 1 addition & 1 deletion .buildkite/scripts/clean_preview_branches.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ssh-agent bash -c '
-v ~/.ssh/known_hosts:/root/.ssh/known_hosts:cached,ro \
-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK:cached,ro \
-e SSH_AUTH_SOCK=$SSH_AUTH_SOCK \
-e GITHUB_TOKEN=$VAULT_GITHUB_TOKEN \
-e GITHUB_TOKEN=$GITHUB_TOKEN \
-v /opt/git-mirrors:/opt/git-mirrors:cached,ro \
-e CACHE_DIR=/opt/git-mirrors \
$IMAGE node /docs_build/preview/clean.js $REPO'
4 changes: 3 additions & 1 deletion preview/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function Cleaner(token, repo, cache_dir, tmp_dir) {
if (found) {
acc.push({
branch: found[1],
// Temporary hack during the Buildkite migration that breaks the <repo>_<PR> convention,
// Temporary hack during the Buildkite migration that breaks the <repo>_<PR> convention,
// and introduces the <repo>_BK_<PR> convention - see https://github.com/elastic/docs-projects/issues/134
repo: found[2].includes('_bk') ? found[2].replace('_bk', '') : found[2],
number: Number(found[3]),
Expand Down Expand Up @@ -96,6 +96,7 @@ function Cleaner(token, repo, cache_dir, tmp_dir) {
}

const is_pr_closed = function (pr) {
console.log("Checking " + pr.repo + "-" + pr.number);
return new Promise((resolve, reject) => {
const body = {
query: `
Expand Down Expand Up @@ -136,6 +137,7 @@ function Cleaner(token, repo, cache_dir, tmp_dir) {
try {
const parsed = JSON.parse(data);
const repo = parsed.data.repository;
console.log(repo);
if (repo) {
closed = repo.pullRequest.closed;
} else {
Expand Down