Skip to content

Commit

Permalink
Gets rid of github-checks-reporter (opensearch-project#3126)
Browse files Browse the repository at this point in the history
Signed-off-by: Miki <miki@amazon.com>
(cherry picked from commit 5116f16)
  • Loading branch information
AMoo-Miki authored and zhongnansu committed Feb 9, 2023
1 parent 8471327 commit 56891d3
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 329 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

- Add `target` folders of `test_utils` and `core` to the `osd clean` patterns ([#1442](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/1442))
- Remove storybook package and related code ([#2660](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2660))
- Remove `github-checks-reporter`, an unused dependency ([#3126](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3126))

### 🪛 Refactoring

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@
"@elastic/eslint-config-kibana": "0.15.0",
"@elastic/eslint-plugin-eui": "0.0.2",
"@elastic/filesaver": "1.1.2",
"@elastic/github-checks-reporter": "0.0.20b3",
"@elastic/makelogs": "^6.0.0",
"@osd/babel-preset": "1.0.0",
"@osd/dev-utils": "1.0.0",
Expand Down
23 changes: 1 addition & 22 deletions src/dev/ci_setup/setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,13 @@ yarn config set yarn-offline-mirror "$cacheDir/yarn-offline-cache"
yarnGlobalDir="$(yarn global bin)"
export PATH="$PATH:$yarnGlobalDir"

# TODO: Find out if these are OSD's or if this entire file should be removed
# use a proxy to fetch chromedriver/geckodriver asset
export GECKODRIVER_CDNURL="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache"
export CHROMEDRIVER_CDNURL="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache"
export RE2_DOWNLOAD_MIRROR="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache"
export CYPRESS_DOWNLOAD_MIRROR="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/cypress"

export CHECKS_REPORTER_ACTIVE=false

# This is mainly for release-manager builds, which run in an environment that doesn't have Chrome installed
if [[ "$(which google-chrome-stable)" || "$(which google-chrome)" ]]; then
echo "Chrome detected, setting DETECT_CHROMEDRIVER_VERSION=true"
Expand All @@ -132,26 +131,6 @@ else
echo "Chrome not detected, installing default chromedriver binary for the package version"
fi

### only run on pr jobs for opensearch-project/OpenSearch-Dashboards, checks-reporter doesn't work for other repos
if [[ "$ghprbPullId" && "$ghprbGhRepository" == 'opensearch-project/OpenSearch-Dashboards' ]] ; then
export CHECKS_REPORTER_ACTIVE=true
fi

###
### Implements github-checks-reporter kill switch when scripts are called from the command line
### $@ - all arguments
###
function checks-reporter-with-killswitch() {
if [ "$CHECKS_REPORTER_ACTIVE" == "true" ] ; then
yarn run github-checks-reporter "$@"
else
arguments=("$@");
"${arguments[@]:1}";
fi
}

export -f checks-reporter-with-killswitch

source "$OPENSEARCH_DASHBOARDS_DIR/src/dev/ci_setup/load_env_keys.sh"

OPENSEARCH_DIR="$WORKSPACE/opensearch"
Expand Down
134 changes: 53 additions & 81 deletions tasks/config/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,107 +40,82 @@ const OPENSEARCH_DASHBOARDS_INSTALL_DIR =
module.exports = function () {
const NODE = 'node';
const YARN = 'yarn';
const scriptWithGithubChecks = ({ title, options, cmd, args }) =>
process.env.CHECKS_REPORTER_ACTIVE === 'true'
? {
options,
cmd: YARN,
args: ['run', 'github-checks-reporter', title, cmd, ...args],
}
: { options, cmd, args };
const gruntTaskWithGithubChecks = (title, task) =>
scriptWithGithubChecks({
title,
cmd: YARN,
args: ['run', 'grunt', task],
});

return {
// used by the test and jenkins:unit tasks
// runs the eslint script to check for linting errors
eslint: scriptWithGithubChecks({
title: 'eslint',
eslint: {
cmd: NODE,
args: ['scripts/eslint', '--no-cache'],
}),
},

sasslint: scriptWithGithubChecks({
title: 'sasslint',
stylelint: {
cmd: NODE,
args: ['scripts/sasslint'],
}),
args: ['scripts/stylelint'],
},

// used by the test tasks
// runs the check_file_casing script to ensure filenames use correct casing
checkFileCasing: scriptWithGithubChecks({
title: 'Check file casing',
checkFileCasing: {
cmd: NODE,
args: [
'scripts/check_file_casing',
'--quiet', // only log errors, not warnings
],
}),
},

// used by the test tasks
// runs the check_lockfile_symlinks script to ensure manifests with non-dev dependencies have adjacent lockfile symlinks
checkLockfileSymlinks: scriptWithGithubChecks({
title: 'Check lockfile symlinks',
checkLockfileSymlinks: {
cmd: NODE,
args: [
'scripts/check_lockfile_symlinks',
'--quiet', // only log errors, not warnings
],
}),
},

// used by the test tasks
// runs the check_published_api_changes script to ensure API changes are explictily accepted
checkDocApiChanges: scriptWithGithubChecks({
title: 'Check core API changes',
checkDocApiChanges: {
cmd: NODE,
args: ['scripts/check_published_api_changes'],
}),
},

// used by the test and jenkins:unit tasks
// runs the typecheck script to check for Typescript type errors
typeCheck: scriptWithGithubChecks({
title: 'Type check',
typeCheck: {
cmd: NODE,
args: ['scripts/type_check'],
}),
},

// used by the test and jenkins:unit tasks
// ensures that all typescript files belong to a typescript project
checkTsProjects: scriptWithGithubChecks({
title: 'TypeScript - all files belong to a TypeScript project',
checkTsProjects: {
cmd: NODE,
args: ['scripts/check_ts_projects'],
}),
},

// used by the test and jenkins:unit tasks
// runs the i18n_check script to check i18n engine usage
i18nCheck: scriptWithGithubChecks({
title: 'Internationalization check',
i18nCheck: {
cmd: NODE,
args: ['scripts/i18n_check', '--ignore-missing'],
}),
},

telemetryCheck: scriptWithGithubChecks({
title: 'Telemetry Schema check',
telemetryCheck: {
cmd: NODE,
args: ['scripts/telemetry_check'],
}),
},

// used by the test:quick task
// runs all node.js/server mocha tests
mocha: scriptWithGithubChecks({
title: 'Mocha tests',
mocha: {
cmd: NODE,
args: ['scripts/mocha'],
}),
},

// used by the test:mochaCoverage task
mochaCoverage: scriptWithGithubChecks({
title: 'Mocha tests coverage',
mochaCoverage: {
cmd: YARN,
args: [
'nyc',
Expand All @@ -149,25 +124,22 @@ module.exports = function () {
NODE,
'scripts/mocha',
],
}),
},

verifyNotice: scriptWithGithubChecks({
title: 'Verify NOTICE.txt',
verifyNotice: {
options: {
wait: true,
},
cmd: NODE,
args: ['scripts/notice', '--validate'],
}),
},

test_hardening: scriptWithGithubChecks({
title: 'Node.js hardening tests',
test_hardening: {
cmd: NODE,
args: ['scripts/test_hardening.js'],
}),
},

apiIntegrationTests: scriptWithGithubChecks({
title: 'API integration tests',
apiIntegrationTests: {
cmd: NODE,
args: [
'scripts/functional_tests',
Expand All @@ -176,10 +148,9 @@ module.exports = function () {
'--bail',
'--debug',
],
}),
},

serverIntegrationTests: scriptWithGithubChecks({
title: 'Server integration tests',
serverIntegrationTests: {
cmd: NODE,
args: [
'scripts/functional_tests',
Expand All @@ -198,10 +169,9 @@ module.exports = function () {
'--opensearch-dashboards-install-dir',
OPENSEARCH_DASHBOARDS_INSTALL_DIR,
],
}),
},

interpreterFunctionalTestsRelease: scriptWithGithubChecks({
title: 'Interpreter functional tests',
interpreterFunctionalTestsRelease: {
cmd: NODE,
args: [
'scripts/functional_tests',
Expand All @@ -212,10 +182,9 @@ module.exports = function () {
'--opensearch-dashboards-install-dir',
OPENSEARCH_DASHBOARDS_INSTALL_DIR,
],
}),
},

pluginFunctionalTestsRelease: scriptWithGithubChecks({
title: 'Plugin functional tests',
pluginFunctionalTestsRelease: {
cmd: NODE,
args: [
'scripts/functional_tests',
Expand All @@ -224,10 +193,9 @@ module.exports = function () {
'--bail',
'--debug',
],
}),
},

exampleFunctionalTestsRelease: scriptWithGithubChecks({
title: 'Example functional tests',
exampleFunctionalTestsRelease: {
cmd: NODE,
args: [
'scripts/functional_tests',
Expand All @@ -236,10 +204,9 @@ module.exports = function () {
'--bail',
'--debug',
],
}),
},

functionalTests: scriptWithGithubChecks({
title: 'Functional tests',
functionalTests: {
cmd: NODE,
args: [
'scripts/functional_tests',
Expand All @@ -248,20 +215,25 @@ module.exports = function () {
'--bail',
'--debug',
],
}),
},

licenses: scriptWithGithubChecks({
title: 'Check licenses',
licenses: {
cmd: NODE,
args: ['scripts/check_licenses', '--dev'],
}),
},

test_jest: gruntTaskWithGithubChecks('Jest tests', 'test:jest'),
test_jest_integration: gruntTaskWithGithubChecks(
'Jest integration tests',
'test:jest_integration'
),
test_projects: gruntTaskWithGithubChecks('Project tests', 'test:projects'),
test_jest: {
cmd: YARN,
args: ['run', 'grunt', 'test:jest'],
},
test_jest_integration: {
cmd: YARN,
args: ['run', 'grunt', 'test:jest_integration'],
},
test_projects: {
cmd: YARN,
args: ['run', 'grunt', 'test:projects'],
},

...getFunctionalTestGroupRunConfigs({
opensearchDashboardsInstallDir: OPENSEARCH_DASHBOARDS_INSTALL_DIR,
Expand Down
Loading

0 comments on commit 56891d3

Please sign in to comment.