From ab42451bb78bd3a5a1fc1e0f82a2010a63a0a561 Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Wed, 26 Feb 2025 16:25:06 +0100 Subject: [PATCH] fix(flake.nix): assert equal playwright version in nix and package.json Change-Id: I8cc78e842f7d0b1d2a90a4517a186a03636c5559 Signed-off-by: Thomas Kosiewski --- dogfood/contents/Dockerfile | 2 ++ dogfood/contents/main.tf | 2 +- flake.nix | 12 +++++++++++- nix/docker.nix | 9 +++++---- site/package.json | 2 +- site/pnpm-lock.yaml | 27 ++++++++++++++------------- 6 files changed, 34 insertions(+), 20 deletions(-) diff --git a/dogfood/contents/Dockerfile b/dogfood/contents/Dockerfile index 1aac42579b9a3..c4e76b6402b3b 100644 --- a/dogfood/contents/Dockerfile +++ b/dogfood/contents/Dockerfile @@ -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 diff --git a/dogfood/contents/main.tf b/dogfood/contents/main.tf index 998b463f82ab2..1679b59ea39f6 100644 --- a/dogfood/contents/main.tf +++ b/dogfood/contents/main.tf @@ -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 } diff --git a/flake.nix b/flake.nix index e5ce3d4a790af..9cf6ef4b7d781 100644 --- a/flake.nix +++ b/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 diff --git a/nix/docker.nix b/nix/docker.nix index 84c1a34e79bbe..9455c74c81a9f 100644 --- a/nix/docker.nix +++ b/nix/docker.nix @@ -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"; diff --git a/site/package.json b/site/package.json index 892e1d50a005f..abe6a943225f2 100644 --- a/site/package.json +++ b/site/package.json @@ -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", diff --git a/site/pnpm-lock.yaml b/site/pnpm-lock.yaml index 62ae51082e96a..1282148db96b2 100644 --- a/site/pnpm-lock.yaml +++ b/site/pnpm-lock.yaml @@ -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 @@ -3694,6 +3694,7 @@ packages: eslint@8.52.0: resolution: {integrity: sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==, tarball: https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. hasBin: true espree@9.6.1: @@ -5173,13 +5174,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 @@ -7588,9 +7589,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': {} @@ -11898,11 +11899,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