Skip to content
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
5 changes: 4 additions & 1 deletion .devcontainer/demo-container/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@
"updateContentCommand": "./.devcontainer/updateContentCommand.sh",
"postAttachCommand": "./.devcontainer/postAttachCommand.sh",
"features": {
"docker-in-docker": "latest",
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"moby": false
},
"github-cli": "latest"
},
"hostRequirements": {
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
"postAttachCommand": "./.devcontainer/postAttachCommand.sh",
"features": {
"docker-in-docker": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"moby": false
},
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/onCreateCommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ git submodule update --init
uv sync --all-groups

uv run invoke demo.pull
uv run invoke dev.build --service server
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find all devcontainer.json files and check their onCreateCommand references
find . -name "devcontainer.json" -type f | head -20

Repository: opsmill/infrahub

Length of output: 142


🏁 Script executed:

#!/bin/bash
# Check what each devcontainer.json references for onCreateCommand
echo "=== Main devcontainer.json ===" 
cat .devcontainer/devcontainer.json 2>/dev/null | grep -A 2 -B 2 "onCreateCommand" || echo "File not found or no match"

echo -e "\n=== Demo devcontainer.json ===" 
cat demo-container/devcontainer.json 2>/dev/null | grep -A 2 -B 2 "onCreateCommand" || echo "File not found or no match"

Repository: opsmill/infrahub

Length of output: 358


🏁 Script executed:

#!/bin/bash
# List the full contents of both devcontainer.json files to understand the full context
echo "=== Main .devcontainer/devcontainer.json ===" 
cat .devcontainer/devcontainer.json

echo -e "\n=== demo-container/devcontainer.json ===" 
cat demo-container/devcontainer.json

Repository: opsmill/infrahub

Length of output: 1629


🏁 Script executed:

#!/bin/bash
# Check if there are other onCreateCommand scripts besides the shared one
find . -name "onCreateCommand*" -type f

Repository: opsmill/infrahub

Length of output: 94


🏁 Script executed:

#!/bin/bash
# Check the current content and structure of the onCreateCommand.sh script
echo "=== Full onCreateCommand.sh ===" 
cat -n .devcontainer/onCreateCommand.sh

Repository: opsmill/infrahub

Length of output: 323


🏁 Script executed:

#!/bin/bash
# Read the demo-container devcontainer.json from the correct path
echo "=== .devcontainer/demo-container/devcontainer.json ===" 
cat .devcontainer/demo-container/devcontainer.json

Repository: opsmill/infrahub

Length of output: 1592


Shared onCreateCommand.sh runs dev.build --service server for both dev and demo containers — verify if intentional.

Both .devcontainer/devcontainer.json and .devcontainer/demo-container/devcontainer.json reference the same onCreateCommand.sh script. The script executes uv run invoke demo.pull (line 9) followed by uv run invoke dev.build --service server (line 10).

The demo container's demo.pull is designed to pull pre-built images, so additionally running a full local dev.build --service server inside the demo container appears unintended and will significantly increase prebuild time for that configuration.

If the build step is only meant for the dev container, move it to a separate script referenced only by .devcontainer/devcontainer.json, or guard it with a conditional check.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.devcontainer/onCreateCommand.sh at line 10, The shared onCreateCommand.sh
currently runs "uv run invoke demo.pull" and then always runs "uv run invoke
dev.build --service server", which causes the demo container to build
unnecessarily; modify onCreateCommand.sh so the dev.build step only runs for the
dev container: either split into two scripts (keep dev.build in a new script
referenced by .devcontainer/devcontainer.json and leave demo.pull in the shared
script referenced by .devcontainer/demo-container/devcontainer.json) or add a
guard in onCreateCommand.sh that checks an environment variable/flag (e.g.,
CONTAINER_TYPE or DEMO=true) before executing "uv run invoke dev.build --service
server", leaving "uv run invoke demo.pull" unconditional for the demo flow.