-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QD-8543 Update product feed with the recent 2024.1 EAP
- Loading branch information
Showing
4 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const fs = require('fs'); | ||
const https = require('https'); | ||
|
||
const jsonFilePath = '../../feed/releases.json'; | ||
|
||
function httpsGet(url) { | ||
return new Promise((resolve, reject) => { | ||
https.get(url, (res) => { | ||
let data = ''; | ||
res.on('data', (chunk) => data += chunk); | ||
res.on('end', () => resolve(data)); | ||
}).on('error', (err) => reject(err)); | ||
}); | ||
} | ||
|
||
async function verifyChecksumLink(link, checksumLink) { | ||
try { | ||
const data = await httpsGet(checksumLink); | ||
const archiveName = link.split('/').pop(); | ||
if (data.includes(archiveName)) { | ||
console.log(`✅ Verified: ${link}`); | ||
} else { | ||
console.error(`❌ Checksum does not contain archive name for ${link}`); | ||
} | ||
} catch (error) { | ||
console.error(`Error fetching ${checksumLink}: ${error.message}`); | ||
} | ||
} | ||
|
||
async function verifyChecksums(data) { | ||
for (const product of data) { | ||
console.log(`::group::Product Code: ${product.Code}`); | ||
for (const release of product.Releases) { | ||
for (const downloadInfo of Object.values(release.Downloads)) { | ||
await verifyChecksumLink(downloadInfo.Link, downloadInfo.ChecksumLink); | ||
} | ||
} | ||
console.log('::endgroup::'); | ||
} | ||
} | ||
|
||
fs.readFile(jsonFilePath, 'utf8', async (err, data) => { | ||
if (err) { | ||
console.error(`Error reading file from disk: ${err}`); | ||
} else { | ||
const releasesData = JSON.parse(data); | ||
await verifyChecksums(releasesData); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: 'Feed' | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'feed/releases.json' | ||
pull_request: | ||
paths: | ||
- 'feed/releases.json' | ||
|
||
jobs: | ||
verify-links: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: .github/scripts | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: node verifyChecksums.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,12 @@ git clone [email protected]:JetBrains/qodana-docker.git | |
docker buildx bake | ||
``` | ||
|
||
`cd` into `.github/scripts` and run the script to check product feed if you edited something in `feed/releases.json`: | ||
|
||
```shell | ||
cd .github/scripts && node verifyChecksums.js | ||
``` | ||
|
||
## Create a commit | ||
|
||
Commit messages should be well formatted, and to make that "standardized", we are using [internal issue tracker](https://youtrack.jetbrains.com) references. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters