Skip to content

Commit 83996e6

Browse files
feat(raycicmd): set RAYCI_ARTIFACTS_DIR for wanda steps
Set RAYCI_ARTIFACTS_DIR environment variable for wanda steps based on the target platform. Uses /c/tmp/artifacts for Windows (detected via instance_type containing "windows") and /tmp/artifacts for other platforms. This enables wanda to extract build artifacts to the correct location for Buildkite artifact upload. Topic: raycicmd-artifacts Relative: wanda-artifact-cli Signed-off-by: andrew <andrew@anyscale.com>
1 parent bd70791 commit 83996e6

File tree

7 files changed

+83
-6
lines changed

7 files changed

+83
-6
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM alpine:latest
2+
3+
RUN mkdir -p /build/dist /app/bin \
4+
&& echo "wheel-content-1.0" > /build/dist/mypackage-1.0.0.whl \
5+
&& echo "wheel-content-1.1" > /build/dist/mypackage-1.1.0.whl \
6+
&& echo "binary-content" > /app/bin/myapp \
7+
&& chmod +x /app/bin/myapp
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: artifact-test
2+
froms:
3+
- alpine:latest
4+
dockerfile: .buildkite/artifact-test.Dockerfile
5+
artifacts:
6+
- src: /app/bin/myapp
7+
dst: bin/myapp
8+
- src: /build/dist/*.whl
9+
dst: wheels/
10+
- src: /nonexistent/optional-file.txt
11+
dst: optional.txt
12+
optional: true

.buildkite/forge.rayci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,9 @@ steps:
3434
- name: forge-arm64
3535
wanda: .buildkite/forge-arm64.wanda.yaml
3636
instance_type: builder-arm64
37+
38+
- name: artifact-test
39+
tags:
40+
- wanda
41+
- raycicmd
42+
wanda: .buildkite/artifact-test.wanda.yaml

raycicmd/bk_pipeline.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,7 @@ var (
220220

221221
defaultArtifactPaths = []string{"/tmp/artifacts/**/*"}
222222
windowsArtifactPaths = []string{`C:\tmp\artifacts\**\*`}
223+
224+
defaultArtifactsMountDir = "/tmp/artifacts"
225+
windowsArtifactsMountDir = "/c/tmp/artifacts"
223226
)

raycicmd/converter.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package raycicmd
22

3-
import (
4-
"fmt"
5-
)
3+
import "fmt"
64

75
type converter struct {
86
config *config

raycicmd/converter_test.go

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ func TestConvertPipelineStep(t *testing.T) {
139139
"broken": skipQueue,
140140
},
141141

142+
BuilderQueues: map[string]string{
143+
"builder": "fakebuilder",
144+
"builder-windows": "fakewinbuilder",
145+
},
146+
142147
Env: map[string]string{
143148
"BUILDKITE_BAZEL_CACHE_URL": "https://bazel-build-cache",
144149
},
@@ -354,15 +359,18 @@ func TestConvertPipelineStep(t *testing.T) {
354359
"matrix": []any{"py36", "py37"},
355360
},
356361
out: map[string]any{
357-
"label": "my forge",
358-
"key": "forge",
359-
"commands": wandaCommands("beta"),
362+
"label": "my forge",
363+
"key": "forge",
364+
"commands": wandaCommands("beta"),
365+
"agents": newBkAgents("fakebuilder"),
366+
"artifact_paths": defaultArtifactPaths,
360367
"env": map[string]string{
361368
"RAYCI_BUILD_ID": buildID,
362369
"RAYCI_TEMP": "s3://ci-temp/abc123/",
363370
"BUILDKITE_BAZEL_CACHE_URL": "https://bazel-build-cache",
364371
"RAYCI_WORK_REPO": "fakeecr",
365372
"RAYCI_BRANCH": "beta",
373+
"RAYCI_ARTIFACTS_DIR": "/tmp/artifacts",
366374

367375
"RAYCI_WANDA_FILE": "ci/forge.wanda.yaml",
368376
"RAYCI_WANDA_NAME": "forge",
@@ -378,6 +386,37 @@ func TestConvertPipelineStep(t *testing.T) {
378386
},
379387
"timeout_in_minutes": 300,
380388
},
389+
}, {
390+
// Windows wanda step
391+
in: map[string]any{
392+
"name": "windows-forge",
393+
"wanda": "ci/windows.wanda.yaml",
394+
"instance_type": "builder-windows",
395+
},
396+
out: map[string]any{
397+
"label": "wanda: windows-forge",
398+
"key": "windows-forge",
399+
"commands": wandaCommands("beta"),
400+
"artifact_paths": windowsArtifactPaths,
401+
"env": map[string]string{
402+
"RAYCI_BUILD_ID": buildID,
403+
"RAYCI_TEMP": "s3://ci-temp/abc123/",
404+
"BUILDKITE_BAZEL_CACHE_URL": "https://bazel-build-cache",
405+
"RAYCI_WORK_REPO": "fakeecr",
406+
"RAYCI_BRANCH": "beta",
407+
"RAYCI_ARTIFACTS_DIR": "/c/tmp/artifacts",
408+
409+
"RAYCI_WANDA_FILE": "ci/windows.wanda.yaml",
410+
"RAYCI_WANDA_NAME": "windows-forge",
411+
412+
"BUILDKITE_ARTIFACT_UPLOAD_DESTINATION": artifactDest,
413+
},
414+
"retry": map[string]any{
415+
"automatic": map[string]any{"limit": 1},
416+
},
417+
"timeout_in_minutes": 300,
418+
"agents": newBkAgents("fakewinbuilder"),
419+
},
381420
}, {
382421
in: map[string]any{
383422
"label": "windows job",

raycicmd/wanda.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"log"
66
"path"
77
"sort"
8+
"strings"
89
)
910

1011
const rawGitHubURL = "https://raw.githubusercontent.com/"
@@ -72,6 +73,12 @@ func (s *wandaStep) buildkiteStep() map[string]any {
7273
"timeout_in_minutes": defaultTimeoutInMinutes,
7374
}
7475

76+
if strings.Contains(instanceType, "windows") {
77+
bkStep["artifact_paths"] = windowsArtifactPaths
78+
} else {
79+
bkStep["artifact_paths"] = defaultArtifactPaths
80+
}
81+
7582
if s.dependsOn != nil {
7683
bkStep["depends_on"] = s.dependsOn
7784
}
@@ -192,6 +199,11 @@ func (c *wandaConverter) convert(id string, step map[string]any) (
192199
}
193200
}
194201
}
202+
if strings.Contains(instanceType, "windows") {
203+
envs["RAYCI_ARTIFACTS_DIR"] = windowsArtifactsMountDir
204+
} else {
205+
envs["RAYCI_ARTIFACTS_DIR"] = defaultArtifactsMountDir
206+
}
195207

196208
s := &wandaStep{
197209
name: name,

0 commit comments

Comments
 (0)