Skip to content

Commit 0a8e483

Browse files
committed
Move the remaining native Linux CI jobs off EC2
These are the Linux jobs that write their own steps instead of calling linux_job, so the v3 migration did not reach them. The two Cadence Xtensa workflows were native specifically because the OIDC token had to be minted on the host: the ACTIONS_ID_TOKEN_REQUEST_* variables did not cross into the docker exec, so the job assumed the Cadence role outside the container and passed the credentials in through docker run. OSDC has no host docker daemon, and a job there already runs entirely inside its container, so the workaround is no longer needed and the docker run wrapper collapses into plain steps. The reason these stay native rather than becoming linux_job_v3 is now only that they assume the Cadence artifacts role rather than role/arc. Three jobs did no ExecuTorch work at all and move to GitHub-hosted runners instead of OSDC: the stale-PR bot, which only calls the GitHub API, and the two jobs that repackage an artifact into S3, which now assume role/arc through OIDC rather than relying on the EC2 instance role they used to inherit. apple.yml's test-demo-ios keeps its EC2 label, because mobile_job.yml resolves its actions by relative path and that does not work on OSDC. This builds on the linux_job_v3 migration for _docker-image.yml, which resolves the CI image the Xtensa jobs now name in `container:`. Authored with Claude Code.
1 parent 61eba98 commit 0a8e483

5 files changed

Lines changed: 99 additions & 84 deletions

File tree

.github/workflows/_test_backend.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@ jobs:
8686
package-golden-artifacts:
8787
if: ${{ inputs.run-linux }}
8888
needs: test-backend-linux
89-
runs-on: linux.2xlarge
89+
# Repackaging artifacts needs no ExecuTorch toolchain, so this runs on a
90+
# GitHub-hosted runner rather than moving to OSDC; the S3 upload that used
91+
# to ride on the EC2 instance role assumes role/arc through OIDC instead.
92+
runs-on: ubuntu-latest
93+
permissions:
94+
id-token: write
95+
contents: read
9096
steps:
9197
- name: Download model test artifacts
9298
uses: actions/download-artifact@v4
@@ -127,6 +133,13 @@ jobs:
127133
path: golden_artifacts_*.zip
128134
if-no-files-found: ignore
129135

136+
- name: Configure AWS credentials
137+
if: ${{ hashFiles('golden_artifacts_*.zip') != '' }}
138+
uses: aws-actions/configure-aws-credentials@v4
139+
with:
140+
role-to-assume: arn:aws:iam::308535385114:role/arc
141+
aws-region: us-east-1
142+
130143
- name: Upload golden artifacts to S3
131144
uses: seemethere/upload-artifact-s3@v5
132145
if: ${{ hashFiles('golden_artifacts_*.zip') != '' }}

.github/workflows/_xtensa_build.yml

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Reusable: cross-compile cadence_executor_runner for one Cadence Xtensa core.
22
#
3-
# A native job (not linux_job_v2) because the GitHub OIDC token must be minted on
4-
# the runner host: the ACTIONS_ID_TOKEN_REQUEST_* vars do not cross into
5-
# linux_job_v2's docker exec. So the role is assumed on the host, then the build
6-
# runs inside the CI image via docker run with the creds passed in. Binding the
3+
# A native job rather than linux_job_v3, because the build has to assume the
4+
# Cadence artifacts role rather than the role/arc that linux_job_v3 assumes for
5+
# itself, and only a native job can run configure-aws-credentials. Binding the
76
# environment also gives the OIDC token the environment claim. The licensed
87
# toolchain + core configs are fetched at runtime from an auth-gated store;
98
# role/region/store come from CI variables and are not committed.
@@ -23,68 +22,62 @@ on:
2322
default: ""
2423

2524
jobs:
25+
# The runner pod pulls the container before any step runs, so the image has to
26+
# be a fully qualified reference resolved by a job this one depends on.
27+
docker-image:
28+
name: Resolve CI docker image
29+
uses: ./.github/workflows/_docker-image.yml
30+
2631
build:
2732
name: ${{ inputs.backend }}
28-
runs-on: linux.2xlarge
33+
needs: docker-image
34+
runs-on: mt-l-x86iavx512-8-64
35+
container:
36+
image: 308535385114.dkr.ecr.us-east-1.amazonaws.com/executorch/ci-image:executorch-ubuntu-22.04-clang12-${{ needs.docker-image.outputs.ci-docker-hash }}
2937
environment: cadence
3038
permissions:
3139
id-token: write
3240
contents: read
3341
steps:
42+
- name: Clean workspace
43+
shell: bash
44+
run: |
45+
set -eux
46+
rm -rf "${GITHUB_WORKSPACE}"
47+
mkdir -p "${GITHUB_WORKSPACE}"
48+
3449
- name: Checkout executorch
3550
uses: actions/checkout@v4
3651
with:
3752
submodules: recursive
3853
ref: ${{ inputs.ref }}
3954

40-
- name: Calculate docker image
41-
id: calculate-docker-image
42-
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
43-
with:
44-
docker-image-name: ci-image:executorch-ubuntu-22.04-clang12
45-
46-
- name: Pull docker image
47-
run: docker pull "${{ steps.calculate-docker-image.outputs.docker-image }}"
48-
49-
- name: Assume Cadence artifacts role (host OIDC)
55+
- name: Assume Cadence artifacts role
5056
uses: aws-actions/configure-aws-credentials@v4
5157
with:
5258
role-to-assume: ${{ vars.CADENCE_CI_AWS_ROLE }}
5359
aws-region: ${{ vars.CADENCE_CI_AWS_REGION }}
5460

5561
- name: Cross-compile cadence_executor_runner
5662
env:
57-
DOCKER_IMAGE: ${{ steps.calculate-docker-image.outputs.docker-image }}
5863
BACKEND: ${{ inputs.backend }}
5964
XTENSA_S3_BUCKET: ${{ vars.CADENCE_CI_S3_BUCKET }}
6065
shell: bash
6166
run: |
62-
set -eux
63-
# OIDC/role assumption already happened on the host above; pass the
64-
# resulting AWS creds and the store/backend into the CI image, where
65-
# the toolchain download + cross-compile run.
66-
docker run --rm \
67-
-e BACKEND -e XTENSA_S3_BUCKET \
68-
-e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN \
69-
-e AWS_DEFAULT_REGION -e AWS_REGION \
70-
-v "${GITHUB_WORKSPACE}:/work/executorch" -w /work/executorch \
71-
"${DOCKER_IMAGE}" \
72-
bash -c '
73-
set -exo pipefail
74-
eval "$(/opt/conda/bin/conda shell.bash hook)"
75-
conda activate "$(conda env list --json | jq -r ".envs | .[-1]")"
76-
./install_requirements.sh > /dev/null
77-
pip install --quiet awscli
78-
# hifi4/fusion_g3 optimized kernels need the foss-xtensa nnlib
79-
# sources, which are not vendored in executorch; the cadence
80-
# installer clones them. vision has no nnlib dependency.
81-
if [ "${BACKEND}" != "vision" ]; then
82-
backends/cadence/install_requirements.sh
83-
fi
84-
source .ci/scripts/setup-xtensa-tools.sh "${BACKEND}"
85-
.ci/scripts/build-cadence-xtensa.sh --no-run
86-
chmod -R a+rX cmake-out
87-
'
67+
set -exo pipefail
68+
eval "$(/opt/conda/bin/conda shell.bash hook)"
69+
conda activate "$(conda env list --json | jq -r ".envs | .[-1]")"
70+
./install_requirements.sh > /dev/null
71+
pip install --quiet awscli
72+
# hifi4/fusion_g3 optimized kernels need the foss-xtensa nnlib
73+
# sources, which are not vendored in executorch; the cadence
74+
# installer clones them. vision has no nnlib dependency.
75+
if [ "${BACKEND}" != "vision" ]; then
76+
backends/cadence/install_requirements.sh
77+
fi
78+
source .ci/scripts/setup-xtensa-tools.sh "${BACKEND}"
79+
.ci/scripts/build-cadence-xtensa.sh --no-run
80+
chmod -R a+rX cmake-out
8881
8982
- name: Upload runner
9083
uses: actions/upload-artifact@v4

.github/workflows/_xtensa_test.yml

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Reusable: build + run the Cadence Xtensa op-level gtest tests for one core on
22
# the Instruction Set Simulator (xt-run). Mirrors _xtensa_build.yml's native
3-
# OIDC + docker-run skeleton (running xt-run needs the same licensed toolchain),
3+
# OIDC skeleton (running xt-run needs the same licensed toolchain),
44
# then builds the gtest op-test ELF and runs it on the simulator. The runner
55
# cross-compile and these op tests are separate build configs (the tests need
66
# exceptions/RTTI that the runner build disables), so this is a self-contained
@@ -21,64 +21,58 @@ on:
2121
default: ""
2222

2323
jobs:
24+
# The runner pod pulls the container before any step runs, so the image has to
25+
# be a fully qualified reference resolved by a job this one depends on.
26+
docker-image:
27+
name: Resolve CI docker image
28+
uses: ./.github/workflows/_docker-image.yml
29+
2430
test:
2531
name: ${{ inputs.backend }}
26-
runs-on: linux.2xlarge
32+
needs: docker-image
33+
runs-on: mt-l-x86iavx512-8-64
34+
container:
35+
image: 308535385114.dkr.ecr.us-east-1.amazonaws.com/executorch/ci-image:executorch-ubuntu-22.04-clang12-${{ needs.docker-image.outputs.ci-docker-hash }}
2736
environment: cadence
2837
permissions:
2938
id-token: write
3039
contents: read
3140
steps:
41+
- name: Clean workspace
42+
shell: bash
43+
run: |
44+
set -eux
45+
rm -rf "${GITHUB_WORKSPACE}"
46+
mkdir -p "${GITHUB_WORKSPACE}"
47+
3248
- name: Checkout executorch
3349
uses: actions/checkout@v4
3450
with:
3551
submodules: recursive
3652
ref: ${{ inputs.ref }}
3753

38-
- name: Calculate docker image
39-
id: calculate-docker-image
40-
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
41-
with:
42-
docker-image-name: ci-image:executorch-ubuntu-22.04-clang12
43-
44-
- name: Pull docker image
45-
run: docker pull "${{ steps.calculate-docker-image.outputs.docker-image }}"
46-
47-
- name: Assume Cadence artifacts role (host OIDC)
54+
- name: Assume Cadence artifacts role
4855
uses: aws-actions/configure-aws-credentials@v4
4956
with:
5057
role-to-assume: ${{ vars.CADENCE_CI_AWS_ROLE }}
5158
aws-region: ${{ vars.CADENCE_CI_AWS_REGION }}
5259

5360
- name: Build and run op tests on xt-run
5461
env:
55-
DOCKER_IMAGE: ${{ steps.calculate-docker-image.outputs.docker-image }}
5662
BACKEND: ${{ inputs.backend }}
5763
XTENSA_S3_BUCKET: ${{ vars.CADENCE_CI_S3_BUCKET }}
5864
shell: bash
5965
run: |
60-
set -eux
61-
# OIDC/role assumption already happened on the host above; pass the
62-
# resulting AWS creds and the store/backend into the CI image, where
63-
# the toolchain download + op-test build + xt-run happen.
64-
docker run --rm \
65-
-e BACKEND -e XTENSA_S3_BUCKET \
66-
-e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN \
67-
-e AWS_DEFAULT_REGION -e AWS_REGION \
68-
-v "${GITHUB_WORKSPACE}:/work/executorch" -w /work/executorch \
69-
"${DOCKER_IMAGE}" \
70-
bash -c '
71-
set -exo pipefail
72-
eval "$(/opt/conda/bin/conda shell.bash hook)"
73-
conda activate "$(conda env list --json | jq -r ".envs | .[-1]")"
74-
./install_requirements.sh > /dev/null
75-
pip install --quiet awscli
76-
# hifi4/fusion_g3 optimized kernels need the foss-xtensa nnlib
77-
# sources, which are not vendored in executorch; the cadence
78-
# installer clones them. vision has no nnlib dependency.
79-
if [ "${BACKEND}" != "vision" ]; then
80-
backends/cadence/install_requirements.sh
81-
fi
82-
source .ci/scripts/setup-xtensa-tools.sh "${BACKEND}"
83-
.ci/scripts/test-cadence-xtensa.sh
84-
'
66+
set -exo pipefail
67+
eval "$(/opt/conda/bin/conda shell.bash hook)"
68+
conda activate "$(conda env list --json | jq -r ".envs | .[-1]")"
69+
./install_requirements.sh > /dev/null
70+
pip install --quiet awscli
71+
# hifi4/fusion_g3 optimized kernels need the foss-xtensa nnlib
72+
# sources, which are not vendored in executorch; the cadence
73+
# installer clones them. vision has no nnlib dependency.
74+
if [ "${BACKEND}" != "vision" ]; then
75+
backends/cadence/install_requirements.sh
76+
fi
77+
source .ci/scripts/setup-xtensa-tools.sh "${BACKEND}"
78+
.ci/scripts/test-cadence-xtensa.sh

.github/workflows/apple.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,13 @@ jobs:
122122
# Upload the test demo app to S3
123123
upload-demo-ios:
124124
needs: build-demo-ios
125-
runs-on: linux.2xlarge
125+
# Moving an artifact from GitHub to S3 needs no ExecuTorch toolchain, so
126+
# this runs on a GitHub-hosted runner rather than moving to OSDC; the upload
127+
# that used to ride on the EC2 instance role assumes role/arc through OIDC.
128+
runs-on: ubuntu-latest
129+
permissions:
130+
id-token: write
131+
contents: read
126132
steps:
127133
- name: Download the artifacts from GitHub
128134
uses: actions/download-artifact@v4
@@ -138,6 +144,12 @@ jobs:
138144
set -eux
139145
ls -lah ./
140146
147+
- name: Configure AWS credentials
148+
uses: aws-actions/configure-aws-credentials@v4
149+
with:
150+
role-to-assume: arn:aws:iam::308535385114:role/arc
151+
aws-region: us-east-1
152+
141153
- name: Upload the artifacts to S3
142154
uses: seemethere/upload-artifact-s3@v5
143155
with:
@@ -159,7 +171,9 @@ jobs:
159171
uses: pytorch/test-infra/.github/workflows/mobile_job.yml@main
160172
with:
161173
device-type: ios
162-
# For iOS testing, the runner just needs to call AWS Device Farm, so there is no need to run this on macOS
174+
# For iOS testing, the runner just needs to call AWS Device Farm, so there is no need to run this on macOS.
175+
# Still an EC2 label: mobile_job.yml resolves its actions by relative path
176+
# (./test-infra/.github/actions/...), which does not work on OSDC.
163177
runner: linux.2xlarge
164178
test-infra-ref: main
165179
# This is the ARN of ExecuTorch project on AWS

.github/workflows/stale.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ on:
1414
jobs:
1515
stale:
1616
if: ${{ github.repository == 'pytorch/executorch' }}
17-
runs-on: linux.large
17+
# Pure GitHub API work, so it needs neither an EC2 nor an OSDC runner.
18+
runs-on: ubuntu-latest
1819
permissions:
1920
contents: read
2021
pull-requests: write

0 commit comments

Comments
 (0)