Skip to content

Commit d249f04

Browse files
committed
Merge remote-tracking branch 'origin/main' into matifali/lint-offlinedocs
2 parents a0ea2a6 + c3b8898 commit d249f04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4980
-2079
lines changed

.github/workflows/pr-deploy.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name: Deploy PR
33
on:
44
issue_comment:
5+
types: [created, edited]
56
workflow_dispatch:
67
inputs:
78
pr_number:
@@ -137,32 +138,33 @@ jobs:
137138
- name: Checkout
138139
uses: actions/checkout@v3
139140

140-
- name: "Set up kubeconfig"
141+
- name: Set up kubeconfig
141142
run: |
142143
set -euxo pipefail
143144
mkdir -p ~/.kube
144145
echo "${{ secrets.DELIVERYBOT_KUBECONFIG }}" > ~/.kube/config
145146
export KUBECONFIG=~/.kube/config
146147
147-
- name: "Create PR namespace"
148+
- name: Create PR namespace
148149
run: |
149150
set -euxo pipefail
150151
# try to delete the namespace, but don't fail if it doesn't exist
151152
kubectl delete namespace "pr${{ env.PR_NUMBER }}" || true
152153
kubectl create namespace "pr${{ env.PR_NUMBER }}"
153154
154-
- name: "Install Helm chart"
155+
- name: Install Helm chart
155156
run: |
156157
helm upgrade --install pr${{ env.PR_NUMBER }} ./helm \
157158
--namespace "pr${{ env.PR_NUMBER }}" \
158159
--set coder.image.repo=${{ env.REPO }} \
159160
--set coder.image.tag=pr${{ env.PR_NUMBER }} \
160161
--set coder.service.type=ClusterIP \
162+
--set coder.serviceAccount.enableDeployments=true \
161163
--set coder.env[0].name=CODER_ACCESS_URL \
162164
--set coder.env[0].value="" \
163165
--force
164166
165-
- name: "Get deployment URL"
167+
- name: Get deployment URL
166168
id: deployment_url
167169
run: |
168170
set -euo pipefail
@@ -172,6 +174,13 @@ jobs:
172174
echo "::add-mask::$CODER_ACCESS_URL"
173175
echo "CODER_ACCESS_URL=$CODER_ACCESS_URL" >> $GITHUB_OUTPUT
174176
177+
- name: Install coder-logstream-kube
178+
run: |
179+
helm repo add coder-logstream-kube https://helm.coder.com/logstream-kube
180+
helm install coder-logstream-kube coder-logstream-kube/coder-logstream-kube \
181+
--namespace "pr${{ env.PR_NUMBER }}" \
182+
--set url="${{ steps.deployment_url.outputs.CODER_ACCESS_URL }}"
183+
175184
- name: Send Slack notification
176185
run: |
177186
curl -s -o /dev/null -X POST -H 'Content-type: application/json' \

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
set -euo pipefail
7777
ref=HEAD
7878
old_version="$(git describe --abbrev=0 "$ref^1")"
79-
version="$(./scripts/version.sh)"
79+
version="v$(./scripts/version.sh)"
8080
8181
# Generate notes.
8282
release_notes_file="$(mktemp -t release_notes.XXXXXX)"

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,14 @@ else
418418
endif
419419
.PHONY: fmt/shfmt
420420

421-
lint: lint/shellcheck lint/go lint/ts lint/helm
421+
lint: lint/shellcheck lint/go lint/ts lint/helm lint/site-icons
422422
.PHONY: lint
423423

424+
lint/site-icons:
425+
./scripts/check_site_icons.sh
426+
427+
.PHONY: lint/site-icons
428+
424429
lint/ts:
425430
cd site
426431
yarn && yarn lint

cli/clistat/cgroup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func readInt64Prefix(fs afero.Fs, path, prefix string) (int64, error) {
338338

339339
scn := bufio.NewScanner(bytes.NewReader(data))
340340
for scn.Scan() {
341-
line := scn.Text()
341+
line := strings.TrimSpace(scn.Text())
342342
if !strings.HasPrefix(line, prefix) {
343343
continue
344344
}

cli/clistat/container.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import (
1010
)
1111

1212
const (
13-
procMounts = "/proc/mounts"
14-
procOneCgroup = "/proc/1/cgroup"
13+
procMounts = "/proc/mounts"
14+
procOneCgroup = "/proc/1/cgroup"
15+
kubernetesDefaultServiceAccountToken = "/var/run/secrets/kubernetes.io/serviceaccount/token" //nolint:gosec
1516
)
1617

1718
// IsContainerized returns whether the host is containerized.
@@ -38,6 +39,14 @@ func IsContainerized(fs afero.Fs) (ok bool, err error) {
3839
}
3940
}
4041

42+
// Sometimes the above method of sniffing /proc/1/cgroup isn't reliable.
43+
// If a Kubernetes service account token is present, that's
44+
// also a good indication that we are in a container.
45+
_, err = afero.ReadFile(fs, kubernetesDefaultServiceAccountToken)
46+
if err == nil {
47+
return true, nil
48+
}
49+
4150
// Last-ditch effort to detect Sysbox containers.
4251
// Check if we have anything mounted as type sysboxfs in /proc/mounts
4352
mountsData, err := afero.ReadFile(fs, procMounts)

cli/dotfiles.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ func (r *RootCmd) dotfiles() *clibase.Cmd {
193193
}
194194

195195
_, _ = fmt.Fprintf(inv.Stdout, "Running %s...\n", script)
196+
197+
// Check if the script is executable and notify on error
198+
scriptPath := filepath.Join(dotfilesDir, script)
199+
fi, err := os.Stat(scriptPath)
200+
if err != nil {
201+
return xerrors.Errorf("stat %s: %w", scriptPath, err)
202+
}
203+
204+
if fi.Mode()&0o111 == 0 {
205+
return xerrors.Errorf("script %q is not executable. See https://coder.com/docs/v2/latest/dotfiles for information on how to resolve the issue.", script)
206+
}
207+
196208
// it is safe to use a variable command here because it's from
197209
// a filtered list of pre-approved install scripts
198210
// nolint:gosec

0 commit comments

Comments
 (0)