mirror of https://github.com/coder/coder.git
Check AGPL code doesn't import enterprise (#3602)
* Check AGPL code doesn't import enterprise Signed-off-by: Spike Curtis <spike@coder.com> * use error/log instead of echo/exit Signed-off-by: Spike Curtis <spike@coder.com> Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
parent
91bfcca287
commit
690e6c6585
|
@ -102,6 +102,15 @@ jobs:
|
|||
with:
|
||||
version: v1.46.0
|
||||
|
||||
check-enterprise-imports:
|
||||
name: check/enterprise-imports
|
||||
timeout-minutes: 5
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Check imports of enterprise code
|
||||
run: ./scripts/check_enterprise_imports.sh
|
||||
|
||||
style-lint-shellcheck:
|
||||
name: style/lint/shellcheck
|
||||
timeout-minutes: 5
|
||||
|
|
1
Makefile
1
Makefile
|
@ -116,6 +116,7 @@ lint: lint/shellcheck lint/go
|
|||
.PHONY: lint
|
||||
|
||||
lint/go:
|
||||
./scripts/check_enterprise_imports.sh
|
||||
golangci-lint run
|
||||
.PHONY: lint/go
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This file checks all our AGPL licensed source files to be sure they don't
|
||||
# import any enterprise licensed packages (the inverse is fine).
|
||||
|
||||
set -euo pipefail
|
||||
# shellcheck source=scripts/lib.sh
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||||
cdroot
|
||||
|
||||
set +e
|
||||
find . -regex ".*\.go" | grep -v "./enterprise" | xargs grep -n "github.com/coder/coder/enterprise"
|
||||
# reverse the exit code because we want this script to fail if grep finds anything.
|
||||
status=$?
|
||||
set -e
|
||||
if [ $status -eq 0 ]; then
|
||||
error "AGPL code cannot import enterprise!"
|
||||
fi
|
||||
log "AGPL imports OK"
|
Loading…
Reference in New Issue