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

Commit5817c6a

Browse files
authored
Build enterprise coder binary by default (coder#3517)
* Build enterprise coder binary by defaultSigned-off-by: Spike Curtis <spike@coder.com>* Add --agpl to develop.shSigned-off-by: Spike Curtis <spike@coder.com>* Add --agpl flag to archive.shSigned-off-by: Spike Curtis <spike@coder.com>* shell formatSigned-off-by: Spike Curtis <spike@coder.com>* Move AGPL back to LICENSE, explain enterprise license is forthcomingSigned-off-by: Spike Curtis <spike@coder.com>Signed-off-by: Spike Curtis <spike@coder.com>
1 parent4be61d9 commit5817c6a

File tree

9 files changed

+132
-15
lines changed

9 files changed

+132
-15
lines changed

‎LICENSE.enterprise

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
LICENSE (GNU Affero General Public License) applies to
2+
all files in this repository, except for those in or under
3+
any directory named "enterprise", which are Copyright Coder
4+
Technologies, Inc., All Rights Reserved.
5+
6+
We plan to release an enterprise license covering these files
7+
as soon as possible. Watch this space.
8+
9+

‎enterprise/cmd/coder/main.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package main
2+
3+
import (
4+
"errors"
5+
"fmt"
6+
"math/rand"
7+
"os"
8+
"time"
9+
_"time/tzdata"
10+
11+
"github.com/coder/coder/cli"
12+
"github.com/coder/coder/cli/cliui"
13+
)
14+
15+
funcmain() {
16+
rand.Seed(time.Now().UnixMicro())
17+
18+
cmd,err:=cli.Root().ExecuteC()
19+
iferr!=nil {
20+
iferrors.Is(err,cliui.Canceled) {
21+
os.Exit(1)
22+
}
23+
cobraErr:=cli.FormatCobraError(err,cmd)
24+
_,_=fmt.Fprintln(os.Stderr,cobraErr)
25+
os.Exit(1)
26+
}
27+
}

‎scripts/archive.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This script creates an archive containing the given binary renamed to
44
# `coder(.exe)?`, as well as the README.md and LICENSE files from the repo root.
55
#
6-
# Usage: ./archive.sh --format tar.gz [--output path/to/output.tar.gz] [--sign-darwin] path/to/binary
6+
# Usage: ./archive.sh --format tar.gz [--output path/to/output.tar.gz] [--sign-darwin][--agpl]path/to/binary
77
#
88
# The --format parameter must be set, and must either be "zip" or "tar.gz".
99
#
@@ -14,7 +14,9 @@
1414
# utility and then notarized using the `gon` utility, which may take a while.
1515
# $AC_APPLICATION_IDENTITY must be set and the signing certificate must be
1616
# imported for this to work. Also, the input binary must already be signed with
17-
# the `codesign` tool.
17+
# the `codesign` tool.=
18+
#
19+
# If the --agpl parameter is specified, only includes AGPL license.
1820
#
1921
# The absolute output path is printed on success.
2022

@@ -25,8 +27,9 @@ source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
2527
format=""
2628
output_path=""
2729
sign_darwin=0
30+
agpl="${CODER_BUILD_AGPL:-0}"
2831

29-
args="$(getopt -o"" -l format:,output:,sign-darwin --"$@")"
32+
args="$(getopt -o"" -l format:,output:,sign-darwin,agpl --"$@")"
3033
evalset --"$args"
3134
whiletrue;do
3235
case"$1"in
@@ -50,6 +53,10 @@ while true; do
5053
sign_darwin=1
5154
shift
5255
;;
56+
--agpl)
57+
agpl=1
58+
shift
59+
;;
5360
--)
5461
shift
5562
break
@@ -101,7 +108,13 @@ cdroot
101108
temp_dir="$(mktemp -d)"
102109
ln -s"$input_file""$temp_dir/$output_file"
103110
ln -s"$(realpath README.md)""$temp_dir/"
104-
ln -s"$(realpath LICENSE)""$temp_dir/"
111+
if [["$agpl"== 1 ]];then
112+
ln -s"$(realpath LICENSE.agpl)""$temp_dir/LICENSE"
113+
else
114+
ln -s"$(realpath LICENSE)""$temp_dir/"
115+
ln -s"$(realpath LICENSE.agpl)""$temp_dir/"
116+
ln -s"$(realpath LICENSE.enterprise)""$temp_dir/"
117+
fi
105118

106119
# Ensure parent output dir and non-existent output file.
107120
mkdir -p"$(dirname"$output_path")"

‎scripts/build_go.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# This script builds a single Go binary of Coder with the given parameters.
44
#
5-
# Usage: ./build_go.sh [--version 1.2.3-devel+abcdef] [--os linux] [--arch amd64] [--output path/to/output] [--slim]
5+
# Usage: ./build_go.sh [--version 1.2.3-devel+abcdef] [--os linux] [--arch amd64] [--output path/to/output] [--slim] [--agpl]
66
#
77
# Defaults to linux:amd64 with slim disabled, but can be controlled with GOOS,
88
# GOARCH and CODER_SLIM_BUILD=1. If no version is specified, defaults to the
@@ -19,6 +19,9 @@
1919
# If the --sign-darwin parameter is specified and the OS is darwin, binaries
2020
# will be signed using the `codesign` utility. $AC_APPLICATION_IDENTITY must be
2121
# set and the signing certificate must be imported for this to work.
22+
#
23+
# If the --agpl parameter is specified, builds only the AGPL-licensed code (no
24+
# Coder enterprise features).
2225

2326
set -euo pipefail
2427
# shellcheck source=scripts/lib.sh
@@ -31,8 +34,9 @@ arch="${GOARCH:-amd64}"
3134
slim="${CODER_SLIM_BUILD:-0}"
3235
sign_darwin=0
3336
output_path=""
37+
agpl="${CODER_BUILD_AGPL:-0}"
3438

35-
args="$(getopt -o"" -l version:,os:,arch:,output:,slim,sign-darwin --"$@")"
39+
args="$(getopt -o"" -l version:,os:,arch:,output:,slim,agpl,sign-darwin --"$@")"
3640
evalset --"$args"
3741
whiletrue;do
3842
case"$1"in
@@ -56,6 +60,10 @@ while true; do
5660
slim=1
5761
shift
5862
;;
63+
--agpl)
64+
agpl=1
65+
shift
66+
;;
5967
--sign-darwin)
6068
if [["${AC_APPLICATION_IDENTITY:-}"=="" ]];then
6169
error"AC_APPLICATION_IDENTITY must be set when --sign-darwin is supplied"
@@ -115,9 +123,13 @@ elif [[ "$arch" == "armv"* ]] || [[ "$arch" == "arm64v"* ]]; then
115123
arch="${arch//v*/}"
116124
fi
117125

126+
cmd_path="./enterprise/cmd/coder"
127+
if [["$agpl"== 1 ]];then
128+
cmd_path="./cmd/coder"
129+
fi
118130
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" GOARM="$arm_version" go build \
119131
"${build_args[@]}" \
120-
./cmd/coder1>&2
132+
"$cmd_path"1>&2
121133

122134
if [["$sign_darwin"== 1 ]]&& [["$os"=="darwin" ]];then
123135
codesign -s"$AC_APPLICATION_IDENTITY" -f -v --timestamp --options runtime"$output_path"

‎scripts/build_go_matrix.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This script builds multiple Go binaries for Coder with the given OS and
44
# architecture combinations.
55
#
6-
# Usage: ./build_go_matrix.sh [--version 1.2.3-devel+abcdef] [--output dist/] [--slim] [--sign-darwin] [--archive] [--package-linux] os1:arch1,arch2 os2:arch1 os1:arch3
6+
# Usage: ./build_go_matrix.sh [--version 1.2.3-devel+abcdef] [--output dist/] [--slim] [--sign-darwin] [--archive] [--package-linux][--agpl]os1:arch1,arch2 os2:arch1 os1:arch3
77
#
88
# If no OS:arch combinations are provided, nothing will happen and no error will
99
# be returned. Slim builds are disabled by default. If no version is specified,
@@ -30,6 +30,9 @@
3030
#
3131
# If the --package-linux parameter is specified, all linux binaries will be
3232
# packaged using ./package.sh. Requires the nfpm binary.
33+
#
34+
# If the --agpl parameter is specified, builds only the AGPL-licensed code (no
35+
# Coder enterprise features).
3336

3437
set -euo pipefail
3538
# shellcheck source=scripts/lib.sh
@@ -41,8 +44,9 @@ slim=0
4144
sign_darwin=0
4245
archive=0
4346
package_linux=0
47+
agpl=0
4448

45-
args="$(getopt -o"" -l version:,output:,slim,sign-darwin,archive,package-linux --"$@")"
49+
args="$(getopt -o"" -l version:,output:,slim,sign-darwin,archive,package-linux,agpl --"$@")"
4650
evalset --"$args"
4751
whiletrue;do
4852
case"$1"in
@@ -73,6 +77,10 @@ while true; do
7377
package_linux=1
7478
shift
7579
;;
80+
--agpl)
81+
agpl=1
82+
shift
83+
;;
7684
--)
7785
shift
7886
break
@@ -167,6 +175,9 @@ fi
167175
if [["$sign_darwin"== 1 ]];then
168176
build_args+=(--sign-darwin)
169177
fi
178+
if [["$agpl"== 1 ]];then
179+
build_args+=(--agpl)
180+
fi
170181

171182
# Build each spec.
172183
forspecin"${specs[@]}";do
@@ -208,6 +219,9 @@ for spec in "${specs[@]}"; do
208219
if [["$sign_darwin"== 1 ]]&& [["$spec_os"=="darwin" ]];then
209220
archive_args+=(--sign-darwin)
210221
fi
222+
if [["$agpl"== 1 ]];then
223+
archive_args+=(--agpl)
224+
fi
211225

212226
log"--- Creating archive for$spec_os$spec_arch ($spec_output_archive)"
213227
execrelative ./archive.sh \

‎scripts/build_go_slim.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This script builds multiple "slim" Go binaries for Coder with the given OS and
44
# architecture combinations. This wraps ./build_go_matrix.sh.
55
#
6-
# Usage: ./build_go_slim.sh [--version 1.2.3-devel+abcdef] [--output dist/] [--compress 22] os1:arch1,arch2 os2:arch1 os1:arch3
6+
# Usage: ./build_go_slim.sh [--version 1.2.3-devel+abcdef] [--output dist/] [--compress 22][--agpl]os1:arch1,arch2 os2:arch1 os1:arch3
77
#
88
# If no OS:arch combinations are provided, nothing will happen and no error will
99
# be returned. If no version is specified, defaults to the version from
@@ -19,6 +19,9 @@
1919
# When the --compress <level> parameter is provided, the binaries in site/bin
2020
# will be compressed using zstd into site/bin/coder.tar.zst, this helps reduce
2121
# final binary size significantly.
22+
#
23+
# If the --agpl parameter is specified, builds only the AGPL-licensed code (no
24+
# Coder enterprise features).
2225

2326
set -euo pipefail
2427
shopt -s nullglob
@@ -28,8 +31,9 @@ source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
2831
version=""
2932
output_path=""
3033
compress=0
34+
agpl=0
3135

32-
args="$(getopt -o"" -l version:,output:,compress: --"$@")"
36+
args="$(getopt -o"" -l version:,output:,compress:,agpl --"$@")"
3337
evalset --"$args"
3438
whiletrue;do
3539
case"$1"in
@@ -45,6 +49,10 @@ while true; do
4549
compress="$2"
4650
shift 2
4751
;;
52+
--agpl)
53+
agpl=1
54+
shift
55+
;;
4856
--)
4957
shift
5058
break
@@ -85,10 +93,15 @@ else
8593
output_path="$(realpath"${output_path}coder-slim_{version}_{os}_{arch}")"
8694
fi
8795

96+
build_args=(--slim)
97+
if [["$agpl"== 1 ]];then
98+
build_args+=(--agpl)
99+
fi
100+
88101
./scripts/build_go_matrix.sh \
89102
--version"$version" \
90103
--output"$output_path" \
91-
--slim \
104+
"${build_args[@]}" \
92105
"$@"
93106

94107
cdroot

‎scripts/coder-dev.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fi
1717

1818
if [[!-x"${CODER_DEV_BIN}" ]];then
1919
echo"Run this command first:"
20-
echo"go build -o${CODER_DEV_BIN}${PROJECT_ROOT}/cmd/coder"
20+
echo"go build -o${CODER_DEV_BIN}${PROJECT_ROOT}/enterprise/cmd/coder"
2121
exit 1
2222
fi
2323

‎scripts/develop.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11
#!/usr/bin/env bash
22

3+
# Usage: ./develop.sh [--agpl]
4+
#
5+
# If the --agpl parameter is specified, builds only the AGPL-licensed code (no
6+
# Coder enterprise features).
7+
38
# Allow toggling verbose output
49
[[-n${VERBOSE:-""} ]]&&set -x
510
set -euo pipefail
611

12+
agpl="${CODER_BUILD_AGPL:-0}"
13+
args="$(getopt -o"" -l agpl --"$@")"
14+
evalset --"$args"
15+
whiletrue;do
16+
case"$1"in
17+
--agpl)
18+
agpl=1
19+
shift
20+
;;
21+
--)
22+
shift
23+
break
24+
;;
25+
*)
26+
error"Unrecognized option:$1"
27+
;;
28+
esac
29+
done
30+
731
SCRIPT_DIR=$(dirname"${BASH_SOURCE[0]}")
832
# shellcheck disable=SC1091,SC1090
933
source"${SCRIPT_DIR}/lib.sh"
@@ -28,8 +52,13 @@ if [[ ! -e ./site/out/bin/coder.sha1 && ! -e ./site/out/bin/coder.tar.zst ]]; th
2852
exit 1
2953
fi
3054

55+
cmd_path="enterprise/cmd/coder"
56+
if [["$agpl"== 1 ]];then
57+
cmd_path="cmd/coder"
58+
fi
59+
3160
# Compile the CLI binary once just so we don't waste time compiling things multiple times
32-
go build -tags embed -o"${CODER_DEV_BIN}""${PROJECT_ROOT}/cmd/coder"
61+
go build -tags embed -o"${CODER_DEV_BIN}""${PROJECT_ROOT}/${cmd_path}"
3362
# Use the coder dev shim so we don't overwrite the user's existing Coder config.
3463
CODER_DEV_SHIM="${PROJECT_ROOT}/scripts/coder-dev.sh"
3564

‎site/e2e/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const config: PlaywrightTestConfig = {
2323
// Run the coder daemon directly.
2424
command:`go run -tags embed${path.join(
2525
__dirname,
26-
"../../cmd/coder/main.go",
26+
"../../enterprise/cmd/coder/main.go",
2727
)} server --in-memory`,
2828
port:basePort,
2929
timeout:120*10000,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp