Skip to content

Commit 480fb70

Browse files
authored
Devcontainer maintanence (demisto#29299)
1 parent df074aa commit 480fb70

3 files changed

Lines changed: 15 additions & 16 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ RUN apt-get update && apt-get install dos2unix git python2 curl -y \
1414
&& rm -rf /features \
1515
&& git clone https://github.com/devcontainers/features.git /features \
1616
&& cd /features \
17-
# locking to the latest master commit in this repo to prevent breaking changes
17+
# locking to the latest master commit in this repo (https://github.com/devcontainers/features.git) to prevent breaking changes
1818
# We should update this commit hash from time to time to
19-
&& git checkout 1869e5931cfe0517f75d58cb70863a6b4874c487
19+
&& git checkout 96bff0097028001e6e4126c5528d37cb8c13e785
2020

2121
# This is a workaround for VSCode devcontainer features in self signed certificate
2222
RUN UID="1000" GID="1000" bash /features/src/common-utils/install.sh

.devcontainer/createCommand.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ set -e
44

55
echo "Fixing permissions"
66

7-
sudo chown demisto .venv
8-
sudo chown demisto node_modules
9-
sudo chown demisto /workspaces
7+
sudo chown demisto /workspaces /workspaces/content
8+
sudo chown -R demisto /workspaces/content/.vscode /workspaces/content/.git /workspaces/content/.venv /workspaces/content/node_modules /workspaces/content/package-lock.json
9+
1010
sudo chown -R demisto $HOME
1111

1212
echo "Setting up VSCode paths"
@@ -19,5 +19,11 @@ rm -f .env
1919
echo "PYTHONPATH=""$path"":$PYTHONPATH" >> .env
2020
echo "MYPYPATH=""$path"":$MYPYPATH" >> .env
2121

22+
echo "Setting up git safe directory"
23+
git config --global --add safe.directory /workspaces/content
24+
2225
echo "Setting up content dependencies"
23-
.hooks/bootstrap
26+
.hooks/bootstrap
27+
28+
echo "Run demisto-sdk pre-commit to cache dependencies"
29+
poetry run demisto-sdk pre-commit >/dev/null 2>&1 || true

.devcontainer/devcontainer.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Development container for Content. Demisto-SDK 1.14.5
1+
// Development container for Content.
22
{
33
"name": "XSOAR Content",
44
"build": {
@@ -74,13 +74,6 @@
7474
"charliermarsh.ruff",
7575
"ryanluker.vscode-coverage-gutters"
7676
]
77-
},
78-
"codespaces": {
79-
"repositories": {
80-
"demisto/demisto-sdk": {
81-
"permissions": "write-all"
82-
}
83-
}
8477
}
8578
},
8679
// this is commented out until VSCode will fix self signed certificate issues
@@ -104,8 +97,8 @@
10497
// "overrideFeatureInstallOrder": [
10598
// "ghcr.io/devcontainers/features/common-utils:1"
10699
// ],
107-
"onCreateCommand": "dos2unix -n .devcontainer/createCommand.sh .devcontainer/createCommand_unix.sh && chmod +x .devcontainer/createCommand_unix.sh && bash .devcontainer/createCommand_unix.sh",
108-
"postStartCommand": "poetry install",
100+
"onCreateCommand": "sudo dos2unix -n .devcontainer/createCommand.sh .devcontainer/createCommand_unix.sh && bash .devcontainer/createCommand_unix.sh",
101+
"postStartCommand": "poetry install && poetry run demisto-sdk pre-commit >/dev/null 2>&1 || true",
109102
"hostRequirements": {
110103
"cpus": 4,
111104
"memory": "8gb",

0 commit comments

Comments
 (0)