Skip to content

Commit

Permalink
Merge branch 'main' into snyk-upgrade-36d60602c40679bce354b0273d5befff
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen authored Aug 11, 2023
2 parents 0770c87 + a9db3ed commit 9f8e702
Show file tree
Hide file tree
Showing 2,842 changed files with 47,974 additions and 29,747 deletions.
4 changes: 2 additions & 2 deletions .babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ module.exports = {
"corejs": !process.env.NO_COREJS_POLYFILL ? '3.6' : undefined,
"modules": process.env.BABEL_MODULES ? process.env.BABEL_MODULES === 'false' ? false : process.env.BABEL_MODULES : "commonjs" // babel's default is commonjs
}],
["@babel/typescript", { isTSX: true, allExtensions: true }],
"@babel/react",
["@babel/react", { runtime: 'classic' }],
["@babel/typescript", { isTSX: true, allExtensions: true, allowDeclareFields: true }],
[
"@emotion/babel-preset-css-prop",
{
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ agents:

steps:
- label: ":wave: Greetings!"
command: "echo 'My first EUI pipeline!'"
command: "echo 'The EUI CI pipeline, now with more robots'"
9 changes: 5 additions & 4 deletions .buildkite/pipelines/pipeline_pull_request_deploy_docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 🏠/.buildkite/pipelines/pipeline_pull_request_test.yml
## 🏠/.buildkite/pipelines/pipeline_pull_request_deploy_docs.yml

steps:
- label: ":hammer: EUI pull request deploy docs"
command: "echo 'This will deploy our EUI docs!'"

- agents:
provider: "gcp"
command: .buildkite/scripts/pipeline_deploy_docs.sh
if: build.branch != "main" # We don't want to deploy docs on main, only on manual release
9 changes: 6 additions & 3 deletions .buildkite/pipelines/pipeline_pull_request_test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# 🏠/.buildkite/pipelines/pipeline_pull_request_test.yml

steps:
- label: ":hammer: EUI pull request test"
command: "echo 'This will run our EUI tests!'"

- agents:
provider: "gcp"
command: .buildkite/scripts/pipeline_test.sh
if: build.branch != "main" # We're skipping testing commits in main for now to maintain parity with previous Jenkins setup
artifact_paths:
- "cypress/screenshots/**/*.png"
17 changes: 17 additions & 0 deletions .buildkite/pipelines/pipeline_pull_request_test_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## 🏠/.buildkite/pipelines/pipeline_pull_request_test_and_deploy.yml

steps:
- trigger: "eui-pull-request-test"
label: ":hammer: EUI pull request test"
build:
branch: "${BUILDKITE_BRANCH}"
commit: "${BUILDKITE_COMMIT}"
- trigger: "eui-pull-request-deploy-docs"
label: ":newspaper: EUI pull request deploy docs"
build:
branch: "${BUILDKITE_BRANCH}"
commit: "${BUILDKITE_COMMIT}"
env:
GIT_BRANCH: "${BUILDKITE_BRANCH}"
GIT_PULL_REQUEST_ID: "${BUILDKITE_PULL_REQUEST}"
BUILDKITE_CI: "${BUILDKITE}"
10 changes: 10 additions & 0 deletions .buildkite/pipelines/pipeline_release_deploy_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## 🏠/.buildkite/pipelines/pipeline_release_deploy_docs.yml

steps:
- agents:
provider: "gcp"
command: .buildkite/scripts/pipeline_deploy_docs.sh
env:
GIT_BRANCH: "${BUILDKITE_BRANCH}"
GIT_PULL_REQUEST_ID: "${BUILDKITE_PULL_REQUEST}"
BUILDKITE_CI: "${BUILDKITE}"
16 changes: 16 additions & 0 deletions .buildkite/pull-requests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"jobs": [
{
"enabled": true,
"pipeline_slug": "eui-pull-request-test-and-deploy",
"allow_org_users": true,
"allowed_repo_permissions": ["admin", "write"],
"build_on_commit": true,
"build_on_comment": true,
"trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))",
"always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))",
"set_commit_status": true,
"skip_ci_on_only_changed": ["^.github/", "^generator-eui/", "^wiki/"]
}
]
}
52 changes: 52 additions & 0 deletions .buildkite/scripts/pipeline_deploy_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

set -euo pipefail
set +x

function retry {
local retries=$1
shift

local count=0

until "$@"; do
exit=$?
wait=$((2 ** count))
count=$((count + 1))

if [ $count -lt "$retries" ]; then
>&2 echo "Retry $count of $retries exited $exit. Retrying in $wait seconds."
else
>&2 echo "Retry $count of $retries exited $exit. No retries left."
return $exit
fi

done
return 0
}

VAULT_ACCOUNT=secret/ci/elastic-eui/bekitzur-kibana-service-account
GITHUB_ACCOUNT=secret/ci/elastic-eui/kibanamachine

GCE_ACCOUNT=$(retry 5 vault read -field=value $VAULT_ACCOUNT)
if [[ -z "${GCE_ACCOUNT}" ]]; then
echo ":fire: GCP credentials not set." 1>&2
exit 1
fi

GITHUB_TOKEN=$(retry 5 vault read -field=github_token $GITHUB_ACCOUNT)
if [[ -z "${GITHUB_TOKEN}" ]]; then
echo ":fire: GitHub token not set." 1>&2
exit 1
fi

export GPROJECT=elastic-bekitzur
export GCE_ACCOUNT
export GITHUB_TOKEN

unset VAULT_ACCOUNT GITHUB_ACCOUNT

# Run EUI build/deploy script, set in the template parameter
# Expects env: GPROJECT, GCE_ACCOUNT, GIT_BRANCH, GITHUB_TOKEN
./scripts/deploy/deploy_docs

16 changes: 16 additions & 0 deletions .buildkite/scripts/pipeline_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -euo pipefail

docker run \
-i --rm \
--env GIT_COMMITTER_NAME=test \
--env GIT_COMMITTER_EMAIL=test \
--env HOME=/tmp \
--user="$(id -u):$(id -g)" \
--volume="$(pwd):/app" \
--workdir=/app \
docker.elastic.co/eui/ci:5.2 \
bash -c "/opt/yarn*/bin/yarn \
&& yarn cypress install \
&& NODE_OPTIONS=\"--max-old-space-size=2048\" npm run test-ci"
2 changes: 1 addition & 1 deletion .ci/jobs/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
CI=true
HOME=$JENKINS_HOME
concurrent: true
node: linux && !oraclelinux
node: ubuntu-20.04
scm:
- git:
name: origin
Expand Down
3 changes: 2 additions & 1 deletion .ci/jobs/elastic+eui+deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
export VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id="$VAULT_ROLE_ID" secret_id="$VAULT_SECRET_ID")
export GCE_ACCOUNT=$(vault read -field=value $VAULT_ACCOUNT)
export GITHUB_TOKEN=$(vault read -field=github_token secret/kibana-issues/dev/kibanamachine)
export JENKINS_CI="true"
unset VAULT_ROLE_ID VAULT_SECRET_ID VAULT_ADDR VAULT_TOKEN VAULT_ACCOUNT
# Run EUI build/deploy script, set in the template parameter
# Expects env: GPROJECT, GCE_ACCOUNT, GIT_BRANCH, GITHUB_TOKEN
# Expects env: GPROJECT, GCE_ACCOUNT, GIT_BRANCH, GITHUB_TOKEN, JENKINS_CI
./scripts/deploy/deploy_docs
3 changes: 2 additions & 1 deletion .ci/jobs/elastic+eui+pull-request-deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
export VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id="$VAULT_ROLE_ID" secret_id="$VAULT_SECRET_ID")
export GCE_ACCOUNT=$(vault read -field=value $VAULT_ACCOUNT)
export GITHUB_TOKEN=$(vault read -field=github_token secret/kibana-issues/dev/kibanamachine)
export JENKINS_CI="true"
unset VAULT_ROLE_ID VAULT_SECRET_ID VAULT_ADDR VAULT_TOKEN VAULT_ACCOUNT
# Run EUI build/deploy script, set in the template parameter
# Expects env: GPROJECT, GCE_ACCOUNT, GIT_BRANCH, GITHUB_TOKEN
# Expects env: GPROJECT, GCE_ACCOUNT, GIT_BRANCH, GITHUB_TOKEN, JENKINS_CI
./scripts/deploy/deploy_docs
2 changes: 1 addition & 1 deletion .ci/jobs/elastic+eui+pull-request-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#!/usr/local/bin/runbld
export NVM_DIR="/var/lib/jenkins/.nvm"
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh"
NODE_VERSION=16.19.1
NODE_VERSION=18.17.0
nvm install ${NODE_VERSION}
nvm use ${NODE_VERSION} --delete-prefix
npm run test-docker
Expand Down
13 changes: 1 addition & 12 deletions .ci/jobs/elastic+eui+pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,7 @@
project-type: multijob
concurrent: true
node: master
triggers:
- github-pull-request:
org-list:
- elastic
white-list:
- renovate
- renovatebot
allow-whitelist-orgs-as-admins: true
trigger-phrase: '(.*(?:jenkins\W+)?test\W+(?:this|it)(?:\W+please)?.*)|^retest$'
github-hooks: true
status-context: eui-ci
cancel-builds-on-update: true
triggers: [] # Pull request job can now only be triggered from Jenkins UI
builders:
- multijob:
name: run child jobs
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ generator-eui
cypress
react-datepicker
.eslintrc.js
!.storybook
1 change: 0 additions & 1 deletion .eslintplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ exports.rules = {
'require-license-header': require('./scripts/eslint-plugin/require_license_header'),
'forward-ref': require('./scripts/eslint-plugin/forward_ref_display_name'),
'css-logical-properties': require('./scripts/eslint-plugin/css_logical_properties'),
css_before_spread_props: require('./scripts/eslint-plugin/css_before_spread_props'),
'require-cypress-references': require('./scripts/eslint-plugin/require_cypress_references'),
};
71 changes: 55 additions & 16 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const SSPL_ELASTIC_2_0_LICENSE_HEADER = `
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json', './cypress/tsconfig.json'],
project: [
'./tsconfig.json',
'./cypress/tsconfig.json',
'./.storybook/tsconfig.json',
],
ecmaFeatures: {
jsx: true,
},
Expand All @@ -30,32 +34,68 @@ module.exports = {
},
},
extends: [
'@elastic/eslint-config-kibana',
'plugin:@typescript-eslint/recommended',
// Prettier options need to come last, in order to override other style
// rules.
'prettier/react',
'prettier/standard',
'plugin:storybook/recommended',
// Prettier options need to come last, in order to override other style rules
'plugin:prettier/recommended',
],
plugins: ['jsx-a11y', 'prettier', 'local', 'react-hooks', '@emotion'],
plugins: [
'mocha',
'jsx-a11y',
'local',
'import',
'react',
'react-hooks',
'@emotion',
],
rules: {
'block-scoped-var': 'error',
camelcase: 'off',
'dot-notation': ['error', { allowKeywords: true }],
eqeqeq: ['error', 'always', { null: 'ignore' }],
'guard-for-in': 'error',
'new-cap': ['error', { capIsNewExceptions: ['Private'] }],
'no-caller': 'error',
'no-const-assign': 'error',
'no-debugger': 'error',
'no-empty': ['error', { allowEmptyCatch: true }],
'no-eval': 'error',
'no-extend-native': 'error',
'no-global-assign': 'error',
'no-loop-func': 'error',
'no-restricted-globals': ['error', 'context'],
'no-script-url': 'error',
'no-sequences': 'error',
'no-var': 'error',
'no-with': 'error',
'prefer-const': 'error',
'prefer-template': 'error',
strict: ['error', 'never'],
'valid-typeof': 'error',

'local/i18n': 'error',
'local/href-with-rel': 'error',
'local/forward-ref': 'error',
'local/css-logical-properties': 'error',
'local/css_before_spread_props': 'error',
'local/require-cypress-references': 'error',
'local/require-license-header': [
'warn',
{
license: SSPL_ELASTIC_2_0_LICENSE_HEADER,
},
],
'no-use-before-define': 'off',
quotes: ['warn', 'single', 'avoid-escape'],
camelcase: 'off',

'import/no-unresolved': ['error', { amd: true, commonjs: true }],
'import/namespace': 'error',
'import/default': 'error',
'import/export': 'error',
'import/no-named-as-default': 'error',
'import/no-named-as-default-member': 'error',
'import/no-duplicates': 'error',

'mocha/handle-done-callback': 'error',
'mocha/no-exclusive-tests': 'error',

'jsx-a11y/accessible-emoji': 'error',
'jsx-a11y/alt-text': 'error',
'jsx-a11y/anchor-has-content': 'error',
Expand All @@ -82,6 +122,10 @@ module.exports = {
'jsx-a11y/tabindex-no-positive': 'error',
'jsx-a11y/label-has-associated-control': 'error',

'react/jsx-uses-vars': 'error',
'react/jsx-no-undef': 'error',
'react/jsx-pascal-case': 'error',

'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',

Expand Down Expand Up @@ -119,16 +163,11 @@ module.exports = {
{ fixMixedExportsWithInlineTypeSpecifier: false },
],
},
env: {
jest: true,
},
overrides: [
{
files: ['*.d.ts'],
rules: {
'react/no-multi-comp': 'off',
'react/prefer-es6-class': 'off',
'react/prefer-stateless-function': 'off',
},
},
],
Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ assignees: ''
A clear and concise description of what the bug is.

**Environment and versions**
- EUI version:
- EUI version:
- React version:
- Kibana version (if applicable):
- Browser:
- Operating System:
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions .github/workflows/label_commenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Auto-respond to issues with comments based on labels

on:
issues:
types: [labeled, unlabeled]
types: [labeled]

permissions:
contents: read
Expand All @@ -17,4 +17,4 @@ jobs:
- name: Label Commenter
uses: peaceiris/actions-label-commenter@v1
with:
config_file: .github/workflows/label_commenter_config.yml
config_file: .github/config/label_commenter_config.yml
2 changes: 1 addition & 1 deletion .github/workflows/stale_issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
stale-issue-label: 'stale-issue'
close-issue-label: 'stale-issue-closed'
close-issue-reason: 'not_planned'
exempt-issue-labels: 'bug,meta'
exempt-issue-labels: 'bug,meta,task'
operations-per-run: 1000
remove-stale-when-updated: true
enable-statistics: true
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.19.1
18.17.0
Loading

0 comments on commit 9f8e702

Please sign in to comment.