-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into alerting/smarter-retry-interval
- Loading branch information
Showing
362 changed files
with
9,762 additions
and
5,419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
.buildkite/scripts/steps/webpack_bundle_analyzer/build_and_upload.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
.buildkite/scripts/bootstrap.sh | ||
|
||
node scripts/build_kibana_platform_plugins.js --dist --profile | ||
|
||
mkdir -p built_assets/webpack_bundle_analyzer | ||
find . -path "*target/public/*" -name "stats.json" | while read line; do | ||
PLUGIN=$(echo $line | xargs dirname | xargs dirname | xargs dirname | xargs basename) | ||
./node_modules/.bin/webpack-bundle-analyzer $line --report "built_assets/webpack_bundle_analyzer/$PLUGIN.html" --mode static --no-open | ||
done | ||
|
||
node .buildkite/scripts/steps/webpack_bundle_analyzer/upload.js |
79 changes: 79 additions & 0 deletions
79
.buildkite/scripts/steps/webpack_bundle_analyzer/upload.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
const execSync = require('child_process').execSync; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const GITHUB_CONTEXT = 'Build and Publish Webpack bundle analyzer reports'; | ||
|
||
const WEBPACK_REPORTS = | ||
process.env.BUILDKITE_PULL_REQUEST && process.env.BUILDKITE_PULL_REQUEST !== 'false' | ||
? `pr-${process.env.BUILDKITE_PULL_REQUEST}` | ||
: process.env.BUILDKITE_BRANCH.replace('/', '__'); | ||
const WEBPACK_REPORTS_BUCKET = 'ci-artifacts.kibana.dev/webpack_bundle_analyzer'; | ||
const WEBPACK_REPORTS_BUCKET_URL = `https://${WEBPACK_REPORTS_BUCKET}/${WEBPACK_REPORTS}`; | ||
const WEBPACK_REPORTS_BASE_URL = `${WEBPACK_REPORTS_BUCKET_URL}/${process.env.BUILDKITE_COMMIT}`; | ||
|
||
const exec = (...args) => execSync(args.join(' '), { stdio: 'inherit' }); | ||
|
||
const ghStatus = (state, description) => | ||
exec( | ||
`gh api "repos/elastic/kibana/statuses/${process.env.BUILDKITE_COMMIT}"`, | ||
`-f state=${state}`, | ||
`-f target_url="${process.env.BUILDKITE_BUILD_URL}"`, | ||
`-f context="${GITHUB_CONTEXT}"`, | ||
`-f description="${description}"`, | ||
`--silent` | ||
); | ||
|
||
const upload = () => { | ||
const originalDirectory = process.cwd(); | ||
process.chdir(path.join('.', 'built_assets', 'webpack_bundle_analyzer')); | ||
try { | ||
const reports = execSync(`ls -1`).toString().trim().split('\n'); | ||
const listHtml = reports | ||
.map((report) => `<li><a href="${WEBPACK_REPORTS_BASE_URL}/${report}">${report}</a></li>`) | ||
.join('\n'); | ||
|
||
const html = ` | ||
<html> | ||
<body> | ||
<h1>Webpack Bundle Analyzer</h1> | ||
<ul> | ||
${listHtml} | ||
</ul> | ||
</body> | ||
</html> | ||
`; | ||
|
||
fs.writeFileSync('index.html', html); | ||
console.log('--- Uploading Webpack Bundle Analyzer reports'); | ||
exec(` | ||
gsutil -q -m cp -r -z html '*' 'gs://${WEBPACK_REPORTS_BUCKET}/${WEBPACK_REPORTS}/${process.env.BUILDKITE_COMMIT}/' | ||
gsutil -h "Cache-Control:no-cache, max-age=0, no-transform" cp -z html 'index.html' 'gs://${WEBPACK_REPORTS_BUCKET}/${WEBPACK_REPORTS}/latest/' | ||
`); | ||
|
||
if (process.env.BUILDKITE_PULL_REQUEST && process.env.BUILDKITE_PULL_REQUEST !== 'false') { | ||
exec( | ||
`buildkite-agent meta-data set pr_comment:webpack_bundle_reports:head '* [Webpack Bundle Analyzer](${WEBPACK_REPORTS_BASE_URL})'` | ||
); | ||
} | ||
} finally { | ||
process.chdir(originalDirectory); | ||
} | ||
}; | ||
|
||
try { | ||
ghStatus('pending', 'Building Webpack Bundle Analyzer reports'); | ||
upload(); | ||
ghStatus('success', 'Webpack bundle analyzer reports built'); | ||
} catch (error) { | ||
ghStatus('error', 'Building Webpack Bundle Analyzer reports failed'); | ||
throw error; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Elastic Builder | ||
on: | ||
pull_request_target: | ||
paths: | ||
- '**.mdx' | ||
- '**.docnav.json' | ||
- '**.png' | ||
- '**.gif' | ||
types: [closed, opened, synchronize, reopened] | ||
|
||
jobs: | ||
preview: | ||
name: Do the magic | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup workspace | ||
uses: actions/checkout@v2 | ||
|
||
- name: Checkout current branch into temp | ||
if: github.event.pull_request.merged == false | ||
uses: actions/checkout@v2 | ||
with: | ||
path: 'temp' | ||
fetch-depth: 2 | ||
ref: refs/pull/${{ github.event.pull_request.number }}/merge | ||
|
||
- name: Checkout current branch into temp | ||
if: github.event.pull_request.merged == true | ||
uses: actions/checkout@v2 | ||
with: | ||
path: 'temp' | ||
|
||
- name: Checkout essential repos | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: elastic/docs.elastic.dev | ||
token: ${{ secrets.VERCEL_GITHUB_TOKEN }} | ||
path: ${{ github.workspace }}/docs.elastic.dev | ||
|
||
- name: Checkout Wordlake | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: elastic/wordlake-dev | ||
token: ${{ secrets.VERCEL_GITHUB_TOKEN }} | ||
path: ${{ github.workspace }}/wordlake-dev | ||
|
||
- name: Temp sources override | ||
shell: bash | ||
run: cp -f ${{ github.workspace }}/wordlake-dev/.scaffold/sources.json ${{ github.workspace }}/docs.elastic.dev/. | ||
|
||
- name: Show workspace | ||
shell: bash | ||
run: ls -lat ${{ github.workspace }} | ||
|
||
- name: Portal | ||
shell: bash | ||
run: | | ||
mkdir -p ${{ github.workspace }}/wordlake-dev/${{ github.event.repository.name }} | ||
rsync --ignore-missing-args -zavpm --include='*.docnav.json' --include='*.mdx' --include='*.png' --include='*.gif' --include='*/' --exclude='*' ${{ github.workspace }}/temp/ ${{ github.workspace }}/wordlake-dev/${{ github.event.repository.name }}/ | ||
- name: Generate preview | ||
if: github.event.pull_request.merged == false | ||
uses: elastic/[email protected] | ||
with: | ||
vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required | ||
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} #Required | ||
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_DOCS_DEV}} #Required | ||
vercel-project-name: docs-elastic-dev | ||
github-token: ${{ secrets.VERCEL_GITHUB_TOKEN }} #Optional | ||
working-directory: ./ | ||
|
||
- name: Portal for deploy | ||
if: github.event.pull_request.merged == true | ||
shell: bash | ||
run: | | ||
cd ${{ github.workspace }}/wordlake-dev | ||
git config user.name count-docula | ||
git config user.email [email protected] | ||
git add . | ||
git commit -m "New content from https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.