diff --git a/.github/scripts/verifyChecksums.js b/.github/scripts/verifyChecksums.js new file mode 100644 index 00000000..6d4b7788 --- /dev/null +++ b/.github/scripts/verifyChecksums.js @@ -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); + } +}); diff --git a/.github/workflows/feed.yml b/.github/workflows/feed.yml new file mode 100644 index 00000000..f9b014ec --- /dev/null +++ b/.github/workflows/feed.yml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 36b8760a..9e9f7f04 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,6 +24,12 @@ git clone git@github.com: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. diff --git a/feed/releases.json b/feed/releases.json index cf46fec6..3b7ee1a6 100644 --- a/feed/releases.json +++ b/feed/releases.json @@ -61,6 +61,136 @@ "MajorVersion": "2023.3", "Build": "233.12259.111", "PrintableReleaseType": null + }, + { + "Date": "2024-03-18", + "Type": "eap", + "Downloads": { + "linux": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDNET-241.15106.48.tar.gz", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDNET-241.15106.48.tar.gz.sha256" + }, + "linuxARM64": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDNET-241.15106.48-aarch64.tar.gz", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDNET-241.15106.48-aarch64.tar.gz.sha256" + }, + "windowsZip": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDNET-241.15106.48.win.zip", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDNET-241.15106.48.win.zip.sha256" + }, + "windowsZipARM64": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDNET-241.15106.48-aarch64.win.zip", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDNET-241.15106.48-aarch64.win.zip.sha256" + } + } + } + ] + }, + { + "Code": "IIU", + "Releases": [ + { + "Date": "2024-03-18", + "Type": "eap", + "Downloads": { + "linux": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVM-241.14881.38.tar.gz", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVM-241.14881.38.tar.gz.sha256" + }, + "linuxARM64": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVM-241.14881.38-aarch64.tar.gz", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVM-241.14881.38-aarch64.tar.gz.sha256" + }, + "windowsZip": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVM-241.14881.38.win.zip", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVM-241.14881.38.win.zip.sha256" + }, + "windowsZipARM64": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVM-241.14881.38-aarch64.win.zip", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVM-241.14881.38-aarch64.win.zip.sha256" + } + } + } + ] + }, + { + "Code": "IIC", + "Releases": [ + { + "Date": "2024-03-18", + "Type": "eap", + "Downloads": { + "linux": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVMC-241.14884.52.tar.gz", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVMC-241.14884.52.tar.gz.sha256" + }, + "linuxARM64": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVMC-241.14884.52-aarch64.tar.gz", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVMC-241.14884.52-aarch64.tar.gz.sha256" + }, + "windowsZip": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVMC-241.14884.52.win.zip", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVMC-241.14884.52.win.zip.sha256" + }, + "windowsZipARM64": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVMC-241.14884.52-aarch64.win.zip", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDJVMC-241.14884.52-aarch64.win.zip.sha256" + } + } + } + ] + }, + { + "Code": "PCP", + "Releases": [ + { + "Date": "2024-03-18", + "Type": "eap", + "Downloads": { + "linux": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPY-241.14872.33.tar.gz", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPY-241.14872.33.tar.gz.sha256" + }, + "linuxARM64": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPY-241.14872.33-aarch64.tar.gz", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPY-241.14872.33-aarch64.tar.gz.sha256" + }, + "windowsZip": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPY-241.14872.33.win.zip", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPY-241.14872.33.win.zip.sha256" + }, + "windowsZipARM64": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPY-241.14872.33-aarch64.win.zip", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPY-241.14872.33-aarch64.win.zip.sha256" + } + } + } + ] + }, + { + "Code": "PCC", + "Releases": [ + { + "Date": "2024-03-18", + "Type": "eap", + "Downloads": { + "linux": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPYC-241.14872.33.tar.gz", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPYC-241.14872.33.tar.gz.sha256" + }, + "linuxARM64": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPYC-241.14872.33-aarch64.tar.gz", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPYC-241.14872.33-aarch64.tar.gz.sha256" + }, + "windowsZip": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPYC-241.14872.33.win.zip", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPYC-241.14872.33.win.zip.sha256" + }, + "windowsZipARM64": { + "Link": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPYC-241.14872.33-aarch64.win.zip", + "ChecksumLink": "https://download.jetbrains.com/qodana/2024.1/qodana-QDPYC-241.14872.33-aarch64.win.zip.sha256" + } + } } ] }