Skip to content

Commit eba810a

Browse files
authored
ci(system-tests): reuse dd-trace-py artifacts instead of building (#689)
1 parent 36d7df2 commit eba810a

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
@@ -8,9 +8,32 @@ on:
88
- "main"
99

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

35+
needs: get-ddtrace-run-id
36+
1437
strategy:
1538
fail-fast: false
1639
matrix:
@@ -21,10 +44,38 @@ jobs:
2144
- name: Checkout
2245
uses: actions/checkout@v4
2346

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

0 commit comments

Comments
 (0)