Repository navigation
212 lines (189 loc) · 8.56 KB
/
Copy pathprepare-integration-inputs.yml
File metadata and controls
212 lines (189 loc) · 8.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: Prepare Integration Inputs
on:
workflow_call:
inputs:
artifact-run-id:
description: Workflow run containing the candidate artifacts
required: false
type: string
default: ""
source-sha:
description: Candidate source revision; defaults to the artifact run head SHA
required: false
type: string
default: ""
deb-artifact-name:
description: Debian package artifact to include in the tmachine inputs
required: false
type: string
default: ""
rpm-artifact-name:
description: RPM package artifact to include in the tmachine inputs
required: false
type: string
default: ""
test-inputs-artifact-name:
description: Prebuilt test archives, test workload images, and Helm chart; built here when empty
required: false
type: string
default: ""
external-drivers:
description: Include the external compute drivers (openshell-driver-<runtime> artifacts) built by this run, for the installers that run a driver as a service
required: false
type: boolean
default: false
outputs:
source_sha:
description: Source revision of the candidate artifacts
value: ${{ jobs.prepare.outputs.source_sha }}
integration_inputs_artifact_id:
description: Immutable ID of the prepared integration inputs artifact
value: ${{ jobs.prepare.outputs.integration_inputs_artifact_id }}
permissions:
actions: read
contents: read
packages: read
jobs:
prepare:
name: Prepare tmachine inputs
runs-on: ubuntu-24.04
timeout-minutes: 30
outputs:
source_sha: ${{ steps.artifact-run.outputs.source_sha }}
integration_inputs_artifact_id: ${{ steps.upload-integration-inputs.outputs.artifact-id }}
steps:
- name: Resolve artifact run
id: artifact-run
env:
ARTIFACT_RUN_ID: ${{ inputs['artifact-run-id'] || github.run_id }}
GH_TOKEN: ${{ github.token }}
SOURCE_SHA: ${{ inputs['source-sha'] }}
run: |
if [ -z "${SOURCE_SHA}" ]; then
SOURCE_SHA=$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${ARTIFACT_RUN_ID}" --jq .head_sha)
fi
echo "source_sha=${SOURCE_SHA}" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.artifact-run.outputs.source_sha }}
persist-credentials: false
- uses: ./.github/actions/setup-nix
if: inputs['test-inputs-artifact-name'] == ''
- name: Download CLI artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-x86_64-unknown-linux-musl
path: artifacts/binaries/x86_64-unknown-linux-musl
github-token: ${{ github.token }}
run-id: ${{ inputs['artifact-run-id'] || github.run_id }}
- name: Download gateway artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: openshell-gateway-x86_64-unknown-linux-gnu
path: artifacts/binaries/x86_64-unknown-linux-gnu
github-token: ${{ github.token }}
run-id: ${{ inputs['artifact-run-id'] || github.run_id }}
- name: Download external compute driver artifacts
if: inputs['external-drivers']
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: openshell-driver-*-x86_64-unknown-linux-gnu
merge-multiple: true
path: artifacts/external-drivers/x86_64-unknown-linux-gnu
github-token: ${{ github.token }}
run-id: ${{ inputs['artifact-run-id'] || github.run_id }}
- name: Download Debian package artifact
if: inputs['deb-artifact-name'] != ''
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ inputs['deb-artifact-name'] }}
path: artifacts/packages/download
github-token: ${{ github.token }}
run-id: ${{ inputs['artifact-run-id'] || github.run_id }}
- name: Stage Debian package input
if: inputs['deb-artifact-name'] != ''
run: |
set -euo pipefail
mv artifacts/packages/download/*.deb artifacts/packages/openshell.deb
rmdir artifacts/packages/download
- name: Download RPM package artifact
if: inputs['rpm-artifact-name'] != ''
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ inputs['rpm-artifact-name'] }}
path: artifacts/packages/rpm/download
github-token: ${{ github.token }}
run-id: ${{ inputs['artifact-run-id'] || github.run_id }}
- name: Stage RPM package inputs
if: inputs['rpm-artifact-name'] != ''
run: |
set -euo pipefail
shopt -s nullglob
download_dir=artifacts/packages/rpm/download
cli_rpms=("$download_dir"/openshell-[0-9]*.rpm)
gateway_rpms=("$download_dir"/openshell-gateway-[0-9]*.rpm)
if [[ ${#cli_rpms[@]} -ne 1 || ${#gateway_rpms[@]} -ne 1 ]]; then
echo "candidate artifact must contain exactly one CLI and one gateway RPM" >&2
exit 1
fi
cli_identity=${cli_rpms[0]%.rpm}
gateway_identity=${gateway_rpms[0]%.rpm}
if [[ ${cli_identity##*.} != "${gateway_identity##*.}" ]]; then
echo "candidate CLI and gateway RPM architectures must match" >&2
exit 1
fi
mv "${cli_rpms[0]}" artifacts/packages/rpm/openshell.rpm
mv "${gateway_rpms[0]}" artifacts/packages/rpm/openshell-gateway.rpm
rm -rf "$download_dir"
- uses: ./.github/actions/load-e2e-images
with:
platform-arch: amd64
run-id: ${{ inputs['artifact-run-id'] }}
- name: Export OpenShell images
env:
IMAGE_TAG: ${{ steps.artifact-run.outputs.source_sha }}
run: |
mkdir -p artifacts/images
docker tag "ghcr.io/ai-openshell/openshell/gateway:${IMAGE_TAG}" openshell/gateway:tmachine
docker save --output artifacts/images/openshell-gateway-tmachine.tar openshell/gateway:tmachine
docker tag "ghcr.io/ai-openshell/openshell/sandbox:${IMAGE_TAG}" openshell/sandbox:tmachine
docker save --output artifacts/images/openshell-sandbox-tmachine.tar openshell/sandbox:tmachine
docker tag "ghcr.io/ai-openshell/openshell/supervisor:${IMAGE_TAG}" openshell/supervisor:tmachine
docker save --output artifacts/images/openshell-supervisor-tmachine.tar openshell/supervisor:tmachine
- name: Download test inputs
if: inputs['test-inputs-artifact-name'] != ''
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ inputs['test-inputs-artifact-name'] }}
path: artifacts
github-token: ${{ github.token }}
run-id: ${{ inputs['artifact-run-id'] || github.run_id }}
- name: Build test archives
if: inputs['test-inputs-artifact-name'] == ''
run: |
# Retry dependency preparation, then generate artifacts once.
nix build --no-link .#build-artifacts-test-archives || nix build --no-link .#build-artifacts-test-archives
nix run .#build-artifacts-test-archives
- name: Build test workload images
if: inputs['test-inputs-artifact-name'] == ''
run: |
# Retry dependency preparation, then generate artifacts once.
nix build --no-link .#build-artifacts-test-images || nix build --no-link .#build-artifacts-test-images
nix run .#build-artifacts-test-images
- name: Package Helm chart
if: inputs['test-inputs-artifact-name'] == ''
run: |
# Retry dependency preparation, then generate artifacts once.
nix build --no-link .#build-artifacts-helm || nix build --no-link .#build-artifacts-helm
nix run .#build-artifacts-helm
- name: Upload integration inputs
id: upload-integration-inputs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: openshell-tmachine-inputs
path: artifacts
compression-level: 0
retention-days: 5
if-no-files-found: error