forked from ansible/ansible-backstage-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·55 lines (43 loc) · 1.51 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·55 lines (43 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
set -euo pipefail
YARN_CMD="yarn"
# Optimize build performance
export NODE_OPTIONS="--max-old-space-size=16384"
$YARN_CMD install --immutable || {
echo "Yarn install failed, but continuing with available packages..."
echo "This may be due to native package build failures in hermetic environment"
}
echo "Running tsc"
$YARN_CMD tsc
echo "tsc completed successfully"
# Build all plugins
echo "Building all plugins"
$YARN_CMD build
# Handle different build types based on environment variables
if [ "${BUILD_TYPE:-}" = "portal" ]; then
echo "Building for Portal automation - excluding backstage-rhaap plugin"
# Remove backstage-rhaap plugin for portal builds
if [ -d "plugins/backstage-rhaap" ]; then
rm -rf plugins/backstage-rhaap
fi
# Export dynamic plugins for Portal automation
$YARN_CMD export-local
elif [ "${BUILD_TYPE:-}" = "rhdh" ]; then
echo "Building for RHDH - including only backstage-rhaap and scaffolder-backend-module-backstage-rhaap"
# Remove all plugins except the RHDH ones
for plugin_dir in plugins/*/; do
plugin_name=$(basename "$plugin_dir")
if [ "$plugin_name" != "backstage-rhaap" ] && [ "$plugin_name" != "scaffolder-backend-module-backstage-rhaap" ]; then
if [ -d "$plugin_dir" ]; then
rm -rf "$plugin_dir"
fi
fi
done
# Export only RHDH plugins
$YARN_CMD export-local
else
echo "Building all plugins (default behavior)"
# Export all plugins (default behavior)
$YARN_CMD export-local
fi
echo "Dynamic plugins built successfully"