Skip to content

PREQ-4933 Use plain poetry install to respect lock file#241

Merged
tomverin merged 2 commits intomasterfrom
fix/PREQ-4933-poetry-install-lock
Mar 27, 2026
Merged

PREQ-4933 Use plain poetry install to respect lock file#241
tomverin merged 2 commits intomasterfrom
fix/PREQ-4933-poetry-install-lock

Conversation

@tomverin
Copy link
Copy Markdown
Contributor

@tomverin tomverin commented Mar 27, 2026

Summary

  • Replace jf poetry install with plain poetry install in the build-poetry action
  • The JFrog CLI command internally runs poetry update, which ignores the lock file and re-resolves all dependencies — breaking builds when pyproject.toml constraints reference versions absent from the configured Repox indexes (e.g. syrupy 5.*)
  • jf poetry-config is kept to configure the Repox registry; only the install step changes
  • Retrieve ARTIFACTORY_USERNAME from Vault and export POETRY_HTTP_BASIC_REPOX_USERNAME / _PASSWORD so that plain poetry install can authenticate to Repox (credentials were previously handled internally by jf poetry install)

Context

Changes

build-poetry/build.sh

  • jfrog_poetry_install(): replace jf poetry install --build-name --build-number with poetry install
  • Export POETRY_HTTP_BASIC_REPOX_USERNAME and POETRY_HTTP_BASIC_REPOX_PASSWORD before install so Poetry can authenticate to the Repox source configured by jf poetry-config
  • Add ARTIFACTORY_USERNAME to required env vars

build-poetry/action.yml

  • Retrieve ARTIFACTORY_USERNAME from the same Vault path as ARTIFACTORY_ACCESS_TOKEN
  • Pass ARTIFACTORY_USERNAME as env var to the build step

spec/build-poetry_spec.sh

  • Add ARTIFACTORY_USERNAME to test env
  • Update assertions to expect poetry install instead of jf poetry install

Trade-off

Dependency-level build info tracking in JFrog is lost (jf poetry install --build-name --build-number). The artifact upload, build-collect-env, and build-publish in the publish step still capture what matters for promotion and traceability.

Test plan

Replace `jf poetry install` with `poetry install` in build-poetry.
The JFrog CLI command internally runs `poetry update` which ignores
the lock file and re-resolves all dependencies, breaking builds when
pyproject.toml constraints reference versions absent from the CI
indexes (e.g. syrupy 5.*).

`jf poetry-config` is kept to configure the Repox registry;
only the install step changes.
@tomverin tomverin requested a review from a team as a code owner March 27, 2026 13:02
Copilot AI review requested due to automatic review settings March 27, 2026 13:02
@hashicorp-vault-sonar-prod
Copy link
Copy Markdown

hashicorp-vault-sonar-prod bot commented Mar 27, 2026

PREQ-4933

@sonar-review-alpha
Copy link
Copy Markdown

sonar-review-alpha bot commented Mar 27, 2026

Summary

This PR replaces jf poetry install (JFrog CLI) with plain poetry install to respect the lock file and avoid re-resolving all dependencies. The JFrog CLI command was internally calling poetry update, which broke builds when pyproject.toml constraints reference versions unavailable in the configured Repox indexes.

The fix keeps jf poetry-config to configure the Repox registry, but delegates installation to Poetry directly. Since Poetry no longer receives credentials through the JFrog CLI, we now explicitly pass ARTIFACTORY_USERNAME and ARTIFACTORY_ACCESS_TOKEN via POETRY_HTTP_BASIC_REPOX_* environment variables—Poetry's standard mechanism for remote authentication.

Changes:

  • Retrieve ARTIFACTORY_USERNAME from Vault alongside the existing ARTIFACTORY_ACCESS_TOKEN
  • Export credentials as env vars so plain poetry install can authenticate to Repox
  • Drop jf poetry install --build-name/--build-number flags (loses dependency-level build info tracking in JFrog, but artifact uploads and build collection still capture what matters)

What reviewers should know

Focus areas for review:

  1. Credential flow (action.yml, build.sh): Verify that ARTIFACTORY_USERNAME is correctly retrieved from Vault and passed through to the build step. Check that the POETRY_HTTP_BASIC_REPOX_* env vars follow Poetry's naming convention for remote authentication.

  2. Lock file behavior: The core fix is that poetry install respects the lock file while jf poetry install (which wraps poetry update) does not. This should resolve the PREQ-4933 regression, but reviewers familiar with the affected downstream repo (sonarcloud-common-cdk-constructs#350) can confirm the green build.

  3. JFrog config flow: jf poetry-config still runs to configure the Repox remote, then plain poetry install uses it. This is an important detail—the remote is still configured by JFrog, only the install step bypasses the JFrog CLI wrapper.

  4. Test coverage: Tests expect poetry install now instead of the full JFrog command; the test additions confirm the new env var is in place.


  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the build-poetry GitHub Action’s install step to use plain poetry install (while keeping jf poetry-config) so dependency installation respects poetry.lock and avoids unintended re-resolution caused by jf poetry install.

Changes:

  • Replace jf poetry install with poetry install in the install function used by the action.
  • Update shellspec expectations to match the new install command/output.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
build-poetry/build.sh Switch dependency installation to poetry install after JFrog repo configuration to ensure lockfile is honored.
spec/build-poetry_spec.sh Adjust shellspec assertions to expect poetry install and updated test description text.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

sonar-review-alpha[bot]

This comment was marked as resolved.

sonar-review-alpha[bot]

This comment was marked as resolved.

jf poetry-config adds the Repox source to pyproject.toml but does not
configure Poetry's own authentication — that is handled internally by
jf poetry install. Since we now use plain poetry install, we need to
explicitly set POETRY_HTTP_BASIC_REPOX credentials.

- Retrieve ARTIFACTORY_USERNAME from Vault alongside the access token
- Export POETRY_HTTP_BASIC_REPOX_USERNAME and _PASSWORD before install
@tomverin tomverin force-pushed the fix/PREQ-4933-poetry-install-lock branch from 4c8d8d2 to 8b0c3c0 Compare March 27, 2026 13:54
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! ✅

Clean, minimal fix — the three changed files are tightly consistent and the credential plumbing is correct. Ready to merge.

🗣️ Give feedback

@tomverin tomverin merged commit f059bc1 into master Mar 27, 2026
15 checks passed
@tomverin tomverin deleted the fix/PREQ-4933-poetry-install-lock branch March 27, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants