Skip to content

Commit 690e6c6

Browse files
authored
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>
1 parent 91bfcca commit 690e6c6

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

.github/workflows/coder.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ jobs:
102102
with:
103103
version: v1.46.0
104104

105+
check-enterprise-imports:
106+
name: check/enterprise-imports
107+
timeout-minutes: 5
108+
runs-on: ubuntu-latest
109+
steps:
110+
- uses: actions/checkout@v3
111+
- name: Check imports of enterprise code
112+
run: ./scripts/check_enterprise_imports.sh
113+
105114
style-lint-shellcheck:
106115
name: style/lint/shellcheck
107116
timeout-minutes: 5

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ lint: lint/shellcheck lint/go
116116
.PHONY: lint
117117

118118
lint/go:
119+
./scripts/check_enterprise_imports.sh
119120
golangci-lint run
120121
.PHONY: lint/go
121122

scripts/check_enterprise_imports.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
# This file checks all our AGPL licensed source files to be sure they don't
4+
# import any enterprise licensed packages (the inverse is fine).
5+
6+
set -euo pipefail
7+
# shellcheck source=scripts/lib.sh
8+
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
9+
cdroot
10+
11+
set +e
12+
find . -regex ".*\.go" | grep -v "./enterprise" | xargs grep -n "github.com/coder/coder/enterprise"
13+
# reverse the exit code because we want this script to fail if grep finds anything.
14+
status=$?
15+
set -e
16+
if [ $status -eq 0 ]; then
17+
error "AGPL code cannot import enterprise!"
18+
fi
19+
log "AGPL imports OK"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy