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
18 changes: 7 additions & 11 deletions .devcontainer.json → .devcontainer.json.deprecated
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "devtools",
"shutdownAction": "none",
"image": "us-docker.pkg.dev/runwhen-nonprod-shared/public-images/codecollection-devtools:latest",
// "image": "codecollectiondevtools:latest",
"overrideCommand": false,
"extensions": [
"robocorp.robotframework-lsp",
Expand All @@ -20,10 +19,13 @@
"${localWorkspaceFolder}/auth/:/home/runwhen/auth/:z",
"--name",
"devtools",
"--dns",
"--dns",
"8.8.8.8"
],
"postStartCommand":"pip install --user --no-cache-dir -r /home/runwhen/codecollection/requirements.txt",
"containerEnv": {
"RW_MODE": "dev"
},
"postStartCommand": "pip install --user --no-cache-dir -r /home/runwhen/codecollection/requirements.txt",
"forwardPorts": [
3000
],
Expand All @@ -34,18 +36,15 @@
"version": "latest"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
// configuration following google standard
"vscode": {
"settings": {
"python.languageServer": "Jedi",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--max-line-length=120",
"--enable=W0614" // track unused imports
"--enable=W0614"
],
"[python]": {
"editor.insertSpaces": true,
Expand All @@ -61,11 +60,8 @@
"robot.language-server.python": "/usr/local/bin/python",
"robot.pythonpath": [
"/home/runwhen",
"/home/runwhen/rw-public-codecollection/libraries",
"/home/runwhen/rw-public-codecollection/libraries/RW",
"/home/runwhen/codecollection/libraries",
"/home/runwhen/codecollection/libraries/RW",
"/home/runwhen/dev_facade"
"/home/runwhen/codecollection/libraries/RW"
]
}
}
Expand Down
19 changes: 6 additions & 13 deletions .devcontainer.source.json → .devcontainer.source.json.deprecated
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
"name": "devtools",
// this devcontainer config is for running from source
"dockerComposeFile": [
"docker-compose.yaml"
],
"service": "devtools",
"shutdownAction": "none",
"workspaceFolder": "/app/",
// Configure tool-specific properties.
"workspaceFolder": "/home/runwhen/",
"customizations": {
// Configure properties specific to VS Code.
// configuration following google standard
"vscode": {
"extensions": [
"robocorp.robotframework-lsp",
Expand All @@ -25,7 +21,7 @@
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--max-line-length=120",
"--enable=W0614" // track unused imports
"--enable=W0614"
],
"[python]": {
"editor.insertSpaces": true,
Expand All @@ -40,14 +36,11 @@
],
"robot.language-server.python": "/usr/local/bin/python",
"robot.pythonpath": [
"/app",
"/app/rw-public-codecollection/libraries",
"/app/rw-public-codecollection/libraries/RW",
"/app/codecollection/libraries",
"/app/codecollection/libraries/RW",
"/app/dev_facade"
"/home/runwhen",
"/home/runwhen/codecollection/libraries",
"/home/runwhen/codecollection/libraries/RW"
]
}
}
}
}
}
73 changes: 73 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "CodeCollection DevTools",
"image": "ghcr.io/runwhen-contrib/codecollection-devtools:latest",
"remoteUser": "runwhen",
"updateRemoteUserUID": false,
"overrideCommand": false,
"workspaceFolder": "/home/runwhen",

"forwardPorts": [3000],
"portsAttributes": {
"3000": {
"label": "Robot Test Logs",
"onAutoForward": "notify"
}
},

"containerEnv": {
"RW_MODE": "dev",
"ROBOT_LOG_DIR": "/robot_logs",
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}",
"CODECOLLECTION_REPO": "${localEnv:CODECOLLECTION_REPO}",
"CODECOLLECTION_BRANCH": "${localEnv:CODECOLLECTION_BRANCH}",
"PR_NUMBER": "${localEnv:PR_NUMBER}"
},

"onCreateCommand": "bash /home/runwhen/.devcontainer/on-create.sh",
"postStartCommand": "python -m http.server --bind 0.0.0.0 --directory /robot_logs 3000 &",

"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/sshd:1": {
"version": "latest"
}
},

"customizations": {
"vscode": {
"extensions": [
"robocorp.robotframework-lsp",
"ms-python.pylint",
"ms-python.black-formatter",
"ms-python.python",
"njpwerner.autodocstring"
],
"settings": {
"python.languageServer": "Jedi",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--max-line-length=120",
"--enable=W0614"
],
"[python]": {
"editor.insertSpaces": true,
"editor.tabSize": 4
},
"editor.formatOnSave": true,
"editor.lineNumbers": "on",
"python.formatting.provider": "black",
"python.formatting.blackArgs": ["--line-length", "120"],
"robot.language-server.python": "/usr/local/bin/python",
"robot.pythonpath": [
"/home/runwhen",
"/home/runwhen/codecollection/libraries",
"/home/runwhen/codecollection/libraries/RW"
]
}
},
"codespaces": {
"openFiles": ["codecollection/README.md"]
}
}
}
98 changes: 98 additions & 0 deletions .devcontainer/on-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/bin/bash
# ======================================================================================
# on-create.sh — Bootstrap a codecollection into the devtools environment
#
# Runs once when the devcontainer is created (onCreateCommand).
# Clones the target codecollection repo, installs its Python deps, and
# optionally checks out a PR branch for review.
#
# Environment variables (set via devcontainer.json or Codespaces secrets):
#
# CODECOLLECTION_REPO Git URL or GitHub shorthand (org/repo) of the
# codecollection to work on.
# Default: runwhen-contrib/rw-cli-codecollection
#
# CODECOLLECTION_BRANCH Branch to check out after clone.
# Default: main
#
# PR_NUMBER If set, fetch and check out the PR branch instead
# of CODECOLLECTION_BRANCH. Requires gh CLI auth.
#
# GITHUB_TOKEN Passed through for gh CLI auth (Codespaces injects
# this automatically).
# ======================================================================================
set -euo pipefail

RUNWHEN_HOME="/home/runwhen"
CODECOLLECTION_DIR="${RUNWHEN_HOME}/codecollection"
DEFAULT_REPO="runwhen-contrib/rw-cli-codecollection"

REPO="${CODECOLLECTION_REPO:-$DEFAULT_REPO}"
BRANCH="${CODECOLLECTION_BRANCH:-main}"

# Normalise shorthand "org/repo" → full HTTPS URL
if [[ "$REPO" != http* && "$REPO" != git@* ]]; then
REPO="https://github.com/${REPO}.git"
fi

echo "=== CodeCollection DevTools Bootstrap ==="
echo " Repo: ${REPO}"
echo " Branch: ${BRANCH}"
echo " PR: ${PR_NUMBER:-none}"
echo "=========================================="

# ------------------------------------------------------------------
# 1. Clone the codecollection
# ------------------------------------------------------------------
if [ -d "${CODECOLLECTION_DIR}/.git" ]; then
echo "Codecollection already cloned at ${CODECOLLECTION_DIR}, pulling latest..."
git -C "${CODECOLLECTION_DIR}" fetch --all --prune
else
# Remove placeholder dir if the image created one
rm -rf "${CODECOLLECTION_DIR}"
echo "Cloning ${REPO} → ${CODECOLLECTION_DIR} ..."
git clone --branch "${BRANCH}" "${REPO}" "${CODECOLLECTION_DIR}"
fi

# ------------------------------------------------------------------
# 2. Optionally check out a PR
# ------------------------------------------------------------------
if [ -n "${PR_NUMBER:-}" ]; then
echo "Checking out PR #${PR_NUMBER}..."
cd "${CODECOLLECTION_DIR}"
if command -v gh &>/dev/null; then
gh pr checkout "${PR_NUMBER}"
else
echo "gh CLI not found — falling back to git fetch"
git fetch origin "pull/${PR_NUMBER}/head:pr-${PR_NUMBER}"
git checkout "pr-${PR_NUMBER}"
fi
echo "On branch: $(git branch --show-current)"
fi

# ------------------------------------------------------------------
# 3. Install codecollection Python dependencies
# ------------------------------------------------------------------
if [ -f "${CODECOLLECTION_DIR}/requirements.txt" ]; then
echo "Installing codecollection requirements..."
pip install --user --no-cache-dir -r "${CODECOLLECTION_DIR}/requirements.txt"
fi

# ------------------------------------------------------------------
# 4. Ensure auth directory exists for credential mounts
# ------------------------------------------------------------------
mkdir -p "${RUNWHEN_HOME}/auth"

# ------------------------------------------------------------------
# 5. Verify key tools are available
# ------------------------------------------------------------------
echo ""
echo "--- Environment ready ---"
echo " ro: $(command -v ro && echo 'ok' || echo 'MISSING')"
echo " robot: $(command -v robot && echo 'ok' || echo 'MISSING')"
echo " kubectl: $(command -v kubectl && echo 'ok' || echo 'MISSING')"
echo " gh: $(command -v gh && echo 'ok' || echo 'MISSING')"
echo " python: $(python --version 2>&1)"
echo ""
echo "Codecollection bootstrapped at ${CODECOLLECTION_DIR}"
echo "Run 'cd codecollection/codebundles/<name> && ro' to test a codebundle."
4 changes: 3 additions & 1 deletion .github/workflows/build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
paths:
- "VERSION"
- "Dockerfile"
- "requirements.txt"
- ".devcontainer/**"
- ".github/workflows/build-push.yaml"
workflow_dispatch:

Expand Down Expand Up @@ -92,7 +94,7 @@ jobs:
docker buildx inspect --bootstrap
docker buildx build \
--push \
--platform linux/amd64 \
--platform linux/amd64,linux/arm64 \
--tag "${{ env.SHARED_ARTIFACT_REPOSITORY_PATH }}/${{ env.IMAGE }}:${{ env.VERSION }}" \
--tag "${{ env.SHARED_ARTIFACT_REPOSITORY_PATH }}/${{ env.IMAGE }}:latest" \
--tag "ghcr.io/${{ env.GHCR_ORG }}/${{ env.IMAGE }}:${{ env.VERSION }}" \
Expand Down
Loading
Loading