ci: revert to the old way of uploading canary (#29251)

This broke CI and I was unable to fix it so far.
This commit is contained in:
Bartek Iwańczuk 2025-05-11 13:00:00 +02:00 committed by GitHub
parent c27aaf9f26
commit 9b9a61adbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 70 deletions

View file

@ -177,7 +177,7 @@ const cloneRepoStep = [{
// Use depth > 1, because sometimes we need to rebuild main and if // Use depth > 1, because sometimes we need to rebuild main and if
// other commits have landed it will become impossible to rebuild if // other commits have landed it will become impossible to rebuild if
// the checkout is too shallow. // the checkout is too shallow.
"fetch-depth": 15, "fetch-depth": 5,
submodules: false, submodules: false,
}, },
}]; }];
@ -930,7 +930,11 @@ const ci = {
"github.ref == 'refs/heads/main'", "github.ref == 'refs/heads/main'",
].join("\n"), ].join("\n"),
run: [ 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"), ].join("\n"),
}, },
{ {
@ -1244,7 +1248,8 @@ const ci = {
{ {
name: "Upload canary version file to dl.deno.land", name: "Upload canary version file to dl.deno.land",
run: [ 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"), ].join("\n"),
}, },
], ],

View file

@ -34,7 +34,7 @@ jobs:
- name: Clone repository - name: Clone repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 15 fetch-depth: 5
submodules: false submodules: false
if: github.event.pull_request.draft == true if: github.event.pull_request.draft == true
- id: check - id: check
@ -151,7 +151,7 @@ jobs:
- name: Clone repository - name: Clone repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 15 fetch-depth: 5
submodules: false submodules: false
if: '!(matrix.skip)' if: '!(matrix.skip)'
- name: Clone submodule ./tests/util/std - name: Clone submodule ./tests/util/std
@ -566,7 +566,12 @@ jobs:
matrix.profile == 'release' && matrix.profile == 'release' &&
github.repository == 'denoland/deno' && github.repository == 'denoland/deno' &&
github.ref == 'refs/heads/main') 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 - name: Autobahn testsuite
if: |- if: |-
!(matrix.skip) && ((matrix.os == 'linux' && matrix.arch != 'aarch64') && !(matrix.skip) && ((matrix.os == 'linux' && matrix.arch != 'aarch64') &&
@ -782,7 +787,7 @@ jobs:
- name: Clone repository - name: Clone repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 15 fetch-depth: 5
submodules: false submodules: false
if: '!(matrix.skip)' if: '!(matrix.skip)'
- uses: dsherret/rust-toolchain-file@v1 - uses: dsherret/rust-toolchain-file@v1
@ -815,4 +820,6 @@ jobs:
with: with:
project_id: denoland project_id: denoland
- name: Upload canary version file to dl.deno.land - 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

View file

@ -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 <currentGitSha>",
);
}
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();