Skip to content

Commit 9e11e52

Browse files
authored
ci: fix vendoring completely (#7328)
The vendoring still had two issues. 1. Updated dev dependencies should also run the vendoring, since these may change how the bundle is minified. This is not taken into account. 2. The artifact generated was added to the repository. That way we actually also added the patch file itself to the repository. That works once, while creating the second patch would not conflict. This is fixed by generating the file outside of the repository and only applying ./vendor as patch. The patch file is now ignored, to further mitigate the risk for this to happen again in case the code is refactored, * chore: fix type error and improve error output while bundling
1 parent e6e966d commit 9e11e52

File tree

5 files changed

+9
-42
lines changed

5 files changed

+9
-42
lines changed

.github/workflows/dependabot-automation.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
run: |
6363
set -euo pipefail
6464
65-
echo "is_vendor_group=${{ steps.metadata.outputs.directory == '/vendor' && steps.metadata.outputs.dependency-type == 'direct:production' }}" >> $GITHUB_OUTPUT
65+
echo "is_vendor_group=${{ steps.metadata.outputs.directory == '/vendor' }}" >> $GITHUB_OUTPUT
6666
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
6767
if: steps.ctx.outputs.is_vendor_group == 'true'
6868
with:
@@ -126,13 +126,13 @@ jobs:
126126
exit 1
127127
fi
128128
129-
git diff --binary --no-color > vendor.patch
129+
git diff --binary --no-color > "${RUNNER_TEMP}/vendor.patch"
130130
echo "has_changes=true" >> $GITHUB_OUTPUT
131131
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
132132
if: steps.diff.outputs.has_changes == 'true'
133133
with:
134134
name: vendor-patch
135-
path: vendor.patch
135+
path: ${{ runner.temp }}/vendor.patch
136136
if-no-files-found: error
137137

138138
vendor-push:
@@ -159,8 +159,9 @@ jobs:
159159
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
160160
with:
161161
name: vendor-patch
162+
path: ${{ runner.temp }}/vendor-artifact
162163
- name: Apply patch
163-
run: git apply --whitespace=nowarn vendor.patch
164+
run: git apply --whitespace=nowarn "${{ runner.temp }}/vendor-artifact/vendor.patch"
164165
- name: Validate changed paths
165166
run: |
166167
set -euo pipefail
@@ -193,7 +194,7 @@ jobs:
193194
git config user.name github-actions
194195
git config user.email [email protected]
195196
196-
git add -A
197+
git add vendor/dist vendor/package.json vendor/yarn.lock
197198
git commit -m "update vendored dependencies with new versions"
198199
echo "commits=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
199200
- name: Push commit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ packages/dd-trace/test/plugins/versions/yarn.lock
130130
!packages/dd-trace/**/telemetry/logs
131131
packages/datadog-plugin-azure-functions/test/integration-test/fixtures/node_modules
132132
!vendor/dist
133+
vendor.patch
133134
__azurite_db_queue__.json
134135
__azurite_db_queue_extent__.json
135136
__queuestorage__/AzuriteConfig

vendor.patch

Lines changed: 0 additions & 36 deletions
This file was deleted.

vendor/rspack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const exclude = new Set([
2727
])
2828

2929
module.exports = {
30+
// @ts-expect-error Array#difference exists in the Node.js version being used here.
3031
entry: Object.fromEntries(include.difference(exclude).entries()),
3132
target: 'node',
3233
mode: 'production',

vendor/rspack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const config = require('./rspack.config')
55

66
rspack(config, (err, stats) => {
77
if (err) {
8-
console.error(err.stack || err)
8+
console.error(err)
99
if (err.details) {
1010
console.error(err.details)
1111
}

0 commit comments

Comments
 (0)