Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧑‍💻 Add first-run message to terminal #17

Merged
merged 3 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,21 @@ RUN apt-get update --yes \
&& apt-get clean --yes \
&& rm --force --recursive /var/lib/apt/lists/*

# Visaual Studio Code
COPY src/opt/visual-studio-code/first-run-notice.txt /opt/visual-studio-code/first-run-notice.txt

RUN cat <<EOF >> /home/analyticalplatform/.bashrc

# This is a first run notice for Visual Studio Code
if [ -t 1 ] && [[ "\${TERM_PROGRAM}" = "vscode" ]] && [ ! -f "/opt/visual-studio-code/first-run-notice-already-displayed" ]; then
cat /opt/visual-studio-code/first-run-notice.txt
# Mark first run notice as displayed after 10s to avoid problems with fast terminal refreshes hiding it
mkdir -p "~/.visual-studio-code"
((sleep 10s; touch "~/.visual-studio-code/first-run-notice-already-displayed") &)
fi

EOF

# Visual Studio Code
RUN curl --location --fail-with-body \
"https://packages.microsoft.com/keys/microsoft.asc" \
--output microsoft.asc \
Expand Down
8 changes: 8 additions & 0 deletions src/opt/visual-studio-code/first-run-notice.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
👋 Welcome! You are using the Ministry of Justice Analytical Platform Visual Studio Code image.

🧪 This feature is currently in Beta.

🆘 If you need help or assistance, please post a message into the analytical-platform-vscode-beta Slack Channel.

🔍 To explore VS Code to its fullest, search using the Command Palette (Cmd/Ctrl + Shift + P or F1).

5 changes: 5 additions & 0 deletions test/container-structure-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ commandTests:
command: "pip"
args: ["--version"]
expectedOutput: ["pip.*"]

fileContentTests:
- name: "bashrc first-run-notice"
path: "/home/analyticalplatform/.bashrc"
expectedContents: ["# This is a first run notice for Visual Studio Code"]