From 9b9a61adbb06b49add51a0925973d2fdb29649cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 11 May 2025 13:00:00 +0200 Subject: [PATCH] ci: revert to the old way of uploading canary (#29251) This broke CI and I was unable to fix it so far. --- .github/workflows/ci.generate.ts | 11 ++++-- .github/workflows/ci.yml | 17 ++++++--- tools/release/upload_canary.ts | 62 -------------------------------- 3 files changed, 20 insertions(+), 70 deletions(-) delete mode 100755 tools/release/upload_canary.ts diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts index c3fd790ed0..4cc5333c0c 100755 --- a/.github/workflows/ci.generate.ts +++ b/.github/workflows/ci.generate.ts @@ -177,7 +177,7 @@ const cloneRepoStep = [{ // Use depth > 1, because sometimes we need to rebuild main and if // other commits have landed it will become impossible to rebuild if // the checkout is too shallow. - "fetch-depth": 15, + "fetch-depth": 5, submodules: false, }, }]; @@ -930,7 +930,11 @@ const ci = { "github.ref == 'refs/heads/main'", ].join("\n"), run: [ - "./tools/release/upload_canary.ts arch ${{ github.sha }}", + 'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/', + 'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.sha256sum gs://dl.deno.land/canary/$(git rev-parse HEAD)/', + 'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.symcache gs://dl.deno.land/canary/$(git rev-parse HEAD)/', + "echo ${{ github.sha }} > canary-latest.txt", + 'gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt', ].join("\n"), }, { @@ -1244,7 +1248,8 @@ const ci = { { name: "Upload canary version file to dl.deno.land", run: [ - "./tools/release/upload_canary.ts latest ${{ github.sha }}", + "echo ${{ github.sha }} > canary-latest.txt", + 'gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-latest.txt', ].join("\n"), }, ], diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5691a50bad..887949c06d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: - name: Clone repository uses: actions/checkout@v4 with: - fetch-depth: 15 + fetch-depth: 5 submodules: false if: github.event.pull_request.draft == true - id: check @@ -151,7 +151,7 @@ jobs: - name: Clone repository uses: actions/checkout@v4 with: - fetch-depth: 15 + fetch-depth: 5 submodules: false if: '!(matrix.skip)' - name: Clone submodule ./tests/util/std @@ -566,7 +566,12 @@ jobs: matrix.profile == 'release' && github.repository == 'denoland/deno' && github.ref == 'refs/heads/main') - run: './tools/release/upload_canary.ts arch ${{ github.sha }}' + run: |- + gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/ + gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.sha256sum gs://dl.deno.land/canary/$(git rev-parse HEAD)/ + gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.symcache gs://dl.deno.land/canary/$(git rev-parse HEAD)/ + echo ${{ github.sha }} > canary-latest.txt + gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt - name: Autobahn testsuite if: |- !(matrix.skip) && ((matrix.os == 'linux' && matrix.arch != 'aarch64') && @@ -782,7 +787,7 @@ jobs: - name: Clone repository uses: actions/checkout@v4 with: - fetch-depth: 15 + fetch-depth: 5 submodules: false if: '!(matrix.skip)' - uses: dsherret/rust-toolchain-file@v1 @@ -815,4 +820,6 @@ jobs: with: project_id: denoland - name: Upload canary version file to dl.deno.land - run: './tools/release/upload_canary.ts latest ${{ github.sha }}' + run: |- + echo ${{ github.sha }} > canary-latest.txt + gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-latest.txt diff --git a/tools/release/upload_canary.ts b/tools/release/upload_canary.ts deleted file mode 100755 index ca824fdc05..0000000000 --- a/tools/release/upload_canary.ts +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json -// Copyright 2018-2025 the Deno authors. MIT license. - -// deno-lint-ignore-file no-console - -import { $ } from "jsr:@david/dax@0.41.0"; - -async function uploadCanaryForCurrentArch(currentGitSha: string) { - const currentGitRev = await $`git rev-parse HEAD`.text(); - await $`gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/${currentGitRev}/`; - await $`gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.sha256sum gs://dl.deno.land/canary/${currentGitRev}/`; - await $`gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.symcache gs://dl.deno.land/canary/${currentGitRev}/`; - const llvmTriple = await $`rustc -vV | sed -n "s|host: ||p"`.text(); - const latestCanaryHash = - await $`gsutil cat gs://dl.deno.land/canary-${llvmTriple}-latest.txt` - .text(); - const commitExistsInHistory = await $`git cat-file -e ${latestCanaryHash}`; - - if (commitExistsInHistory.code === 0) { - await Deno.writeTextFile("canary-latest.txt", currentGitSha); - await $`gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-${llvmTriple}-latest.txt`; - } else { - console.log("Skipping upload, newer canary version is already available"); - } -} - -async function uploadCanaryLatest(currentGitSha: string) { - const latestCanaryHash = - await $`gsutil cat gs://dl.deno.land/canary-latest.txt` - .text(); - const commitExistsInHistory = await $`git cat-file -e ${latestCanaryHash}`; - - if (commitExistsInHistory.code === 0) { - await Deno.writeTextFile("canary-latest.txt", currentGitSha); - await $`gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-latest.txt`; - } else { - console.log("Skipping upload, newer canary version is already available"); - } -} - -function printUsage() { - throw new Error( - "Usage: `./upload_canary.ts arch|latest ", - ); -} - -async function main() { - const kind = Deno.args[0]; - const currentGitSha = Deno.args[1]; - if (!kind || !currentGitSha) { - printUsage(); - } - if (kind === "arch") { - await uploadCanaryForCurrentArch(currentGitSha); - } else if (kind === "latest") { - await uploadCanaryLatest(currentGitSha); - } else { - printUsage(); - } -} - -await main();