Skip to content

Commit bd1c808

Browse files
committed
Merge branch 'master' into issue_2304_dstack_apply_stdin
2 parents 32c4c98 + 83835ba commit bd1c808

645 files changed

Lines changed: 30765 additions & 8168 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.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ jobs:
3535
- run: uv tool install pre-commit
3636
- run: pre-commit run -a --show-diff-on-failure
3737

38+
frontend-lint:
39+
runs-on: ubuntu-latest
40+
defaults:
41+
run:
42+
working-directory: frontend
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Install modules
46+
run: npm install
47+
- name: Run Eslint
48+
run: npm run precommit
49+
3850
frontend-build:
3951
runs-on: ubuntu-latest
4052
defaults:
@@ -123,7 +135,10 @@ jobs:
123135
defaults:
124136
run:
125137
working-directory: runner
126-
runs-on: ubuntu-latest
138+
runs-on: ${{ matrix.os }}
139+
strategy:
140+
matrix:
141+
os: [ubuntu-latest, macos-latest]
127142
steps:
128143
- uses: actions/checkout@v4
129144
- name: Set up Go
@@ -164,7 +179,8 @@ jobs:
164179
strategy:
165180
matrix:
166181
include:
167-
- { goos: "linux", goarch: "amd64", runson: "ubuntu-latest" }
182+
- { goos: "linux", goarch: "amd64" }
183+
- { goos: "linux", goarch: "arm64" }
168184
runs-on: ubuntu-latest
169185
steps:
170186
- uses: actions/checkout@v4
@@ -177,7 +193,6 @@ jobs:
177193
env:
178194
GOOS: ${{ matrix.goos }}
179195
GOARCH: ${{ matrix.goarch }}
180-
ACTIONSOS: ${{ matrix.runson }}
181196
CGO_ENABLED: 0
182197
run: |
183198
VERSION=$((${{ github.run_number }} + ${{ env.BUILD_INCREMENT }}))
@@ -237,8 +252,8 @@ jobs:
237252
run: uv sync
238253
- name: Generate json schema
239254
run: |
240-
uv run python -c "from dstack._internal.core.models.configurations import DstackConfiguration; print(DstackConfiguration.schema_json(indent=2))" > configuration.json
241-
uv run python -c "from dstack._internal.core.models.profiles import ProfilesConfig; print(ProfilesConfig.schema_json(indent=2))" > profiles.json
255+
uv run python -c "from dstack._internal.core.models.configurations import DstackConfiguration; print(DstackConfiguration.schema_json())" > configuration.json
256+
uv run python -c "from dstack._internal.core.models.profiles import ProfilesConfig; print(ProfilesConfig.schema_json())" > profiles.json
242257
- name: Upload json schema to S3
243258
run: |
244259
VERSION=$((${{ github.run_number }} + ${{ env.BUILD_INCREMENT }}))
@@ -287,12 +302,13 @@ jobs:
287302
python-version: 3.11
288303
- name: Install dstack
289304
run: |
290-
uv sync --extra server
305+
uv pip install examples/plugins/example_plugin_server
306+
uv pip install -e '.[server]'
291307
# Move these deps into an extra and install that way
292308
- name: Build
293309
run: |
294310
uv pip install pillow cairosvg
295-
sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
311+
sudo apt-get update && sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
296312
uv pip install mkdocs-material "mkdocs-material[imaging]" mkdocs-material-extensions mkdocs-redirects mkdocs-gen-files "mkdocstrings[python]" mkdocs-render-swagger-plugin --upgrade
297313
uv pip install git+https://${{ secrets.GH_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
298314
uv run mkdocs build -s
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
name: Build EFA Docker image
1+
name: Build AMD SMI Docker image
22

33
on:
44
workflow_dispatch:
55
inputs:
66
image_name:
77
description: "Docker image name"
88
required: true
9-
default: "dstackai/efa"
9+
default: "dstackai/amd-smi"
10+
rocm_version:
11+
description: "ROCm version"
12+
required: true
13+
default: "6.4"
1014
dstack_revision:
1115
description: "Docker image revision"
1216
required: true
1317
default: 0
1418

1519
jobs:
16-
build-efa:
20+
build-amd-smi:
1721
defaults:
1822
run:
19-
working-directory: docker/efa
23+
working-directory: docker/amd-smi
2024
runs-on: ubuntu-latest
2125
steps:
2226
- name: Checkout repository
@@ -31,14 +35,15 @@ jobs:
3135
- name: Build and upload to DockerHub
3236
run: |
3337
IMAGE_NAME=${{ inputs.image_name }}
34-
BUILD_DATE=$(date --utc --iso-8601=seconds)Z
3538
docker buildx build . \
3639
--load \
3740
--provenance=false \
3841
--platform linux/amd64 \
3942
--build-arg IMAGE_NAME=${IMAGE_NAME} \
43+
--build-arg UBUNTU_VERSION=noble \
44+
--build-arg ROCM_VERSION=${{ inputs.rocm_version }} \
4045
--build-arg DSTACK_REVISION=${{ inputs.dstack_revision }} \
41-
--build-arg BUILD_DATE=${BUILD_DATE} \
46+
--build-arg BUILD_DATE=$(date --utc --iso-8601=seconds)Z \
4247
--tag ${IMAGE_NAME}:latest
4348
VERSION=$(docker inspect --format '{{ index .Config.Labels "org.opencontainers.image.version" }}' ${IMAGE_NAME})
4449
docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:${VERSION}

.github/workflows/docker.yml

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ on:
88
description: "Docker image version"
99
required: true
1010
staging:
11-
description: "Staging build"
11+
description: "Build staging images"
12+
type: boolean
13+
default: false
14+
prepull_staging:
15+
description: "Pre-pull staging Docker images"
1216
type: boolean
1317
default: false
1418
build_docker:
15-
description: "Build docker images"
19+
description: "Build Docker images"
1620
type: boolean
1721
default: true
1822
build_aws:
@@ -34,7 +38,9 @@ on:
3438

3539
env:
3640
PACKER_VERSION: "1.9.2"
37-
BUILD_PREFIX: ${{ inputs.staging && format('stgn-{0}-', github.run_number) || '' }} # staging ? prefix : ''
41+
BUILD_DOCKER_REPO: ${{ inputs.staging && 'base-stgn' || 'base' }}
42+
PREPULL_DOCKER_REPO: ${{ inputs.prepull_staging && 'base-stgn' || 'base' }}
43+
VM_IMAGE_BUILD_PREFIX: ${{ inputs.staging && format('stgn-{0}-', github.run_number) || '' }} # staging ? prefix : ''
3844

3945
jobs:
4046
build-docker:
@@ -45,7 +51,8 @@ jobs:
4551
runs-on: ubuntu-latest
4652
strategy:
4753
matrix:
48-
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
54+
flavor: ["base", "devel", "devel-efa"]
55+
ubuntu_version: ["22"]
4956
steps:
5057
- name: Checkout repository
5158
uses: actions/checkout@v4
@@ -60,8 +67,21 @@ jobs:
6067
uses: docker/setup-qemu-action@v3
6168
- name: Build and upload to DockerHub
6269
run: |
63-
docker buildx build --platform linux/amd64 --build-arg PYTHON=${{ matrix.python }} --push --provenance=false --tag dstackai/base:py${{ matrix.python }}-${{ inputs.image_version }}-cuda-12.1 -f base/Dockerfile .
64-
docker buildx build --platform linux/amd64 --build-arg PYTHON=${{ matrix.python }} --build-arg VERSION=${{ inputs.image_version }} --push --provenance=false --tag dstackai/base:py${{ matrix.python }}-${{ inputs.image_version }}-cuda-12.1-devel -f base/devel.Dockerfile .
70+
if [ "${{ matrix.flavor }}" = "base" ]; then
71+
FILE="base/Dockerfile"
72+
elif [ "${{ matrix.flavor }}" = "devel" ]; then
73+
FILE="base/Dockerfile"
74+
else
75+
FILE="base/efa/Dockerfile"
76+
fi
77+
docker buildx build \
78+
--platform linux/amd64 \
79+
--tag dstackai/${{ env.BUILD_DOCKER_REPO }}:${{ inputs.image_version }}-${{ matrix.flavor }}-ubuntu${{ matrix.ubuntu_version }}.04 \
80+
--build-arg FLAVOR=${{ matrix.flavor }} \
81+
--build-arg UBUNTU_VERSION=${{ matrix.ubuntu_version }} \
82+
--provenance=false \
83+
--push \
84+
-f $FILE .
6585
6686
build-aws-images:
6787
needs: build-docker
@@ -85,7 +105,7 @@ jobs:
85105
chmod +x packer
86106
- name: Run packer
87107
run: |
88-
./packer build -var-file=versions.json $PROD_VARS -var image_version=${{ inputs.image_version }} -var build_prefix=$BUILD_PREFIX aws-image${{ matrix.variant }}.json
108+
./packer build -var-file=versions.json $PROD_VARS -var image_repo=${{ env.PREPULL_DOCKER_REPO }} -var image_version=${{ inputs.image_version }} -var build_prefix=$VM_IMAGE_BUILD_PREFIX aws-image${{ matrix.variant }}.json
89109
env:
90110
PROD_VARS: ${{ !inputs.staging && '-var-file=aws-vars-prod.json' || '' }} # production ? var-file : ''
91111

@@ -118,12 +138,12 @@ jobs:
118138
chmod +x packer
119139
- name: Run packer
120140
run: |
121-
./packer build -var-file=versions.json -var image_version=${{ inputs.image_version }} -var build_prefix=$BUILD_PREFIX azure-image${{ matrix.variant }}.json
141+
./packer build -var-file=versions.json -var image_repo=${{ env.PREPULL_DOCKER_REPO }} -var image_version=${{ inputs.image_version }} -var build_prefix=$VM_IMAGE_BUILD_PREFIX azure-image${{ matrix.variant }}.json
122142
- name: Publish azure image
123143
if: ${{ !inputs.staging }}
124144
run: |
125-
IMAGE_DEFINITION=${BUILD_PREFIX}dstack${{ matrix.variant }}-${{ inputs.image_version }}
126-
IMAGE_NAME=${BUILD_PREFIX}dstack${{ matrix.variant }}-${{ inputs.image_version }}
145+
IMAGE_DEFINITION=${VM_IMAGE_BUILD_PREFIX}dstack${{ matrix.variant }}-${{ inputs.image_version }}
146+
IMAGE_NAME=${VM_IMAGE_BUILD_PREFIX}dstack${{ matrix.variant }}-${{ inputs.image_version }}
127147
../publish_azure_image.sh $IMAGE_DEFINITION $IMAGE_NAME
128148
129149
build-gcp-images:
@@ -156,11 +176,11 @@ jobs:
156176
chmod +x packer
157177
- name: Run packer
158178
run: |
159-
./packer build -var-file=versions.json -var image_version=${{ inputs.image_version }} -var build_prefix=$BUILD_PREFIX gcp-image${{ matrix.variant }}.json
179+
./packer build -var-file=versions.json -var image_repo=${{ env.PREPULL_DOCKER_REPO }} -var image_version=${{ inputs.image_version }} -var build_prefix=$VM_IMAGE_BUILD_PREFIX gcp-image${{ matrix.variant }}.json
160180
- name: Publish images
161181
run: |
162182
IMAGE_VERSION=${IMAGE_VERSION//./-}
163-
gcloud compute images add-iam-policy-binding ${BUILD_PREFIX}dstack${{ matrix.variant }}-$IMAGE_VERSION --member='allAuthenticatedUsers' --role='roles/compute.imageUser'
183+
gcloud compute images add-iam-policy-binding ${VM_IMAGE_BUILD_PREFIX}dstack${{ matrix.variant }}-$IMAGE_VERSION --member='allAuthenticatedUsers' --role='roles/compute.imageUser'
164184
env:
165185
IMAGE_VERSION: ${{ inputs.image_version }}
166186

@@ -205,8 +225,9 @@ jobs:
205225
run: |
206226
./packer build \
207227
-var-file=versions.json \
228+
-var image_repo=${{ env.PREPULL_DOCKER_REPO }} \
208229
-var image_version=${{ inputs.image_version }} \
209-
-var build_prefix=$BUILD_PREFIX \
230+
-var build_prefix=$VM_IMAGE_BUILD_PREFIX \
210231
-var oci_compartment_ocid=$OCI_COMPARTMENT \
211232
-var oci_subnet_ocid=$OCI_SUBNET \
212233
-var oci_availability_domain=$OCI_AVAILABILITY_DOMAIN \
@@ -221,14 +242,14 @@ jobs:
221242
if: ${{ !inputs.staging }}
222243
run: |
223244
uv run scripts/oci_image_tools.py copy \
224-
--image ${BUILD_PREFIX}dstack${{ matrix.variant }}-${{ inputs.image_version }} \
245+
--image ${VM_IMAGE_BUILD_PREFIX}dstack${{ matrix.variant }}-${{ inputs.image_version }} \
225246
--from $OCI_REGION \
226247
--compartment $OCI_COMPARTMENT
227248
- name: Publish image in OCI Marketplace
228249
if: ${{ !inputs.staging }}
229250
run: |
230251
uv run scripts/oci_image_tools.py publish \
231-
--image ${BUILD_PREFIX}dstack${{ matrix.variant }}-${{ inputs.image_version }} \
252+
--image ${VM_IMAGE_BUILD_PREFIX}dstack${{ matrix.variant }}-${{ inputs.image_version }} \
232253
--compartment $OCI_COMPARTMENT \
233254
--version ${{ inputs.image_version }} \
234255
--description "Image for running workloads with dstack - https://dstack.ai/" \

.github/workflows/docs.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ jobs:
1616
python-version: 3.11
1717
- name: Install dstack
1818
run: |
19+
uv pip install examples/plugins/example_plugin_server
1920
if [ -n "${{ inputs.release_tag }}" ]; then
2021
uv pip install "dstack[server]==${{ inputs.release_tag }}"
2122
else
22-
uv sync --extra server
23+
uv pip install -e '.[server]'
2324
fi
2425
- name: Build
2526
run: |
2627
uv pip install pillow cairosvg
27-
sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
28+
sudo apt-get update && sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev
2829
uv pip install mkdocs-material "mkdocs-material[imaging]" mkdocs-material-extensions mkdocs-redirects mkdocs-gen-files "mkdocstrings[python]" mkdocs-render-swagger-plugin --upgrade
2930
uv pip install git+https://${{ secrets.GH_TOKEN }}@github.com/squidfunk/mkdocs-material-insiders.git
3031
uv run mkdocs build -s

.github/workflows/release.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ jobs:
118118
strategy:
119119
matrix:
120120
include:
121-
- { goos: "linux", goarch: "amd64", runson: "ubuntu-latest" }
121+
- { goos: "linux", goarch: "amd64" }
122+
- { goos: "linux", goarch: "arm64" }
122123
runs-on: ubuntu-latest
123124
steps:
124125
- uses: actions/checkout@v4
@@ -131,7 +132,6 @@ jobs:
131132
env:
132133
GOOS: ${{ matrix.goos }}
133134
GOARCH: ${{ matrix.goarch }}
134-
ACTIONSOS: ${{ matrix.runson }}
135135
CGO_ENABLED: 0
136136
run: |
137137
VERSION=${GITHUB_REF#refs/tags/}
@@ -230,10 +230,12 @@ jobs:
230230
- name: Upload pip package
231231
run: |
232232
VERSION=${GITHUB_REF#refs/tags/}
233-
BASE_IMAGE=$(cat src/dstack/version.py | grep base_image)
233+
BASE_IMAGE=$(cat src/dstack/version.py | grep "base_image = ")
234+
BASE_IMAGE_UBUNTU_VERSION=$(cat src/dstack/version.py | grep "base_image_ubuntu_version = ")
234235
echo "__version__ = \"$VERSION\"" > src/dstack/version.py
235236
echo "__is_release__ = True" >> src/dstack/version.py
236237
echo $BASE_IMAGE >> src/dstack/version.py
238+
echo $BASE_IMAGE_UBUNTU_VERSION >> src/dstack/version.py
237239
cp README.md src
238240
uv build
239241
uv publish --username ${{ secrets.PYPI_USERNAME }} --password ${{ secrets.PYPI_PASSWORD }}
@@ -309,8 +311,8 @@ jobs:
309311
run: uv sync
310312
- name: Generate json schema
311313
run: |
312-
uv run python -c "from dstack._internal.core.models.configurations import DstackConfiguration; print(DstackConfiguration.schema_json(indent=2))" > configuration.json
313-
uv run python -c "from dstack._internal.core.models.profiles import ProfilesConfig; print(ProfilesConfig.schema_json(indent=2))" > profiles.json
314+
uv run python -c "from dstack._internal.core.models.configurations import DstackConfiguration; print(DstackConfiguration.schema_json())" > configuration.json
315+
uv run python -c "from dstack._internal.core.models.profiles import ProfilesConfig; print(ProfilesConfig.schema_json())" > profiles.json
314316
- name: Upload json schema to S3
315317
run: |
316318
VERSION=${GITHUB_REF#refs/tags/}

.gitignore

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,26 @@
33
*.egg-info
44

55
dist/
6+
build/
67
venv/
78
/site/
89
/.cache/
910
.pytest_cache/
1011
.coverage
1112

1213
.idea/
14+
.fleet
15+
.vscode
16+
.aider*
17+
.local/
18+
.DS_Store
19+
.env
20+
.envrc
21+
uv.lock
1322

1423
/runner/cmd/shim/shim
1524
/runner/cmd/runner/runner
1625

1726
/src/dstack/_internal/server/statics
1827

19-
build/
20-
.DS_Store
21-
.fleet
22-
.env
23-
.aider*
24-
uv.lock
28+
profiling_results.html

.justfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Root justfile
2+
#
3+
# This justfile serves as the main entry point to recipes from different components.
4+
#
5+
# Run `just` to see all available commands.
6+
#
7+
# Components:
8+
# * runner/justfile – Building and uploading dstack runner and shim
9+
10+
default:
11+
@just --list
12+
13+
set allow-duplicate-recipes
14+
15+
import "runner/.justfile"
16+
17+
import "frontend/.justfile"

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.5.3 # Should match requirements_dev.txt
3+
rev: v0.11.6 # Should match pyproject.toml
44
hooks:
55
- id: ruff
66
name: ruff common
@@ -10,7 +10,7 @@ repos:
1010
rev: v1.62.0 # Should match .github/workflows/build.yml
1111
hooks:
1212
- id: golangci-lint-full
13-
language_version: 1.23.0 # Should match runner/go.mod
13+
language_version: 1.23.8 # Should match runner/go.mod
1414
entry: bash -c 'cd runner && golangci-lint run'
1515
stages: [manual]
1616
- repo: https://github.com/pre-commit/pre-commit-hooks

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ uv run pytest src/tests --runpostgres
5454

5555
If you'd like to integrate a new cloud provider to `dstack`, follow [contributing/BACKENDS.md](contributing/BACKENDS.md).
5656

57-
## Get help
57+
## What's next
58+
59+
You can find more subject-focused guides in the [contributing](contributing/) directory.
5860

5961
If you have any questions, you can always get help in our [Discord](https://discord.gg/u8SmfwPpMd) community.

0 commit comments

Comments
 (0)