Skip to content

Commit 2bec2c8

Browse files
committed
ci(system-tests): reuse dd-trace-py artifacts instead of building
1 parent ea7ad6e commit 2bec2c8

File tree

1 file changed

+53
-2
lines changed

1 file changed

+53
-2
lines changed

.github/workflows/build_layer.yml

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,32 @@ on:
77
- "main"
88

99
jobs:
10+
get-ddtrace-run-id:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
run-id: ${{ steps.get-ddtrace-run-id.outputs.run_id }}
14+
steps:
15+
- name: Resolve Run ID of latest dd-trace-py build
16+
id: get-ddtrace-run-id
17+
env:
18+
GH_TOKEN: ${{ github.token }}
19+
run: |
20+
RUN_ID=$(gh run list \
21+
--repo DataDog/dd-trace-py \
22+
--workflow build_deploy.yml \
23+
--branch main \
24+
--status success \
25+
--limit 1 \
26+
--json databaseId \
27+
--jq '.[0].databaseId')
28+
29+
echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT
30+
1031
build:
1132
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
1233

34+
needs: get-ddtrace-run-id
35+
1336
strategy:
1437
fail-fast: false
1538
matrix:
@@ -20,10 +43,38 @@ jobs:
2043
- name: Checkout
2144
uses: actions/checkout@v4
2245

46+
- name: Build artifact name
47+
id: build-artifact-name
48+
run: |
49+
if [ "${{ matrix.arch }}" == "amd64" ]; then
50+
ARCH="x86_64"
51+
else
52+
ARCH="aarch64"
53+
fi
54+
55+
VER="${{ matrix.python_version }}"
56+
PY_VERSION_NO_DOT="${VER//./}"
57+
58+
echo "artifact_name=wheels-cp${PY_VERSION_NO_DOT}-manylinux_${ARCH}" >> $GITHUB_OUTPUT
59+
60+
- name: Download ddtrace Wheel
61+
uses: actions/download-artifact@v4
62+
with:
63+
name: ${{ steps.build-artifact-name.outputs.artifact_name }}
64+
repository: DataDog/dd-trace-py
65+
run-id: ${{ needs.get-ddtrace-run-id.outputs.run-id }}
66+
github-token: ${{ secrets.GITHUB_TOKEN }}
67+
path: ./artifacts
68+
69+
- name: Find ddtrace Wheel
70+
id: find-ddtrace-wheel
71+
run: |
72+
echo "wheel_path=$(find ./artifacts -name "*.whl" | head -n 1)" >> $GITHUB_OUTPUT
73+
2374
- name: Patch pyproject.toml
2475
run: |
25-
echo "Patching pyproject.toml to use main branch of dd-trace-py"
26-
sed -i 's|^ddtrace =.*$|ddtrace = { git = "https://github.com/DataDog/dd-trace-py.git" }|' pyproject.toml
76+
echo "Patching pyproject.toml to use latest build of dd-trace-py"
77+
sed -i 's|^ddtrace =.*$|ddtrace = { file = "${{ steps.find-ddtrace-wheel.outputs.wheel_path }}" }|' pyproject.toml
2778
2879
- name: Build layer for Python ${{ matrix.python_version }} on ${{ matrix.arch }}
2980
run: |

0 commit comments

Comments
 (0)