Skip to content

Commit 9e279a9

Browse files
committed
chore: fix indenting
1 parent 46b5d79 commit 9e279a9

12 files changed

+389
-388
lines changed

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"zxh404.vscode-proto3",
99
"redhat.vscode-yaml",
1010
"streetsidesoftware.code-spell-checker",
11-
"dbaeumer.vscode-eslint"
11+
"dbaeumer.vscode-eslint",
12+
"EditorConfig.EditorConfig"
1213
]
1314
}

scripts/archive.sh

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# The absolute output path is printed on success.
2020

2121
set -euo pipefail
22-
# shellcheck source=lib.sh
22+
# shellcheck source=scripts/lib.sh
2323
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
2424

2525
format=""
@@ -29,59 +29,59 @@ sign_darwin=0
2929
args="$(getopt -o "" -l format:,output:,sign-darwin -- "$@")"
3030
eval set -- "$args"
3131
while true; do
32-
case "$1" in
33-
--format)
34-
format="${2#.}"
35-
if [[ "$format" != "zip" ]] && [[ "$format" != "tar.gz" ]]; then
36-
error "Invalid --format parameter '$format', must be 'zip' or 'tar.gz'"
37-
fi
38-
shift 2
39-
;;
40-
--output)
41-
# realpath fails if the dir doesn't exist.
42-
mkdir -p "$(dirname "$2")"
43-
output_path="$(realpath "$2")"
44-
shift 2
45-
;;
46-
--sign-darwin)
47-
if [[ "${AC_APPLICATION_IDENTITY:-}" == "" ]]; then
48-
error "AC_APPLICATION_IDENTITY must be set when --sign-darwin is supplied"
49-
fi
50-
sign_darwin=1
51-
shift
52-
;;
53-
--)
54-
shift
55-
break
56-
;;
57-
*)
58-
error "Unrecognized option: $1"
59-
;;
60-
esac
32+
case "$1" in
33+
--format)
34+
format="${2#.}"
35+
if [[ "$format" != "zip" ]] && [[ "$format" != "tar.gz" ]]; then
36+
error "Invalid --format parameter '$format', must be 'zip' or 'tar.gz'"
37+
fi
38+
shift 2
39+
;;
40+
--output)
41+
# realpath fails if the dir doesn't exist.
42+
mkdir -p "$(dirname "$2")"
43+
output_path="$(realpath "$2")"
44+
shift 2
45+
;;
46+
--sign-darwin)
47+
if [[ "${AC_APPLICATION_IDENTITY:-}" == "" ]]; then
48+
error "AC_APPLICATION_IDENTITY must be set when --sign-darwin is supplied"
49+
fi
50+
sign_darwin=1
51+
shift
52+
;;
53+
--)
54+
shift
55+
break
56+
;;
57+
*)
58+
error "Unrecognized option: $1"
59+
;;
60+
esac
6161
done
6262

6363
if [[ "$format" == "" ]]; then
64-
error "--format is a required parameter"
64+
error "--format is a required parameter"
6565
fi
6666

6767
if [[ "$#" != 1 ]]; then
68-
error "Exactly one argument must be provided to this script, $# were supplied"
68+
error "Exactly one argument must be provided to this script, $# were supplied"
6969
fi
7070
if [[ ! -f "$1" ]]; then
71-
error "File '$1' does not exist or is not a regular file"
71+
error "File '$1' does not exist or is not a regular file"
7272
fi
7373
input_file="$(realpath "$1")"
7474

7575
# Determine default output path.
7676
if [[ "$output_path" == "" ]]; then
77-
output_path="${input_file%.exe}"
78-
output_path+=".$format"
77+
output_path="${input_file%.exe}"
78+
output_path+=".$format"
7979
fi
8080

8181
# Determine the filename of the binary inside the archive.
8282
output_file="coder"
8383
if [[ "$input_file" == *".exe" ]]; then
84-
output_file+=".exe"
84+
output_file+=".exe"
8585
fi
8686

8787
# Make temporary dir where all source files intended to be in the archive will
@@ -95,22 +95,22 @@ ln -s "$(realpath LICENSE)" "$temp_dir/"
9595
# Ensure parent output dir and non-existent output file.
9696
mkdir -p "$(dirname "$output_path")"
9797
if [[ -e "$output_path" ]]; then
98-
rm "$output_path"
98+
rm "$output_path"
9999
fi
100100

101101
cd "$temp_dir"
102102
if [[ "$format" == "zip" ]]; then
103-
zip "$output_path" ./* 1>&2
103+
zip "$output_path" ./* 1>&2
104104
else
105-
tar --dereference -czvf "$output_path" ./* 1>&2
105+
tar --dereference -czvf "$output_path" ./* 1>&2
106106
fi
107107

108108
cdroot
109109
rm -rf "$temp_dir"
110110

111111
if [[ "$sign_darwin" == 1 ]]; then
112-
log "Notarizing archive..."
113-
execrelative ./sign_darwin.sh "$output_path"
112+
log "Notarizing archive..."
113+
execrelative ./sign_darwin.sh "$output_path"
114114
fi
115115

116116
echo -n "$output_path"

scripts/build_docker.sh

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Prints the image tag on success.
2020

2121
set -euo pipefail
22-
# shellcheck source=lib.sh
22+
# shellcheck source=scripts/lib.sh
2323
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
2424

2525
arch=""
@@ -29,57 +29,57 @@ push=0
2929
args="$(getopt -o "" -l arch:,version:,push -- "$@")"
3030
eval set -- "$args"
3131
while true; do
32-
case "$1" in
33-
--arch)
34-
arch="$2"
35-
shift 2
36-
;;
37-
--version)
38-
version="$2"
39-
shift 2
40-
;;
41-
--push)
42-
push=1
43-
shift
44-
;;
45-
--)
46-
shift
47-
break
48-
;;
49-
*)
50-
error "Unrecognized option: $1"
51-
;;
52-
esac
32+
case "$1" in
33+
--arch)
34+
arch="$2"
35+
shift 2
36+
;;
37+
--version)
38+
version="$2"
39+
shift 2
40+
;;
41+
--push)
42+
push=1
43+
shift
44+
;;
45+
--)
46+
shift
47+
break
48+
;;
49+
*)
50+
error "Unrecognized option: $1"
51+
;;
52+
esac
5353
done
5454

5555
if [[ "$arch" == "" ]]; then
56-
error "The --arch parameter is required"
56+
error "The --arch parameter is required"
5757
fi
5858

5959
# Remove the "v" prefix.
6060
version="${version#v}"
6161
if [[ "$version" == "" ]]; then
62-
version="$(execrelative ./version.sh)"
62+
version="$(execrelative ./version.sh)"
6363
fi
6464

6565
image_tag="$(execrelative ./image_tag.sh --arch "$arch" --version="$version")"
6666

6767
if [[ "$#" != 1 ]]; then
68-
error "Exactly one argument must be provided to this script, $# were supplied"
68+
error "Exactly one argument must be provided to this script, $# were supplied"
6969
fi
7070
if [[ ! -f "$1" ]]; then
71-
error "File '$1' does not exist or is not a regular file"
71+
error "File '$1' does not exist or is not a regular file"
7272
fi
7373
input_file="$(realpath "$1")"
7474

7575
# Remap the arch from Golang to Docker.
7676
declare -A arch_map=(
77-
[amd64]="linux/amd64"
78-
[arm64]="linux/arm64"
79-
[arm]="linux/arm/v7"
77+
[amd64]="linux/amd64"
78+
[arm64]="linux/arm64"
79+
[arm]="linux/arm/v7"
8080
)
8181
if [[ "${arch_map[$arch]+exists}" != "" ]]; then
82-
arch="${arch_map[$arch]}"
82+
arch="${arch_map[$arch]}"
8383
fi
8484

8585
# Make temporary dir where all source files intended to be in the image will be
@@ -92,14 +92,14 @@ ln -P Dockerfile "$temp_dir/"
9292
cd "$temp_dir"
9393

9494
build_args=(
95-
"--platform=$arch"
96-
"--label=org.opencontainers.image.title=Coder"
97-
"--label=org.opencontainers.image.description=A tool for provisioning self-hosted development environments with Terraform."
98-
"--label=org.opencontainers.image.url=https://github.com/coder/coder"
99-
"--label=org.opencontainers.image.source=https://github.com/coder/coder"
100-
"--label=org.opencontainers.image.version=$version"
101-
"--label=org.opencontainers.image.licenses=AGPL-3.0"
102-
"--tag=$image_tag"
95+
"--platform=$arch"
96+
"--label=org.opencontainers.image.title=Coder"
97+
"--label=org.opencontainers.image.description=A tool for provisioning self-hosted development environments with Terraform."
98+
"--label=org.opencontainers.image.url=https://github.com/coder/coder"
99+
"--label=org.opencontainers.image.source=https://github.com/coder/coder"
100+
"--label=org.opencontainers.image.version=$version"
101+
"--label=org.opencontainers.image.licenses=AGPL-3.0"
102+
"--tag=$image_tag"
103103
)
104104

105105
log "--- Building Docker image for $arch ($image_tag)"
@@ -109,8 +109,8 @@ cdroot
109109
rm -rf "$temp_dir"
110110

111111
if [[ "$push" == 1 ]]; then
112-
log "--- Pushing Docker image for $arch ($image_tag)"
113-
docker push "$image_tag"
112+
log "--- Pushing Docker image for $arch ($image_tag)"
113+
docker push "$image_tag"
114114
fi
115115

116116
echo -n "$image_tag"

scripts/build_docker_multiarch.sh

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Returns the merged image tag.
1717

1818
set -euo pipefail
19-
# shellcheck source=lib.sh
19+
# shellcheck source=scripts/lib.sh
2020
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
2121

2222
version=""
@@ -25,49 +25,49 @@ push=0
2525
args="$(getopt -o "" -l version:,push -- "$@")"
2626
eval set -- "$args"
2727
while true; do
28-
case "$1" in
29-
--version)
30-
version="$2"
31-
shift 2
32-
;;
33-
--push)
34-
push=1
35-
shift
36-
;;
37-
--)
38-
shift
39-
break
40-
;;
41-
*)
42-
error "Unrecognized option: $1"
43-
;;
44-
esac
28+
case "$1" in
29+
--version)
30+
version="$2"
31+
shift 2
32+
;;
33+
--push)
34+
push=1
35+
shift
36+
;;
37+
--)
38+
shift
39+
break
40+
;;
41+
*)
42+
error "Unrecognized option: $1"
43+
;;
44+
esac
4545
done
4646

4747
# Remove the "v" prefix.
4848
version="${version#v}"
4949
if [[ "$version" == "" ]]; then
50-
version="$(execrelative ./version.sh)"
50+
version="$(execrelative ./version.sh)"
5151
fi
5252

5353
if [[ "$#" == 0 ]]; then
54-
error "At least one argument must be provided to this script, $# were supplied"
54+
error "At least one argument must be provided to this script, $# were supplied"
5555
fi
5656

5757
create_args=()
5858
for image_tag in "$@"; do
59-
create_args+=(--amend "$image_tag")
59+
create_args+=(--amend "$image_tag")
6060
done
6161

6262
output_tag="$(execrelative ./image_tag.sh --version "$version")"
6363
log "--- Creating multi-arch Docker image ($output_tag)"
6464
docker manifest create \
65-
"$output_tag" \
66-
"${create_args[@]}"
65+
"$output_tag" \
66+
"${create_args[@]}"
6767

6868
if [[ "$push" == 1 ]]; then
69-
log "--- Pushing multi-arch Docker image ($output_tag)"
70-
docker push "$output_tag"
69+
log "--- Pushing multi-arch Docker image ($output_tag)"
70+
docker push "$output_tag"
7171
fi
7272

7373
echo -n "$output_tag"

0 commit comments

Comments
 (0)