Repository navigation
fix(uipath-solution): install the pinned CLI in the CI example - #4985
vlad-uipath wants to merge 2 commits into
Conversation
|
Claude finished @vlad-uipath's task in 1m 20s —— View job SummaryChanges the Change-by-Change Review1.
|
| Area | Status | Notes |
|---|---|---|
| Frontmatter | OK | Unchanged |
| E2E Tests | OK | No new capability that needs a task; optional smoke task above |
| Skill Body | OK | Unchanged |
| References & Assets | Issue | Freeze note is one paragraph of about 380 words; split into steps and "Do not" bullets |
| Repo Hygiene | OK | Scoped; ratchet entries justified |
Issues for Manual Review
config freezeis missing fromassets/uip-catalog-snapshot.json; onlyupdateis there. The snapshot is probably older than the freeze feature. The PR reports no newcheck-skill-verbs.pyfindings, but someone should confirm thatuip config freeze,uip config freeze --all,UIPATH_CLI_DISABLE_VERSION_SYNCand thefrozen atline inuip --versionoutput are on the CLI's stable/public surface, not dev-build only. If they are dev-only, this text is ahead of the released CLI.- Confirm that
require()of the empty.uipath/config.jsoncreated bytouchnever runs in CI. It throws, which fails the step correctly, but only if the dev forgets to runuip config freezebefore committing. - The PR body says this was not run on GitHub Actions. Running the job once on a throwaway repo would confirm the
bash -edefault shell and that Node is present on the runner image.
Conclusion
Approve with a suggestion. The fix is correct and better hardened than the CLI's own documented recipe: it validates the pin before npm sees it, fails loudly when the file is missing, and checks the freeze before uip update. The only thing worth changing before merge is to break the freeze note into a numbered recipe and a "Do not" list.
1c8e6f6 to
b561086
Compare
In a repo that commits a frozen .uipath/config.json, `npm install -g @uipath/cli` installs the newest CLI, which is off the CLI pin, so `uip login` and every later step are refused. Install versions.cli, run `uip update` and check for the `frozen at` line. Without a freeze, install one exact version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pin step now reads .uipath/config.json with JSON.parse instead of require(), so a symlinked or renamed file never runs as code, and checks the pin in node with the CLI's own pattern. It works the same under bash and sh, so the step no longer needs shell: bash. The snippet matches the one in the CLI's versioning doc. The freeze note also lists help, --version and uip tools list among the commands that still run off the pin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b561086 to
576564a
Compare
Make the
uipath-solutionCI example install the CLI the repo's freeze pins, check it reads the freeze, thenuip update, so the job runs in a frozen repo. Found reviewing theuip config freezefeature: CI is the main use of a frozen.uipath/config.json, but the example rannpm install -g @uipath/cli, which installs the newest CLI (npmlatestis a dev build today,1.208.0-dev.9979). That CLI is offversions.cli, souip loginand every step after it are refused.Key decisions:
versions.cli,uip --version 2>&1 | grep "frozen at", thenuip update(exit 1 when the CLI or a pinned tool stays off its pin). Thefrozen atcheck comes beforeuip updatebecause a CLI too old to read the freeze ignores it, and itsuip updatecan move to a newer build that printsfrozen at, which would hide the problem.CLI_PIN=$(node -p "...versions.cli"), and not inline. The inline formnpm i -g @uipath/cli@$(node -p ...)breaks when the file is missing:nodefails, the line becomesnpm i -g @uipath/cli@, and npm installslatestwith exit 0 (checked withbash -e, as Actions runs a step).ubuntu-latest(Ubuntu 24.04 image) ships Node 22 and npm 10, so no setup-node step is needed.JSON.parse(readFileSync(...)), notrequire(), and checked in node before it reaches npm.require()runs a.js/.cjsfile as code (a committed symlinkconfig.json->x.cjsdoes), and it would also read a value of any type. The check is the CLI's own pin pattern (SemVer, exact version), and a leading BOM is allowed, as the CLI allows it. Without the check, a bad value installs the wrong CLI with no error:undefinedgets a 404 only by luck, a tag such aslatestinstalls the newest CLI, and npm also takesnpm:<pkg>@<v>aliases and git, tarball and file specs, which install another package. The check does not echo the value. A missing file, bad JSON, a non-string pin and a bad pin all print one line and exit 1, and|| exit 1stops the job with or without-e.shell: bash: the check runs in node, so the step works the same under bash, sh and dash. The snippet is byte-for-byte the one in UiPath/cli#6245 (docs/reference/versioning.md, "Freezing a CI pipeline"), except that it spellsnpm install -glike the rest of this example.npm install -g @uipath/cli/@latest, anduip update --force, which updates past the freeze and rewrites the pins. Off the pin, every command exceptuip update,uip config,uip tools list, help anduip --versionis refused (freezeScopeOfinversionsConfig.ts). It gives the narrow freeze recipe (UIPATH_CLI_DISABLE_VERSION_SYNC=1 uip tools install <TOOL>, thenuip config freeze) and says that--allmakesuip updateinstall every tool on each run. It also says thatuip updateinstalls no skills on a fresh runner, and that one runner holds one freeze at a time. It points touip config freeze --help/uip update --helpand links nothing.npm install -g @uipath/cli@<CLI_VERSION>.skills:testratchet gets fiveallowentries with that reason (config,config freeze,tools install,tools list,updateinreferences/pack-and-deploy.md), not a flavor block.uipath-coded-apps(fix(uipath-coded-apps): stop at a freeze instead of forcing an install #4983),uipath-insights(fix(uipath-insights): run uip update for an unknown investigate command #4978, draft),uipath-rules(fix(uipath-rules): install the pinned CLI or run uip update for an unknown rules command #4977). The CLI's own versioning doc ("Freezing a CI pipeline") had the inlinenpm i -g @uipath/cli@$(node -p ...)form; UiPath/cli#6245 replaces it with the same snippet as here. Not covered: theuipath-coded-appsCI/CD recipe (pack-publish-deploy.md~:368) has no install step at all.No GitHub run, no real login. Each step was run locally, as the job runs it.
Setup:
P=~/Work/freeze-proof/S7, with an isolated HOME and npm prefix under$P.uipis a shell function that calls$P/prefix/bin/uip, never a global CLI.$P/repois the checked-out repo: a solutionMySolutionwith one API workflow project, and the committed.uipath/config.json: CLI pin1.208.0-dev.9872,core.updateChannel: dev,solution-toolandapi-workflow-toolat1.208.0-dev.9872. Each run starts like a fresh runner: no CLI, no tools, empty HOME. The new first step is in$P/scripts/install-step.sh, copied from the YAML, and runs withbash -e. Both sections run the same check after their steps.uip loginuses a fake app (x/y), so after the fix it reaches the identity server, which rejects it, with no tenant call.packis a real offline pack with--profile s7-proof, a profile with no login.Reproduce issue
Old step:
npm install -g @uipath/cli. It installs1.208.0-dev.9979, anduip loginandpackare refused.Fix validation
New steps: pinned install,
frozen atcheck,uip update. The CLI is on its pin,uip updateinstalls both tools on theirs,uip logingets past the freeze (and fails only on the fake app), andpackbuilds the package. Pack warnings trimmed: they are the same no-login lines on both runs.The end-to-end run above used the earlier version of the first step (
require()plus a bash[[ =~ ]]check). For a valid pin the current step installs the same spec. The current step, taken out of the YAML with a YAML parser and run with a stubnpmthat prints its arguments, on six committed configs.symlinkis.uipath/config.json->evil.cjs, a file that writesMARKERwhen it runs (checked:node -e 'require("./evil.cjs")'writes it).arrayis{"versions":{"cli":["1.207.1"]}}andaliasis"npm:evil@1.0.0"./bin/dashgives the same six results. On macOSshis bash in POSIX mode, so dash is the real non-bash shell here.Repo checks:
node --test tests/scripts/studioweb-browser-commands.test.mjs20/20,npm run skills:validateOK,check-skill-links.mjsOK, the pre-commit description check OK.check-sensitive-content.py --strictreports two findings, both in asset snapshot files this PR does not touch.npm run skills:test: the studioweb ratchet test passes. 2 of 483 tests fail:pack builds complete, marker-free default and custom npm packagesandroot npm pack emits one marker-free default package and restores canonical sources. The same 2 fail on a cleanorigin/maincheckout on this machine (annpm publish --dry-runexit and a tarball hash), so they are local, not caused by this change.npm run skills:validateandnpm run skills:build: OK. The CI section inbuild/skills/defaultandbuild/skills/studiowebis identical to the source.python3 scripts/check-skill-verbs.py: the same 6 stale findings asmain, none in this change.node scripts/check-skill-links.mjs: OK.Known limits:
ubuntu-latestis from the runner image's README.restore,publishanddeploy runneed a real login and were not run.touch,UIPATH_CLI_DISABLE_VERSION_SYNC=1 uip tools install solution/api-workflow,uip config freeze, and--all) were run once in the isolated env. They wrote the pins to the repo's file. Not shown above.🤖 Generated with Claude Code