Skip to content

Commit

Permalink
Moved the built flare folder to the root in an output folder to make …
Browse files Browse the repository at this point in the history
…the structure more readable
  • Loading branch information
Marc-Antoine Hinse committed Nov 27, 2024
1 parent 0bf3ad2 commit efc8a86
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ yarn-error.log
licenses.json
functional-temp
splunktional-temp

output/
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,32 @@ clean:
rm -rf packages/flare/bin/vendor
@unlink "/Applications/Splunk/etc/apps/flare" || true
@find . -type d -name "node_modules" -exec rm -rf {} +
rm -rf packages/flare/flare
@rm -f flare.tar.gz
rm -rf output/flare
@rm -f output/flare.tar.gz
@echo "Done."

.PHONY: package
package: packages/flare/bin/vendor
-@rm flare.tar.gz
@find packages/flare/flare/bin -type d -name "__pycache__" -exec rm -r {} +
-@rm -f output/flare.tar.gz
@find output/flare/bin -type d -name "__pycache__" -exec rm -r {} +
COPYFILE_DISABLE=1 tar \
--exclude='packages/flare/flare/local' \
--exclude='packages/flare/flare/metadata/local.meta' \
--exclude='output/flare/local' \
--exclude='output/flare/metadata/local.meta' \
--format ustar \
-C packages/flare \
-C output \
-cvzf \
"flare.tar.gz" \
"output/flare.tar.gz" \
"flare"

.PHONY: publish
publish: flare.tar.gz
curl -u "$(SPLUNKBASE_CREDS)" --request POST https://splunkbase.splunk.com/api/v1/app/7602/new_release/ -F "files[]=@./flare.tar.gz" -F "filename=flare.tar.gz" -F "splunk_versions=9.3" -F "visibility=true"
curl -u "$(SPLUNKBASE_CREDS)" --request POST https://splunkbase.splunk.com/api/v1/app/7602/new_release/ -F "files[]=@./output/flare.tar.gz" -F "filename=flare.tar.gz" -F "splunk_versions=9.3" -F "visibility=true"

.PHONY: validate
validate: venv-tools
@echo "Running Splunk AppInspect..."
@echo "If you get an error about \"libmagic\", run \"brew install libmagic\""
@venv-tools/bin/splunk-appinspect inspect --ci "packages/flare/flare" || \
@venv-tools/bin/splunk-appinspect inspect --ci "output/flare" || \
if test "$$?" -eq "102" || "$$?" -eq "103" ; then \
exit 0 ; \
else \
Expand All @@ -70,7 +70,7 @@ TAGS = advanced_xml alert_actions_conf ast bias cloud csv custom_search_commands
inspect-tags:
@for TAG in $(TAGS); do \
echo "Tag: $$TAG" ; \
venv-tools/bin/splunk-appinspect inspect --ci --included-tags $$TAG "packages/flare/flare" ; \
venv-tools/bin/splunk-appinspect inspect --ci --included-tags $$TAG "output/flare" ; \
done

.PHONY: test
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ strict_equality = True
disallow_incomplete_defs = True
disallow_untyped_defs = True
disallow_untyped_calls = True
exclude = (vendor*|flare/flare*)/$
exclude = (vendor*)/$
follow_imports = skip
mypy_path = packages/flare/bin/vendor
1 change: 0 additions & 1 deletion packages/flare/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
flare/
!/build.js
4 changes: 2 additions & 2 deletions packages/flare/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ if (!commands.includes(arg)) {
const runCommands = {
win32: {
build: () => shell.exec('set NODE_ENV=production&&.\\node_modules\\.bin\\webpack --mode=production'),
link: () => shell.exec('mklink /D "%SPLUNK_HOME%\\etc\\apps\\flare" "%cd%\\flare"'),
link: () => shell.exec('mklink /D "%SPLUNK_HOME%\\etc\\apps\\flare" "%cd%\\..\\..\\output\\flare"'),
},
nix: {
build: () => shell.exec('export NODE_ENV=production && ./node_modules/.bin/webpack --mode=production'),
unlink: () => shell.exec('unlink $SPLUNK_HOME/etc/apps/flare || true'),
link: () => shell.exec('ln -s $PWD/flare $SPLUNK_HOME/etc/apps/flare'),
link: () => shell.exec('ln -s $PWD/../../output/flare $SPLUNK_HOME/etc/apps/flare'),
},
};

Expand Down
8 changes: 4 additions & 4 deletions packages/flare/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ const entries = fs
module.exports = webpackMerge(baseConfig, {
entry: entries,
output: {
path: path.join(__dirname, 'flare/appserver/static/pages/'),
path: path.join(__dirname, '../../output/flare/appserver/static/pages/'),
filename: '[name].js',
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: path.join(__dirname, 'src/main/resources/splunk'),
to: path.join(__dirname, 'flare'),
to: path.join(__dirname, '../../output/flare'),
filter: (filepath) => { return !filepath.endsWith("README/splunk_create.spec.conf"); },
},
{
from: path.join(__dirname, 'bin'),
to: path.join(__dirname, 'flare/bin'),
to: path.join(__dirname, '../../output/flare/bin'),
},
{
from: path.join(__dirname, 'README'),
to: path.join(__dirname, 'flare/'),
to: path.join(__dirname, '../../output/flare/'),
},
],
}),
Expand Down

0 comments on commit efc8a86

Please sign in to comment.