mirror of
https://github.com/coder/coder.git
synced 2025-03-14 10:09:57 +00:00
fix(flake.nix): synchronize playwright version in nix and package.json (#16715)
Ensure that the version of Playwright installed with the Nix flake is equal to the one specified in `site/package.json.` -- This assertion ensures that `pnpm playwright:install` will not attempt to download newer browser versions not present in the Nix image, fixing the startup script and reducing the startup time, as `pnpm playwright:install` will not download or install anything. We also pre-install the required Playwright web browsers in the dogfood Dockerfile. This change prevents us from redownloading system dependencies and Google Chrome each time a workspace starts. Change-Id: I8cc78e842f7d0b1d2a90a4517a186a03636c5559 Signed-off-by: Thomas Kosiewski <tk@coder.com> Signed-off-by: Thomas Kosiewski <tk@coder.com>
This commit is contained in:
@ -244,6 +244,8 @@ ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
|
||||
RUN npm install -g npm@^10.8
|
||||
RUN npm install -g pnpm@^9.6
|
||||
|
||||
RUN pnpx playwright@1.47.0 install --with-deps chromium
|
||||
|
||||
# Ensure PostgreSQL binaries are in the users $PATH.
|
||||
RUN update-alternatives --install /usr/local/bin/initdb initdb /usr/lib/postgresql/16/bin/initdb 100 && \
|
||||
update-alternatives --install /usr/local/bin/postgres postgres /usr/lib/postgresql/16/bin/postgres 100
|
||||
|
@ -351,7 +351,7 @@ resource "coder_agent" "dev" {
|
||||
sleep 1
|
||||
done
|
||||
cd "${local.repo_dir}" && make clean
|
||||
cd "${local.repo_dir}/site" && pnpm install && pnpm playwright:install
|
||||
cd "${local.repo_dir}/site" && pnpm install
|
||||
EOT
|
||||
}
|
||||
|
||||
|
12
flake.nix
12
flake.nix
@ -121,6 +121,7 @@
|
||||
(pinnedPkgs.golangci-lint)
|
||||
gopls
|
||||
gotestsum
|
||||
hadolint
|
||||
jq
|
||||
kubectl
|
||||
kubectx
|
||||
@ -216,6 +217,14 @@
|
||||
'';
|
||||
};
|
||||
in
|
||||
# "Keep in mind that you need to use the same version of playwright in your node playwright project as in your nixpkgs, or else playwright will try to use browsers versions that aren't installed!"
|
||||
# - https://nixos.wiki/wiki/Playwright
|
||||
assert pkgs.lib.assertMsg
|
||||
(
|
||||
(pkgs.lib.importJSON ./site/package.json).devDependencies."@playwright/test"
|
||||
== pkgs.playwright-driver.version
|
||||
)
|
||||
"There is a mismatch between the playwright versions in the ./nix.flake and the ./site/package.json file. Please make sure that they use the exact same version.";
|
||||
rec {
|
||||
inherit formatter;
|
||||
|
||||
@ -261,12 +270,13 @@
|
||||
|
||||
uname = "coder";
|
||||
homeDirectory = "/home/${uname}";
|
||||
releaseName = version;
|
||||
|
||||
drv = devShells.default.overrideAttrs (oldAttrs: {
|
||||
buildInputs =
|
||||
(with pkgs; [
|
||||
coreutils
|
||||
nix
|
||||
nix.out
|
||||
curl.bin # Ensure the actual curl binary is included in the PATH
|
||||
glibc.bin # Ensure the glibc binaries are included in the PATH
|
||||
jq.bin
|
||||
|
@ -50,10 +50,6 @@ let
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
|
||||
etcReleaseName = writeTextDir "etc/coderniximage-release" ''
|
||||
0.0.0
|
||||
'';
|
||||
|
||||
etcPamdSudoFile = writeText "pam-sudo" ''
|
||||
# Allow root to bypass authentication (optional)
|
||||
auth sufficient pam_rootok.so
|
||||
@ -115,6 +111,7 @@ let
|
||||
run ? null,
|
||||
maxLayers ? 100,
|
||||
uname ? "nixbld",
|
||||
releaseName ? "0.0.0",
|
||||
}:
|
||||
assert lib.assertMsg (!(drv.drvAttrs.__structuredAttrs or false))
|
||||
"streamNixShellImage: Does not work with the derivation ${drv.name} because it uses __structuredAttrs";
|
||||
@ -207,6 +204,10 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
etcReleaseName = writeTextDir "etc/coderniximage-release" ''
|
||||
${releaseName}
|
||||
'';
|
||||
|
||||
# https://github.com/NixOS/nix/blob/2.8.0/src/libstore/globals.hh#L464-L465
|
||||
sandboxBuildDir = "/build";
|
||||
|
||||
|
@ -126,7 +126,7 @@
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@chromatic-com/storybook": "3.2.2",
|
||||
"@octokit/types": "12.3.0",
|
||||
"@playwright/test": "1.47.2",
|
||||
"@playwright/test": "1.47.0",
|
||||
"@storybook/addon-actions": "8.5.2",
|
||||
"@storybook/addon-essentials": "8.4.6",
|
||||
"@storybook/addon-interactions": "8.5.3",
|
||||
|
26
site/pnpm-lock.yaml
generated
26
site/pnpm-lock.yaml
generated
@ -284,8 +284,8 @@ importers:
|
||||
specifier: 12.3.0
|
||||
version: 12.3.0
|
||||
'@playwright/test':
|
||||
specifier: 1.47.2
|
||||
version: 1.47.2
|
||||
specifier: 1.47.0
|
||||
version: 1.47.0
|
||||
'@storybook/addon-actions':
|
||||
specifier: 8.5.2
|
||||
version: 8.5.2(storybook@8.5.3(prettier@3.4.1))
|
||||
@ -1528,8 +1528,8 @@ packages:
|
||||
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==, tarball: https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
'@playwright/test@1.47.2':
|
||||
resolution: {integrity: sha512-jTXRsoSPONAs8Za9QEQdyjFn+0ZQFjCiIztAIF6bi1HqhBzG9Ma7g1WotyiGqFSBRZjIEqMdT8RUlbk1QVhzCQ==, tarball: https://registry.npmjs.org/@playwright/test/-/test-1.47.2.tgz}
|
||||
'@playwright/test@1.47.0':
|
||||
resolution: {integrity: sha512-SgAdlSwYVpToI4e/IH19IHHWvoijAYH5hu2MWSXptRypLSnzj51PcGD+rsOXFayde4P9ZLi+loXVwArg6IUkCA==, tarball: https://registry.npmjs.org/@playwright/test/-/test-1.47.0.tgz}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
@ -5167,13 +5167,13 @@ packages:
|
||||
resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==, tarball: https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
playwright-core@1.47.2:
|
||||
resolution: {integrity: sha512-3JvMfF+9LJfe16l7AbSmU555PaTl2tPyQsVInqm3id16pdDfvZ8TTZ/pyzmkbDrZTQefyzU7AIHlZqQnxpqHVQ==, tarball: https://registry.npmjs.org/playwright-core/-/playwright-core-1.47.2.tgz}
|
||||
playwright-core@1.47.0:
|
||||
resolution: {integrity: sha512-1DyHT8OqkcfCkYUD9zzUTfg7EfTd+6a8MkD/NWOvjo0u/SCNd5YmY/lJwFvUZOxJbWNds+ei7ic2+R/cRz/PDg==, tarball: https://registry.npmjs.org/playwright-core/-/playwright-core-1.47.0.tgz}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
playwright@1.47.2:
|
||||
resolution: {integrity: sha512-nx1cLMmQWqmA3UsnjaaokyoUpdVaaDhJhMoxX2qj3McpjnsqFHs516QAKYhqHAgOP+oCFTEOCOAaD1RgD/RQfA==, tarball: https://registry.npmjs.org/playwright/-/playwright-1.47.2.tgz}
|
||||
playwright@1.47.0:
|
||||
resolution: {integrity: sha512-jOWiRq2pdNAX/mwLiwFYnPHpEZ4rM+fRSQpRHwEwZlP2PUANvL3+aJOF/bvISMhFD30rqMxUB4RJx9aQbfh4Ww==, tarball: https://registry.npmjs.org/playwright/-/playwright-1.47.0.tgz}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
|
||||
@ -7582,9 +7582,9 @@ snapshots:
|
||||
'@pkgjs/parseargs@0.11.0':
|
||||
optional: true
|
||||
|
||||
'@playwright/test@1.47.2':
|
||||
'@playwright/test@1.47.0':
|
||||
dependencies:
|
||||
playwright: 1.47.2
|
||||
playwright: 1.47.0
|
||||
|
||||
'@popperjs/core@2.11.8': {}
|
||||
|
||||
@ -11887,11 +11887,11 @@ snapshots:
|
||||
dependencies:
|
||||
find-up: 4.1.0
|
||||
|
||||
playwright-core@1.47.2: {}
|
||||
playwright-core@1.47.0: {}
|
||||
|
||||
playwright@1.47.2:
|
||||
playwright@1.47.0:
|
||||
dependencies:
|
||||
playwright-core: 1.47.2
|
||||
playwright-core: 1.47.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.2
|
||||
|
||||
|
Reference in New Issue
Block a user