Skip to content

Commit bb44b28

Browse files
authored
Quality sweep: build integrity, script robustness and stale defaults (#1134)
1 parent 8c48e14 commit bb44b28

11 files changed

Lines changed: 37 additions & 36 deletions

File tree

‎.github/renovate.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@
9494
{
9595
"customType": "regex",
9696
"managerFilePatterns": ["/vscode/vscode.extensions$/"],
97-
"matchStrings": ["netcorext\\.uuid-generator#(?<currentValue>.+)\\s"],
97+
"matchStrings": ["redhat\\.vscode-yaml#(?<currentValue>.+)\\s"],
9898
"datasourceTemplate": "github-releases",
99-
"depNameTemplate": "arenchen/vscode-uuid-generator"
99+
"depNameTemplate": "redhat-developer/vscode-yaml"
100100
},
101101
{
102102
"customType": "regex",

‎vscode/.README.j2‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Home Assistant Community App: Visual Studio Code
1+
# Home Assistant Community App: Studio Code Server
22

33
[![Release][release-shield]][release] ![Project Stage][project-stage-shield] ![Project Maintenance][maintenance-shield]
44

‎vscode/DOCS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ When not configured, the app will automatically use the default: `/config`
7272

7373
### Option: `packages`
7474

75-
Allows you to specify additional [Ubuntu packages][ubuntu-packages] to be
75+
Allows you to specify additional [Debian packages][debian-packages] to be
7676
installed in your shell environment (e.g., Python, PHP, Go).
7777

7878
**Note**: _Adding many packages will result in a longer start-up
@@ -234,6 +234,7 @@ SOFTWARE.
234234
[addon]: https://my.home-assistant.io/redirect/supervisor_addon/?addon=a0d7b954_vscode&repository_url=https%3A%2F%2Fgithub.com%2Fhassio-addons%2Frepository
235235
[code-server]: https://github.com/coder/code-server
236236
[contributors]: https://github.com/hassio-addons/app-vscode/graphs/contributors
237+
[debian-packages]: https://packages.debian.org
237238
[discord-ha]: https://discord.gg/c5DvZ4e
238239
[discord]: https://discord.me/hassioaddons
239240
[forum]: https://community.home-assistant.io/t/home-assistant-community-add-on-visual-studio-code/107863?u=frenck
@@ -243,4 +244,3 @@ SOFTWARE.
243244
[reddit]: https://reddit.com/r/homeassistant
244245
[releases]: https://github.com/hassio-addons/app-vscode/releases
245246
[semver]: https://semver.org/spec/v2.0.0
246-
[ubuntu-packages]: https://packages.ubuntu.com

‎vscode/Dockerfile‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ARG BUILD_FROM=ghcr.io/hassio-addons/debian-base:9.4.0
22
# hadolint ignore=DL3006
33
FROM ${BUILD_FROM}
44

5-
# Confiure locale
5+
# Configure locale
66
ENV \
77
LANG=en_US.UTF-8 \
88
LANGUAGE=en_US:en \
@@ -22,7 +22,6 @@ COPY vscode.extensions /root/vscode.extensions
2222
ARG BUILD_ARCH=amd64
2323
ARG CODE_SERVER_VERSION="v4.135.0"
2424
ARG HA_CLI_VERSION="5.4.0"
25-
# hadolint ignore=SC2181, DL3008
2625
RUN \
2726
apt-get update \
2827
\
@@ -53,11 +52,11 @@ RUN \
5352
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
5453
&& locale-gen \
5554
\
56-
&& curl https://bootstrap.pypa.io/get-pip.py | python3 \
55+
&& curl -fsSL https://bootstrap.pypa.io/get-pip.py | python3 \
5756
\
5857
&& if [[ "${BUILD_ARCH}" = "aarch64" ]]; then ARCH="arm64"; fi \
5958
&& if [[ "${BUILD_ARCH}" = "amd64" ]]; then ARCH="amd64"; fi \
60-
&& curl -J -L -o /tmp/code.tar.gz \
59+
&& curl -f -J -L -o /tmp/code.tar.gz \
6160
"https://github.com/coder/code-server/releases/download/${CODE_SERVER_VERSION}/code-server-${CODE_SERVER_VERSION#v}-linux-${ARCH}.tar.gz" \
6261
&& mkdir -p /usr/local/lib/code-server \
6362
&& tar zxvf \
@@ -69,27 +68,27 @@ RUN \
6968
&& mkdir -p /root/.code-server/extensions \
7069
&& uuid=$(uuidgen) \
7170
&& while read -r ext; do \
72-
extention="${ext%%#*}" \
73-
vendor="${extention%%.*}"; \
74-
slug="${extention#*.}"; \
71+
extension="${ext%%#*}"; \
72+
vendor="${extension%%.*}"; \
73+
slug="${extension#*.}"; \
7574
version="${ext##*#}"; \
7675
\
7776
echo "Installing vscode extension: ${slug} by ${vendor} @ ${version} "; \
7877
\
7978
echo "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/${vendor}/vsextensions/${slug}/${version}/vspackage"; \
80-
curl -JL --retry 5 -o "/tmp/${extention}-${version}.vsix" \
79+
curl -fJL --retry 5 -o "/tmp/${extension}-${version}.vsix" \
8180
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36" \
8281
-H "x-market-user-id: ${uuid}" \
8382
"https://marketplace.visualstudio.com/_apis/public/gallery/publishers/${vendor}/vsextensions/${slug}/${version}/vspackage"; \
84-
mkdir -p "/usr/local/lib/code-server/lib/vscode/extensions/${extention}-${version}"; \
85-
bsdtar --strip-components=1 -xf "/tmp/${extention}-${version}.vsix" \
86-
-C "/usr/local/lib/code-server/lib/vscode/extensions/${extention}-${version}" extension; \
87-
[ $? -ne 0 ] && exit 1; \
83+
mkdir -p "/usr/local/lib/code-server/lib/vscode/extensions/${extension}-${version}"; \
84+
bsdtar --strip-components=1 -xf "/tmp/${extension}-${version}.vsix" \
85+
-C "/usr/local/lib/code-server/lib/vscode/extensions/${extension}-${version}" extension \
86+
|| exit 1; \
8887
sleep 1; \
8988
done < /root/vscode.extensions \
9089
&& ls -la /usr/local/lib/code-server/lib/vscode/extensions/ \
9190
\
92-
&& curl -L -s -o /usr/bin/ha \
91+
&& curl -fsSL -o /usr/bin/ha \
9392
"https://github.com/home-assistant/cli/releases/download/${HA_CLI_VERSION}/ha_${BUILD_ARCH}" \
9493
&& chmod a+x /usr/bin/ha \
9594
\
@@ -117,8 +116,10 @@ RUN \
117116
uuid-runtime \
118117
\
119118
&& find /usr/local \
120-
\( -type d -a -name test -o -name tests -o -name '__pycache__' \) \
121-
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
119+
\( \
120+
\( -type d -a \( -name test -o -name tests -o -name '__pycache__' \) \) \
121+
-o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
122+
\) \
122123
-exec rm -rf '{}' + \
123124
\
124125
&& rm -fr \

‎vscode/rootfs/etc/s6-overlay/s6-rc.d/init-code-server/run‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ readonly -a PREVIOUS_DEFAULT_CONFIG_HASHES=(
2121
b28a299111ac74cc9498f76ce2cb437b2cf5e8e7bb9388d9929347e2948bd56591bd499d5de04638553f6e12fa77c53320a046e96cffce9fa4f8c924d5c91581
2222
dbe905f0935b2fea8bb5ba379bff78db9d056ea6d0965c68aa9b07938a52cbbf117186452b2b6c766aa4cf93cc3494ad91b763e8500e515e41d8cde31a3821ae
2323
2212babaa9dc46d38ba239052c9c05151abe517cc8b493d0d351a96bf70c1efa4f7479f6ed0b75811429ba649906eb5657d73b0732b460e718a5c66603dcdbda
24+
4af003224345302a7f04cf40703554da5a1d8baba512dcb16cf50147f33cf06199f9ef1ddde5a2ecbc5e923ca02d1316ae62588aa9fc439a6cd994576a2b019d
2425
)
2526

2627
if bashio::config.has_value 'config_path'; then

‎vscode/rootfs/etc/s6-overlay/s6-rc.d/init-mosquitto/run‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ if bashio::services.available "mqtt"; then
2323
echo "--username ${username}"
2424
} > /root/.config/mosquitto_sub
2525

26-
ln -s /root/.config/mosquitto_sub /root/.config/mosquitto_pub
27-
ln -s /root/.config/mosquitto_sub /root/.config/mosquitto_rr
26+
ln -sf /root/.config/mosquitto_sub /root/.config/mosquitto_pub \
27+
|| bashio::log.warning 'Failed linking the mosquitto_pub configuration'
28+
ln -sf /root/.config/mosquitto_sub /root/.config/mosquitto_rr \
29+
|| bashio::log.warning 'Failed linking the mosquitto_rr configuration'
2830
fi

‎vscode/rootfs/etc/s6-overlay/s6-rc.d/init-mysql/run‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if bashio::services.available "mysql"; then
1515
port=$(bashio::services "mysql" "port")
1616
username=$(bashio::services "mysql" "username")
1717

18-
mkdir -p /root/.config
18+
mkdir -p /etc/mysql/conf.d
1919
{
2020
echo "[client]"
2121
echo "host=${host}"

‎vscode/rootfs/etc/s6-overlay/s6-rc.d/init-user/run‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ fi
9797

9898
# Install user configured/requested packages
9999
if bashio::config.has_value 'packages'; then
100-
apt update \
101-
|| bashio::exit.nok 'Failed updating Ubuntu packages repository indexes'
100+
apt-get update \
101+
|| bashio::exit.nok 'Failed updating Debian package repository indexes'
102102

103103
for package in $(bashio::config 'packages'); do
104104
apt-get install -y "$package" \

‎vscode/rootfs/root/.code-server/settings.json‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,15 @@
8686
},
8787
"editor.renderWhitespace": "boundary",
8888
"esphome.validator": "local",
89-
"telemetry.enableTelemetry": false,
89+
"telemetry.telemetryLevel": "off",
9090
"terminal.integrated.copyOnSelection": true,
91-
"terminal.integrated.shell.linux": "/usr/bin/zsh",
91+
"terminal.integrated.defaultProfile.linux": "zsh",
92+
"terminal.integrated.profiles.linux": {
93+
"zsh": {
94+
"path": "/usr/bin/zsh"
95+
}
96+
},
9297
"update.mode": "none",
93-
"vsicons.dontShowNewVersionMessage": true,
94-
"vsicons.projectDetection.disableDetect": true,
9598
"workbench.iconTheme": "vs-seti",
9699
"yaml.format.enable": true,
97100
"editor.defaultFormatter": "esbenp.prettier-vscode",

‎vscode/rootfs/root/.code-server/workspaces.json‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)