Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3e7c8c9

Browse files
authored
feat(scripts): add fixtures.sh to add license to dev deployment (#19374)
Adds `scripts/fixtures.sh` with initial support for adding license.Future improvements may involve adding + breaking out:- User creation- Template creation/import- Org creation
1 parentc6c8b00 commit3e7c8c9

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

‎scripts/fixtures.sh‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
SCRIPT_DIR=$(dirname"${BASH_SOURCE[0]}")
4+
# shellcheck source=scripts/lib.sh
5+
source"${SCRIPT_DIR}/lib.sh"
6+
7+
CODER_DEV_SHIM="${PROJECT_ROOT}/scripts/coder-dev.sh"
8+
9+
add_license() {
10+
CODER_DEV_LICENSE="${CODER_DEV_LICENSE:-}"
11+
if [[-z"${CODER_DEV_LICENSE}" ]];then
12+
echo"No license provided. Please set CODER_DEV_LICENSE environment variable."
13+
exit 1
14+
fi
15+
16+
if [["${CODER_BUILD_AGPL:-0}"-gt"0" ]];then
17+
echo"Not adding a license in AGPL build mode."
18+
exit 0
19+
fi
20+
21+
NUM_LICENSES=$("${CODER_DEV_SHIM}" licenses list -o json| jq -r'. | length')
22+
if [["${NUM_LICENSES}"-gt"0" ]];then
23+
echo"License already exists. Skipping addition."
24+
exit 0
25+
fi
26+
27+
echo -n"${CODER_DEV_LICENSE}"|"${CODER_DEV_SHIM}" licenses add -f -|| {
28+
echo"ERROR: failed to add license. Try adding one manually."
29+
exit 1
30+
}
31+
32+
exit 0
33+
}
34+
35+
main() {
36+
if [[$#-eq 0 ]];then
37+
echo"Available fixtures:"
38+
echo" license: adds the license from CODER_DEV_LICENSE"
39+
exit 0
40+
fi
41+
42+
[[-n"${VERBOSE:-}" ]]&&set -x
43+
set -euo pipefail
44+
45+
case"$1"in
46+
"license")
47+
add_license
48+
;;
49+
*)
50+
echo"Unknown fixture:$1"
51+
exit 1
52+
;;
53+
esac
54+
}
55+
56+
main"$@"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp