Skip to content

Commit

Permalink
Merge remote-tracking branch 'addonfactory-ucc-base-ui/main' into ui-…
Browse files Browse the repository at this point in the history
…move
  • Loading branch information
vtsvetkov-splunk committed Oct 3, 2023
2 parents 7f0db28 + f226bee commit 935316e
Show file tree
Hide file tree
Showing 117 changed files with 35,283 additions and 0 deletions.
1 change: 1 addition & 0 deletions ui/.addonmatrix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--splunkfeatures METRICS_MULTI,PYTHON3
23 changes: 23 additions & 0 deletions ui/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org

root = true

[*]

# Change these settings to your own preference
indent_style = space
indent_size = 4

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.json]
indent_size = 2
29 changes: 29 additions & 0 deletions ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* eslint no-undef: "error" */
/* eslint-env node */
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'@splunk/eslint-config/browser',
'prettier',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript', // resolves import TS files from JS code
'plugin:jest/recommended',
'plugin:storybook/recommended',
],
plugins: ['@typescript-eslint', 'prettier', 'jest'],
env: {
'jest/globals': true,
},
globals: {
__DEV__: true,
window: true,
__non_webpack_require__: 'readonly',
},
rules: {
'prettier/prettier': 2,
indent: 'off',
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
'no-console': 'error',
},
root: true,
};
6 changes: 6 additions & 0 deletions ui/.fossa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 3
server: https://app.fossa.com

project:
id: "addonfactory-ucc-base-ui"
team: "TA-Automation"
22 changes: 22 additions & 0 deletions ui/.github/scripts/format_yarn_deps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import argparse
import sys


def main():
parser = argparse.ArgumentParser()
parser.add_argument("--output-file", type=str, required=True)
args = parser.parse_args()
result = []
if not sys.stdin.isatty():
yarn_deps = sys.stdin.readlines()
yarn_deps = yarn_deps[1:-1]
for yarn_dep in yarn_deps:
formatted_yarn_dep = yarn_dep.replace("├─ ", "").replace("└─ ", "")
result.append(formatted_yarn_dep)
with open(args.output_file, "w") as f:
for line in result:
f.writelines(line)


if __name__ == "__main__":
main()
18 changes: 18 additions & 0 deletions ui/.github/workflows/agreements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "CLA Assistant"
on:
issue_comment:
types: [created]
pull_request_target:
types: [opened, closed, synchronize]

jobs:
call-workflow-agreements:
uses: splunk/addonfactory-github-workflows/.github/workflows/reusable-agreements.yaml@v1
permissions:
actions: read
contents: read
pull-requests: write
statuses: read
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.PAT_CLATOOL }}
180 changes: 180 additions & 0 deletions ui/.github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
name: CI
on:
push:
branches:
- "main"
- "develop"
- "release/**"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches: [main, develop, "release/**"]

jobs:
meta:
runs-on: ubuntu-latest
outputs:
matrix_supportedSplunk: ${{ steps.matrix.outputs.supportedSplunk }}
steps:
- uses: actions/checkout@v3
- id: matrix
uses: splunk/addonfactory-test-matrix-action@v1
fossa-scan:
continue-on-error: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: run fossa anlyze and create report
run: |
curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install-latest.sh | bash
fossa analyze --debug
fossa report attribution --format text > /tmp/THIRDPARTY
env:
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}
- name: upload THIRDPARTY file
uses: actions/upload-artifact@v3
with:
name: THIRDPARTY
path: /tmp/THIRDPARTY
- name: run fossa test
run: |
fossa test --debug
env:
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}

compliance-copyrights:
name: Compliance Copyright Headers
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check License Header
uses: apache/skywalking-eyes@v0.4.0

semgrep:
runs-on: ubuntu-latest
name: security-sast-semgrep
if: github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@v3
- name: Semgrep
id: semgrep
uses: returntocorp/semgrep-action@v1
with:
publishToken: ${{ secrets.SEMGREP_PUBLISH_TOKEN }}

build:
name: Build Release
strategy:
matrix:
node-version: [14.21.2]
needs:
- compliance-copyrights
- fossa-scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
#Very Important semantic-release won't trigger a tagged
#build if this is not set false
persist-credentials: false

- uses: actions/setup-python@v4
with:
python-version: "3.7"

- run: npm install --global yarn

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ matrix.node-version }}
- uses: actions/download-artifact@v3
with:
name: THIRDPARTY

- run: yarn
- run: yarn run lint
- run: yarn run test
- run: yarn run build
- run: |
yarn list --prod --depth 0 | python .github/scripts/format_yarn_deps.py --output-file=dist/package/appserver/static/js/dependencies.txt
- run: tar -czvf /tmp/splunk-ucc-ui.tgz -C dist .
- uses: actions/upload-artifact@v3
with:
name: splunk-ucc-ui
path: /tmp/splunk-ucc-ui.tgz

- name: Semantic Release
uses: splunk/semantic-release-action@v1.3
with:
git_committer_name: ${{ secrets.SA_GH_USER_NAME }}
git_committer_email: ${{ secrets.SA_GH_USER_EMAIL }}
gpg_private_key: ${{ secrets.SA_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.SA_GPG_PASSPHRASE }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_ADMIN }}

test-ui:
name: test-ui Splunk ${{ matrix.splunk.version }} -m ${{ matrix.test-mark }}
if: |
github.base_ref == 'main' ||
github.ref_name == 'main'
runs-on: ubuntu-latest
continue-on-error: true
needs:
- meta
- build
strategy:
matrix:
splunk: ${{ fromJson(needs.meta.outputs.matrix_supportedSplunk) }}
test-mark:
- "logging"
- "proxy"
- "account"
- "custom"
- "alert"
- "input"
steps:
- uses: actions/checkout@v3
name: Checkout backend repo addonfactory-ucc-generator
with:
repository: splunk/addonfactory-ucc-generator
path: .
- uses: actions/setup-python@v4
with:
python-version: "3.7"
- run: curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
- run: poetry install
- name: Link chromedriver
# Use installed chromedriver https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
run: |
export PATH=$PATH:$CHROMEWEBDRIVER
chromedriver --version
- name: Download UI artifact from build job
uses: actions/download-artifact@v3
with:
name: splunk-ucc-ui
- run: |
tar -zxf splunk-ucc-ui.tgz -C splunk_add_on_ucc_framework/
poetry build
- run: poetry run ucc-gen build --source tests/testdata/test_addons/package_global_config_everything/package
- run: |
./run_splunk.sh ${{ matrix.splunk.version }}
until curl -Lsk "https://localhost:8088/services/collector/health" &>/dev/null ; do echo -n "Waiting for HEC-" && sleep 5 ; done
timeout-minutes: 5
- run: poetry run pytest tests/ui -m "${{ matrix.test-mark }}" --headless --junitxml=test-results/junit.xml
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: test-results-ui-${{ matrix.test-mark }}
path: test-results/*
6 changes: 6 additions & 0 deletions ui/.github/workflows/exclude-patterns.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.github/workflows/
.*\.lock$
^test/
^examples/
^contrib/common
^deps/
Loading

0 comments on commit 935316e

Please sign in to comment.