mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-18 13:06:30 -06:00
Merge pull request #7204 from netbox-community/7202-verify-static-assets
Verify integrity of bundled assets in CI
This commit is contained in:
commit
7234b3bbf8
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -58,6 +58,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Check UI ESLint, TypeScript, and Prettier Compliance
|
- name: Check UI ESLint, TypeScript, and Prettier Compliance
|
||||||
run: yarn --cwd netbox/project-static validate
|
run: yarn --cwd netbox/project-static validate
|
||||||
|
|
||||||
|
- name: Validate Static Asset Integrity
|
||||||
|
run: scripts/verify-bundles.sh
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: coverage run --source="netbox/" netbox/manage.py test netbox/
|
run: coverage run --source="netbox/" netbox/manage.py test netbox/
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## v3.0.2 (FUTURE)
|
## v3.0.2 (FUTURE)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
* [#7131](https://github.com/netbox-community/netbox/issues/7131) - Fix issue where Site fields were hidden when editing a VLAN group
|
* [#7131](https://github.com/netbox-community/netbox/issues/7131) - Fix issue where Site fields were hidden when editing a VLAN group
|
||||||
* [#7148](https://github.com/netbox-community/netbox/issues/7148) - Fix issue where static query parameters with multiple values were not queried properly
|
* [#7148](https://github.com/netbox-community/netbox/issues/7148) - Fix issue where static query parameters with multiple values were not queried properly
|
||||||
* [#7153](https://github.com/netbox-community/netbox/issues/7153) - Allow clearing of assigned device type images
|
* [#7153](https://github.com/netbox-community/netbox/issues/7153) - Allow clearing of assigned device type images
|
||||||
|
41
scripts/verify-bundles.sh
Executable file
41
scripts/verify-bundles.sh
Executable file
@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This script verifies the integrity of *bundled* static assets by re-running the bundling process
|
||||||
|
# and checking for changed files. Because bundle output should not change given the same source
|
||||||
|
# input, the bundle process shouldn't produce any changes. If they do, it's an indication that
|
||||||
|
# the dist files have been altered, or that dist files were not committed. In either case, tests
|
||||||
|
# should fail.
|
||||||
|
|
||||||
|
PROJECT_STATIC="$PWD/netbox/project-static"
|
||||||
|
DIST="$PROJECT_STATIC/dist/"
|
||||||
|
|
||||||
|
# Bundle static assets.
|
||||||
|
bundle() {
|
||||||
|
echo "Bundling static assets..."
|
||||||
|
yarn --cwd $PROJECT_STATIC bundle >/dev/null 2>&1
|
||||||
|
if [[ $? != 0 ]]; then
|
||||||
|
echo "Error bundling static assets"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# See if any files have changed.
|
||||||
|
check_dist() {
|
||||||
|
local diff=$(git --no-pager diff $DIST)
|
||||||
|
if [[ $diff != "" ]]; then
|
||||||
|
local SHA=$(git rev-parse HEAD)
|
||||||
|
echo "Commit '$SHA' produced different static assets than were committed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
bundle
|
||||||
|
check_dist
|
||||||
|
|
||||||
|
if [[ $? = 0 ]]; then
|
||||||
|
echo "Static asset check passed"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Error checking static asset integrity"
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user