Skip to content

Commit 576564a

Browse files
vlad-uipathclaude
andcommitted
fix(uipath-solution): read the CLI pin as JSON in the CI example
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>
1 parent 9c209cd commit 576564a

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎skills/uipath-solution/references/pack-and-deploy.md‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,8 @@ jobs:
457457
runs-on: ubuntu-latest
458458
steps:
459459
- uses: actions/checkout@v4
460-
- shell: bash # the [[ =~ ]] check needs bash
461-
run: | # install the CLI the repo's freeze pins; fails the job when the file is missing or versions.cli is not an exact version
462-
CLI_PIN=$(node -p "require('./.uipath/config.json').versions.cli")
463-
[[ "$CLI_PIN" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] || { echo "versions.cli in .uipath/config.json is not an exact version" >&2; exit 1; }
460+
- run: | # install the CLI the repo's freeze pins; fails the job when the file is missing or versions.cli is not an exact version
461+
CLI_PIN=$(node -p "let v; try { v = JSON.parse(require('fs').readFileSync('.uipath/config.json', 'utf8').replace(/^\uFEFF/, '')).versions?.cli; } catch {} if (typeof v !== 'string' || !/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(\.(0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?$/.test(v)) { console.error('versions.cli in .uipath/config.json is missing or not an exact version'); process.exit(1); } v") || exit 1
464462
npm install -g "@uipath/cli@$CLI_PIN"
465463
- run: uip --version 2>&1 | grep "frozen at" # fails when the pinned CLI is too old to read the freeze
466464
- run: uip update # puts each pinned tool on its pin; exits 1 when the CLI or a pinned tool stays off its pin
@@ -471,7 +469,7 @@ jobs:
471469
- run: uip solution deploy run -n "MySolution-${{ github.run_number }}" --package-name "MySolution" --package-version "1.0.${{ github.run_number }}" --folder-name "MySolution" --config-file deploy-config.json --output json
472470
```
473471
474-
This job expects the repo to commit a frozen `.uipath/config.json`, so every run uses the same CLI and tools. Make the freeze once on a dev machine, inside the repo: `npm install -g @uipath/cli@<CLI_VERSION>`; if the repo has no `.uipath/config.json` yet, create an empty one (`mkdir -p .uipath && touch .uipath/config.json`) so the freeze goes to the repo and not to your home config; then install only the tools the job needs with `UIPATH_CLI_DISABLE_VERSION_SYNC=1 uip tools install <TOOL>` (here `solution`, plus the tool of each project type in the solution) and run `uip config freeze`; then commit `.uipath/config.json`. `uip config freeze --all` also works, but it pins every tool, and `uip update` then installs all of them on every run. Read the file before you commit it: everything in it goes into the repo. In a frozen repo, do **not** install the newest CLI (`npm install -g @uipath/cli` or `@latest`; `npm`'s `latest` tag for `@uipath/cli` can be a dev build): it is off the CLI pin, and every command except `uip update` and `uip config` is refused until the CLI is back on its pin. Do not run `uip update --force` to get past a refusal: it updates past the freeze and rewrites the pins in `.uipath/config.json`. `uip update` installs no skills on a runner that has none, and this job needs none. One runner holds one freeze at a time: on a self-hosted runner, two jobs with other pins move the same global install. For details, run `uip config freeze --help` and `uip update --help`.
472+
This job expects the repo to commit a frozen `.uipath/config.json`, so every run uses the same CLI and tools. Make the freeze once on a dev machine, inside the repo: `npm install -g @uipath/cli@<CLI_VERSION>`; if the repo has no `.uipath/config.json` yet, create an empty one (`mkdir -p .uipath && touch .uipath/config.json`) so the freeze goes to the repo and not to your home config; then install only the tools the job needs with `UIPATH_CLI_DISABLE_VERSION_SYNC=1 uip tools install <TOOL>` (here `solution`, plus the tool of each project type in the solution) and run `uip config freeze`; then commit `.uipath/config.json`. `uip config freeze --all` also works, but it pins every tool, and `uip update` then installs all of them on every run. Read the file before you commit it: everything in it goes into the repo. In a frozen repo, do **not** install the newest CLI (`npm install -g @uipath/cli` or `@latest`; `npm`'s `latest` tag for `@uipath/cli` can be a dev build): it is off the CLI pin, and every command except `uip update`, `uip config`, `uip tools list`, help and `uip --version` is refused until the CLI is back on its pin. Do not run `uip update --force` to get past a refusal: it updates past the freeze and rewrites the pins in `.uipath/config.json`. `uip update` installs no skills on a runner that has none, and this job needs none. One runner holds one freeze at a time: on a self-hosted runner, two jobs with other pins move the same global install. For details, run `uip config freeze --help` and `uip update --help`.
475473
476474
With no freeze in the repo, replace the three steps after checkout with one step: `npm install -g @uipath/cli@<CLI_VERSION>`, an exact version you chose.
477475

‎tests/scripts/studioweb-browser-commands.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,11 @@
942942
"command": "tools install",
943943
"reason": "The GitHub Actions example and its freeze note describe a CI runner with the npm-installed CLI, not the Studio Web host, so the text is right as is for a Studio Web user who sets up CI."
944944
},
945+
{
946+
"file": "references/pack-and-deploy.md",
947+
"command": "tools list",
948+
"reason": "The GitHub Actions example and its freeze note describe a CI runner with the npm-installed CLI, not the Studio Web host, so the text is right as is for a Studio Web user who sets up CI."
949+
},
945950
{
946951
"file": "references/pack-and-deploy.md",
947952
"command": "update",

0 commit comments

Comments
 (0)