Skip to content

Commit 039d29b

Browse files
committed
Merge branch 'master' into 3182-instance-termination_reason
2 parents 9b3ff02 + 201952a commit 039d29b

478 files changed

Lines changed: 18827 additions & 7561 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-artifacts.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ jobs:
114114
- name: Check if go.mod and go.sum are up-to-date
115115
run: go mod tidy -diff
116116
- name: Run golangci-lint
117-
uses: golangci/golangci-lint-action@v6
117+
uses: golangci/golangci-lint-action@v9
118118
with:
119-
version: v1.62.0 # Should match .pre-commit-config.yaml
119+
version: v2.6.2 # Should match .pre-commit-config.yaml
120120
args: --timeout=20m
121121
working-directory: runner
122122
- name: Test
@@ -187,7 +187,7 @@ jobs:
187187
if [[ "${{ inputs.staging }}" == "false" ]]; then
188188
sed \
189189
-i.old \
190-
"s|@ git+https://github.com/dstackai/dstack.git@master|== ${{ inputs.version }}|" \
190+
"s|@ https://github.com/dstackai/dstack/archive/refs/heads/master.tar.gz|== ${{ inputs.version }}|" \
191191
pyproject.toml
192192
diff pyproject.toml pyproject.toml.old > /dev/null && echo "Could not set version" && exit 1
193193
fi

.github/workflows/build-docs.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ name: Build Docs
22

33
on:
44
workflow_call:
5-
inputs:
6-
release-tag:
7-
type: string
8-
required: false
95

106
jobs:
117
build-docs:
@@ -17,18 +13,10 @@ jobs:
1713
python-version: 3.11
1814
- name: Install dstack
1915
run: |
20-
uv pip install examples/plugins/example_plugin_server
21-
if [ -n "${{ inputs.release-tag }}" ]; then
22-
uv pip install "dstack[server]==${{ inputs.release-tag }}"
23-
else
24-
uv pip install -e '.[server]'
25-
fi
16+
uv sync --extra server
2617
- name: Build
2718
run: |
28-
uv pip install pillow cairosvg
2919
sudo apt-get update && sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
30-
uv pip install mkdocs-material "mkdocs-material[imaging]" mkdocs-material-extensions mkdocs-redirects mkdocs-gen-files "mkdocstrings[python]" mkdocs-render-swagger-plugin --upgrade
31-
uv pip install git+https://${{ secrets.GH_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
3220
uv run mkdocs build -s
3321
- uses: actions/upload-artifact@v4
3422
with:

.github/workflows/docker-amd-smi.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
description: "Docker image revision"
1616
required: true
1717
default: 0
18+
tag_latest:
19+
description: "Update 'latest'"
20+
type: boolean
21+
default: false
1822

1923
jobs:
2024
build-amd-smi:
@@ -48,4 +52,7 @@ jobs:
4852
VERSION=$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.version" }}' ${IMAGE_NAME})
4953
docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:${VERSION}
5054
docker push ${IMAGE_NAME}:${VERSION}
51-
docker push ${IMAGE_NAME}:latest
55+
- name: Tag and push latest
56+
if: ${{ inputs.tag_latest }}
57+
run: |
58+
docker push ${{ inputs.image_name }}:latest

.github/workflows/docker.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,15 @@ jobs:
6565
password: ${{ secrets.DOCKERHUB_TOKEN }}
6666
- name: Set up QEMU
6767
uses: docker/setup-qemu-action@v3
68+
- name: Free up some space
69+
run: |
70+
df -h /
71+
du -hs /usr/share/dotnet
72+
rm -rf /usr/share/dotnet
73+
df -h /
6874
- name: Build and upload to DockerHub
6975
run: |
70-
if [ "${{ matrix.flavor }}" = "base" ]; then
76+
if [ "${{ matrix.flavor }}" = "base" ]; then
7177
FILE="base/Dockerfile"
7278
elif [ "${{ matrix.flavor }}" = "devel" ]; then
7379
FILE="base/Dockerfile"

.github/workflows/docs.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@ name: Build & Deploy Docs
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
release-tag:
7-
description: "dstack version"
85

96
jobs:
107
build-docs:
118
uses: ./.github/workflows/build-docs.yml
12-
with:
13-
release-tag: ${{ inputs.release-tag }}
149
secrets: inherit
1510

1611
deploy-docs:

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,17 @@ jobs:
100100
VERSION=${{ needs.compute-version.outputs.version }}
101101
docker buildx build --platform linux/arm64/v8 --build-arg VERSION=$VERSION --push --provenance=false --tag dstackai/dstack:$VERSION-arm64 -f release/Dockerfile .
102102
docker buildx build --platform linux/amd64 --build-arg VERSION=$VERSION --push --provenance=false --tag dstackai/dstack:$VERSION-amd64 -f release/Dockerfile .
103+
docker buildx build --platform linux/arm64/v8 --build-arg BASE_IMAGE=dstackai/dstack:$VERSION-arm64 --push --provenance=false --tag dstackai/dstack:nebius-$VERSION-arm64 -f Dockerfile.nebius .
104+
docker buildx build --platform linux/amd64 --build-arg BASE_IMAGE=dstackai/dstack:$VERSION-amd64 --push --provenance=false --tag dstackai/dstack:nebius-$VERSION-amd64 -f Dockerfile.nebius .
103105
docker manifest create dstackai/dstack:$VERSION --amend dstackai/dstack:$VERSION-arm64 --amend dstackai/dstack:$VERSION-amd64
104106
docker manifest push dstackai/dstack:$VERSION
107+
docker manifest create dstackai/dstack:nebius-$VERSION --amend dstackai/dstack:nebius-$VERSION-arm64 --amend dstackai/dstack:nebius-$VERSION-amd64
108+
docker manifest push dstackai/dstack:nebius-$VERSION
105109
if [ -n "${{ needs.compute-version.outputs.latest }}" ]; then
106110
docker manifest create dstackai/dstack:latest --amend dstackai/dstack:$VERSION-arm64 --amend dstackai/dstack:$VERSION-amd64
107111
docker manifest push dstackai/dstack:latest
112+
docker manifest create dstackai/dstack:nebius-latest --amend dstackai/dstack:nebius-$VERSION-arm64 --amend dstackai/dstack:nebius-$VERSION-amd64
113+
docker manifest push dstackai/dstack:nebius-latest
108114
fi
109115
- name: Docker Hub Description
110116
uses: peter-evans/dockerhub-description@v4

.pre-commit-config.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.11.6 # Should match pyproject.toml
3+
rev: v0.12.7 # Should match pyproject.toml
44
hooks:
55
- id: ruff
66
name: ruff common
77
args: ['--fix']
88
- id: ruff-format
99
- repo: https://github.com/golangci/golangci-lint
10-
rev: v1.62.0 # Should match .github/workflows/build-artifacts.yml
10+
rev: v2.6.2 # Should match .github/workflows/build-artifacts.yml
1111
hooks:
1212
- id: golangci-lint-full
13-
language_version: 1.23.8 # Should match runner/go.mod
13+
alias: runner-fix
14+
language_version: 1.25.0 # Should match runner/go.mod
15+
entry: bash -c 'cd runner && golangci-lint run --fix'
16+
stages: [manual]
17+
- id: golangci-lint-full
18+
alias: runner-lint
19+
language_version: 1.25.0 # Should match runner/go.mod
1420
entry: bash -c 'cd runner && golangci-lint run'
1521
stages: [manual]
1622
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -21,6 +27,7 @@ repos:
2127
hooks:
2228
- id: frontend-pre-commit
2329
name: frontend-pre-commit
24-
entry: bash -c "cd frontend && npm install && npm run precommit"
30+
entry: bash -c "cd frontend && npm install && npm run pre-commit"
2531
language: system
2632
pass_filenames: false
33+
files: ^frontend/

AGENTS.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
- Core Python package lives in `src/dstack`; internal modules (including server) sit under `_internal`, API surfaces under `api`, and plugin integrations under `plugins`.
5+
- Tests reside in `src/tests` and mirror package paths; add new suites alongside the code they cover.
6+
- Frontend lives in `frontend` (React/webpack) and is built into `src/dstack/_internal/server/statics`.
7+
- Docs sources are in `docs` with extra contributor notes in `contributing/*.md`; examples for users sit in `examples/`.
8+
9+
## Build, Test, and Development Commands
10+
- Install deps (editable package with extras): `uv sync --all-extras` (uses `.venv` in repo).
11+
- Run CLI/server from source: `uv run dstack ...` (e.g., `uv run dstack server --port 8000`).
12+
- Lint/format: `uv run ruff check .` and `uv run ruff format .`.
13+
- Type check: `uv run pyright -p .`.
14+
- Test suite: `uv run pytest`.
15+
- Frontend: from `frontend/` run `npm install`, `npm run build`, then copy `frontend/build` into `src/dstack/_internal/server/statics/`; for dev, `npm run start` with API on port 8000.
16+
17+
## Coding Style & Naming Conventions
18+
- Python targets 3.9+ with 4-space indentation and max line length of 99 (see `ruff.toml`; `E501` is ignored but keep lines readable).
19+
- Imports are sorted via Ruff’s isort settings (`dstack` treated as first-party).
20+
- Prefer pydantic-style models in `core/models`.
21+
- Tests use `test_*.py` modules and `test_*` functions; fixtures live near usage.
22+
23+
## Testing Guidelines
24+
- Default to `uv run pytest`. Use markers from `tests/conftest.py` like `--runpostgres` if need to include specific tests.
25+
- Group tests for the same unit (function/class) using `Test*` classes that mirror unit's name.
26+
- Keep tests hermetic (network disabled except localhost per `pytest.ini`); stub cloud calls with mocks.
27+
28+
## Commit & Pull Request Guidelines
29+
- Commit messages follow the existing style: short, imperative summaries (e.g., “Fix exclude_not_available ignored”); include rationale in the body if needed.
30+
- For PRs, describe behavior changes and link related issues.
31+
- Include screenshots or terminal output when touching UX/CLI messages or frontend flows.
32+
- Always disclose AI Assistance in PRs.

CONTRIBUTING.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
We appreciate your interest in contributing to `dstack`! This document will help you get up to speed with `dstack` codebase and guide you through the contribution process.
44

5+
## AI Assistance Notice
6+
7+
If you are using any kind of AI assistance while contributing to `dstack`,
8+
**this must be disclosed in the pull request**, along with the extent to
9+
which AI assistance was used.
10+
As an exception, tab-completions and trivial PRs don't need to be disclosed.
11+
12+
An example disclosure:
13+
14+
> This PR was written primarily by Claude Code.
15+
16+
Failure to disclose this, makes it difficult to determine how much scrutiny to apply to the contribution. Please be respectful to maintainers and disclose AI assistance.
17+
518
## Set up your development environment
619

720
Follow [contributing/DEVELOPMENT.md](contributing/DEVELOPMENT.md).
@@ -22,7 +35,7 @@ If you make a non-trivial change to `dstack`, we recommend you learn about `dsta
2235
* Bug fixes that address a clearly defined bug. Include steps to reproduce in the linked issue or the PR.
2336
* New features. Before submitting a feature PR, create an issue with a proposal to discuss it with the core team and other interested parties.
2437
* Minor fixes such as typos.
25-
* [Examples](examples/README.md).
38+
* [Examples](examples).
2639

2740
### Before pushing your changes
2841

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Backends can be set up in `~/.dstack/server/config.yml` or through the [project
5252

5353
For more details, see [Backends](https://dstack.ai/docs/concepts/backends).
5454

55-
> When using `dstack` with on-prem servers, backend configuration isn’t required. Simply create [SSH fleets](https://dstack.ai/docs/concepts/fleets#ssh) once the server is up.
55+
> When using `dstack` with on-prem servers, backend configuration isn’t required. Simply create [SSH fleets](https://dstack.ai/docs/concepts/fleets#ssh-fleets) once the server is up.
5656
5757
##### Start the server
5858

0 commit comments

Comments
 (0)