Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions patches/rock/details.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# `rock` patches

### [rock+0.12.6+001+add-temporary-hex-to-uploaded-artifactNames.patch](rock+0.12.6+001+add-temporary-hex-to-uploaded-artifactNames.patch)

- Reason:
```
This patch adds random hex suffixes to artifact names during ad-hoc distribution uploads to prevent
conflicts and enable unique artifact paths. It generates a 10-character random hex string for each
upload and uses it to create temporary artifact names, ensuring that simultaneous uploads don't
collide and each build gets a unique URL. The changes affect IPA/APK uploads and their associated
index.html and manifest.plist files.
```
- Upstream PR/issue: 🛑
- E/App issue: https://github.com/Expensify/App/issues/81466
- PR Introducing Patch: 🛑
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
diff --git a/node_modules/rock/dist/src/lib/plugins/remoteCache.js b/node_modules/rock/dist/src/lib/plugins/remoteCache.js
index c90e1bd..9618a98 100644
--- a/node_modules/rock/dist/src/lib/plugins/remoteCache.js
+++ b/node_modules/rock/dist/src/lib/plugins/remoteCache.js
@@ -107,20 +107,24 @@ ${output
let uploadedArtifact;
const appFileName = path.basename(binaryPath);
const appName = appFileName.replace(/\.[^/.]+$/, '');
+ const randomHex = Math.floor(Math.random() * 0xffffffffff)
+ .toString(16)
+ .padStart(10, '0');
+ const temporaryUploadArtifactName = `${artifactName}-${randomHex}`;
const uploadContent = {
messagePrefix: 'build',
artifactName: undefined,
};
if (args.adHoc && isArtifactIPA) {
uploadContent.messagePrefix = 'IPA, index.html and manifest.plist';
- uploadContent.artifactName = `ad-hoc/${artifactName}/${appName}.ipa`;
+ uploadContent.artifactName = `ad-hoc/${temporaryUploadArtifactName}/${appName}.ipa`;
}
else if (args.adHoc && isArtifactAPK) {
uploadContent.messagePrefix = 'APK, index.html';
- uploadContent.artifactName = `ad-hoc/${artifactName}/${appName}.apk`;
+ uploadContent.artifactName = `ad-hoc/${temporaryUploadArtifactName}/${appName}.apk`;
}
const { name, url, getResponse } = await remoteBuildCache.upload({
- artifactName,
+ artifactName: temporaryUploadArtifactName,
uploadArtifactName: uploadContent.artifactName,
});
const uploadMessage = `${uploadContent.messagePrefix} to ${color.bold(remoteBuildCache.name)}`;
@@ -134,13 +138,13 @@ ${output
if (args.adHoc && isArtifactIPA) {
const { version, bundleIdentifier } = await getInfoPlistFromIpa(binaryPath);
const { url: urlIndexHtml, getResponse: getResponseIndexHtml } = await remoteBuildCache.upload({
- artifactName,
- uploadArtifactName: `ad-hoc/${artifactName}/index.html`,
+ artifactName: temporaryUploadArtifactName,
+ uploadArtifactName: `ad-hoc/${temporaryUploadArtifactName}/index.html`,
});
getResponseIndexHtml(Buffer.from(templateIndexHtmlIOS({ appName, bundleIdentifier, version })), 'text/html');
const { getResponse: getResponseManifestPlist } = await remoteBuildCache.upload({
- artifactName,
- uploadArtifactName: `ad-hoc/${artifactName}/manifest.plist`,
+ artifactName: temporaryUploadArtifactName,
+ uploadArtifactName: `ad-hoc/${temporaryUploadArtifactName}/manifest.plist`,
});
getResponseManifestPlist((baseUrl) => Buffer.from(templateManifestPlist({
appName,
@@ -157,8 +161,8 @@ ${output
if (args.adHoc && isArtifactAPK) {
const { version, packageName } = await getManifestFromApk(binaryPath);
const { url: urlIndexHtml, getResponse: getResponseIndexHtml } = await remoteBuildCache.upload({
- artifactName,
- uploadArtifactName: `ad-hoc/${artifactName}/index.html`,
+ artifactName: temporaryUploadArtifactName,
+ uploadArtifactName: `ad-hoc/${temporaryUploadArtifactName}/index.html`,
});
getResponseIndexHtml(Buffer.from(templateIndexHtmlAndroid({ appName, packageName, version })), 'text/html');
// For ad-hoc distribution, we want the url to point to the index.html for easier installation