-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Document setting Docker image version dynamically (JS) #37637
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Karl Horky <[email protected]>
- name: resolve-playwright-version | ||
id: resolve-playwright-version | ||
run: | | ||
version="$(yq -r '.devDependencies["@playwright/test"] // ""' package.json)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should read it from the lockfile instead - because ^1.30
could also end up in v1.55.0
- wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I considered that: downside would be complexity - since there are a lot of people not on npm, should be provided for every lockfile format (npm-lock.json
, yarn.lock
, pnpm-lock.yaml
, bun.lock
).
I was also looking into possible CLI commands (eg. npm
, yarn
, pnpm
, bun
commands) or trusted npm packages which would make this simple, but I didn't see something simple and unified in half an hour of research.
That's why I ended up with the extra text in the paragraph:
if you install an exact version of Playwright, then it can be retrieved from
package.json
But exact versions are pretty uncommon in package.json
files, so maybe worth doing something about it.
If it's worth it, I could try writing some commands / a small script in this direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another (more expensive) alternative would be to install Playwright from the package.json
+ lockfile using the detected package manager (minimal command branching here) and either:
- Retrieve the version using
npm list
,yarn list
,pnpm list
, etc - Retrieve the version from
node_modules/@playwright/test/package.json
(downside: this wouldn't work for package managers which don't usenode_modules
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me this doesn't work, because I have a ^
in my package.json
Warning: Docker pull failed with exit code 1, back off 5.126 seconds before retry.
/usr/bin/docker pull mcr.microsoft.com/playwright:v^1.56.0-noble
invalid reference format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's the situation that I described above:
But exact versions are pretty uncommon in
package.json
files, so maybe worth doing something about it.
So probably worth it to either:
- Write some commands / a small script to read the version from all common lockfile formats
- Install
@playwright/test
using package manager + retrieve version using package manager commands likenpm list
@mxschmitt what do you think?
The container image version can be kept up to date with the Playwright version in
package.json
with configuring a previous GitHub Actions job, as documented in the following resources:Alternatives Considered