feat: dev tools
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# Custom install scripts
|
||||
|
||||
This directory supplies the ready-made `python` and `dotnet` scripts. They are not reserved:
|
||||
modify, replace, or remove them like any other script. Place other trusted executable install
|
||||
scripts here and add the desired file names to `AGENTCI_INSTALL_SCRIPTS`. Compose mounts the
|
||||
directory read-only at `/etc/agentci/install-scripts`.
|
||||
|
||||
Scripts run from the cloned repository with a sanitized environment. They receive:
|
||||
|
||||
- `DEV_TOOLS_DIR`: persistent, writable tool storage at `/var/lib/agentci/dev-tools`
|
||||
- `PATH`: `$DEV_TOOLS_DIR/bin` followed by the service path
|
||||
- `PYTHON_VERSION` and `DOTNET_CHANNEL`: configured built-in runtime versions
|
||||
|
||||
`DEV_TOOLS_DIR` is shared by jobs through the `agentci_data` volume. Put downloaded SDK/runtime
|
||||
files beneath it and install command wrappers or symlinks into `$DEV_TOOLS_DIR/bin`; that `bin`
|
||||
directory is prepended to implementation agents' `PATH`. Environment changes made by a script do
|
||||
not persist into implementation turns.
|
||||
|
||||
The configured scripts run in list order after the repository is cloned (or an existing agent PR
|
||||
branch is synchronized) and before the first implementation turn for `implement`, `iterate`, and
|
||||
`fix`. They do not rerun between implementation and review-revision turns within one job. Scripts
|
||||
must be executable, idempotent, and must not expect AgentCI or Gitea credentials.
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
: "${DEV_TOOLS_DIR:?DEV_TOOLS_DIR is required}"
|
||||
: "${DOTNET_CHANNEL:?DOTNET_CHANNEL is required}"
|
||||
|
||||
install_dir="$DEV_TOOLS_DIR/dotnet"
|
||||
bin_dir="$DEV_TOOLS_DIR/bin"
|
||||
installer=$(mktemp)
|
||||
trap 'rm -f "$installer"' EXIT
|
||||
|
||||
mkdir -p "$install_dir" "$bin_dir"
|
||||
python3 - "$installer" <<'PYTHON'
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
urllib.request.urlretrieve("https://dot.net/v1/dotnet-install.sh", sys.argv[1])
|
||||
PYTHON
|
||||
|
||||
/bin/bash "$installer" \
|
||||
--channel "$DOTNET_CHANNEL" \
|
||||
--install-dir "$install_dir" \
|
||||
--no-path
|
||||
|
||||
printf '%s\n' \
|
||||
'#!/bin/sh' \
|
||||
"export DOTNET_ROOT='$install_dir'" \
|
||||
"exec '$install_dir/dotnet' \"\$@\"" \
|
||||
> "$bin_dir/dotnet"
|
||||
chmod 0755 "$bin_dir/dotnet"
|
||||
"$bin_dir/dotnet" --info
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
: "${DEV_TOOLS_DIR:?DEV_TOOLS_DIR is required}"
|
||||
: "${PYTHON_VERSION:?PYTHON_VERSION is required}"
|
||||
|
||||
install_dir="$DEV_TOOLS_DIR/python"
|
||||
bin_dir="$DEV_TOOLS_DIR/bin"
|
||||
minor_version=$(printf '%s' "$PYTHON_VERSION" | cut -d. -f1,2)
|
||||
|
||||
mkdir -p "$install_dir" "$bin_dir"
|
||||
UV_NO_CONFIG=1 \
|
||||
UV_PYTHON_INSTALL_DIR="$install_dir" \
|
||||
UV_PYTHON_BIN_DIR="$bin_dir" \
|
||||
UV_PYTHON_INSTALL_BIN=1 \
|
||||
uv python install "$PYTHON_VERSION"
|
||||
|
||||
ln -sfn "python$minor_version" "$bin_dir/python3"
|
||||
ln -sfn "python$minor_version" "$bin_dir/python"
|
||||
"$bin_dir/python" --version
|
||||
Reference in New Issue
Block a user