Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next/software: include ubuntu 24.04 inventory #8070

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion src/packages/next/lib/landing/landing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SOFTWARE_FALLBACK, SOFTWARE_URLS } from "./software-data";
import { EnvData } from "./types";

test("3 known software environments", () => {
expect(SOFTWARE_ENV_NAMES.length).toBe(3);
expect(SOFTWARE_ENV_NAMES.length).toBe(4);
});

describe("Download URLs", () => {
Expand Down
4 changes: 4 additions & 0 deletions src/packages/next/lib/landing/software-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { EnvData } from "./types";
import SOFTWARE_1804 from "software-inventory/18.04.json";
import SOFTWARE_2004 from "software-inventory/20.04.json";
import SOFTWARE_2204 from "software-inventory/22.04.json";
import SOFTWARE_2404 from "software-inventory/24.04.json";


export const SOFTWARE_URLS: { [key in SoftwareEnvNames]: string } = fromPairs(
SOFTWARE_ENV_NAMES.map((name) => [
Expand All @@ -29,4 +31,6 @@ export const SOFTWARE_FALLBACK: { [key in SoftwareEnvNames]: EnvData } = {
"18.04": SOFTWARE_1804 as EnvData,
"20.04": SOFTWARE_2004 as EnvData,
"22.04": SOFTWARE_2204 as EnvData,
"24.04": SOFTWARE_2404 as EnvData,

} as const;
9 changes: 5 additions & 4 deletions src/packages/next/pages/software/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ export default function Software({ customize }) {
<A href="https://en.wikipedia.org/wiki/Ubuntu">
Ubuntu {SOFTWARE_ENV_DEFAULT}
</A>
, but there are also {SOFTWARE_ENV_NAMES.length - 1} older variants
available. Only the newest variant is actively maintained and regularly
updated. The older ones are deprected and contain older software for
backwards compatibility and historic purposes.
, but there are also {SOFTWARE_ENV_NAMES.length - 1} other variants
available. The default variant is actively maintained and regularly
updated – others are for testing or are deprected. The reason to pick an
older environment is backwards compatibility with older software,
running an older project of yours, or for historic purposes.
</p>
</>
);
Expand Down
27 changes: 24 additions & 3 deletions src/packages/next/software-inventory/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,36 @@ set -e
dist="lib/software-inventory"
mkdir -p $dist

# don't update inventory files if they're symlinks – used for local testing
for name in "18.04" "20.04" "22.04"; do
# download and copy a single file
download_and_copy() {
name=$1
fn="software-inventory-$name.json"
local="software-inventory/$name.json"
targ="$dist/$name.json"

if [[ ! -L "$local" ]]; then
curl --silent --show-error --fail "https://storage.googleapis.com/cocalc-compute-environment/$fn" -o "$local"
if ! curl --silent --show-error --fail "https://storage.googleapis.com/cocalc-compute-environment/$fn" -o "$local"; then
echo "Error: Failed to download $fn" >&2
return 1
fi
fi

cp -v "$local" "$targ"
}

# we now run all downloads in parallel, wait for them, and check if any of them failed...
pids=()

# Start downloads in parallel
for name in "18.04" "20.04" "22.04" "24.04"; do
download_and_copy "$name" &
pids+=($!)
done

# Wait for all background processes to finish
for pid in "${pids[@]}"; do
if ! wait $pid; then
echo "Error: One or more downloads failed" >&2
exit 1
fi
done
2 changes: 1 addition & 1 deletion src/packages/util/consts/software-envs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export type LanguageName = (typeof LANGUAGE_NAMES)[number];

// sort this starting from the newest to the oldest – appears in the UI, e.g. on that /software/index page
// TODO: after https://github.com/sagemathinc/cocalc/pull/6284 has been merged, make 22.04 the first entry in that list
export const SOFTWARE_ENV_NAMES = ["22.04", "20.04", "18.04"] as const;
export const SOFTWARE_ENV_NAMES = ["24.04", "22.04", "20.04", "18.04"] as const;
export type SoftwareEnvNames = (typeof SOFTWARE_ENV_NAMES)[number];
export const SOFTWARE_ENV_DEFAULT: SoftwareEnvNames = "22.04";
Loading