Skip to content

Our charm tests that inject ops from github branch sometime trip on git reference #1843

@dimaqq

Description

@dimaqq
Run if [ -e "requirements.txt" ]; then
  if [ -e "requirements.txt" ]; then
    sed -i -e "/^ops[ ><=]/d" -e "/canonical\/operator/d" -e "/#egg=ops/d" requirements.txt
    echo -e "\ngit+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@$GITHUB_SHA#egg=ops" >> requirements.txt
    sed -i -e "/^ops-scenario[ ><=]/d" -e "/^ops\[testing\][ ><=]/d" requirements.txt
    echo -e "\ngit+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@$GITHUB_SHA#egg=ops-scenario&subdirectory=testing" >> requirements.txt
  elif [ -e "uv.lock" ]; then
    uv remove ops --optional dev --frozen || echo "maybe ops[testing] is not a dev dependency"
    uv remove ops-scenario --optional dev --frozen || echo "maybe ops-scenario is not a dev dependency"
    uv remove ops --frozen
    uv add git+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@$GITHUB_SHA --raw-sources --prerelease=if-necessary-or-explicit
    uv add git+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@$GITHUB_SHA#subdirectory=testing --optional dev --raw-sources --prerelease=if-necessary-or-explicit
  else
    echo "Error: no requirements.txt or uv.lock file found"
    exit 1
  fi
  shell: /usr/bin/bash -e {0}
error: The dependency `ops-scenario` could not be found in `project.optional-dependencies.dev`
maybe ops-scenario is not a dev dependency
Using CPython 3.1[2](https://github.com/canonical/operator/actions/runs/15774568933/job/44465987369?pr=1842#step:4:2).3 interpreter at: /usr/bin/python[3](https://github.com/canonical/operator/actions/runs/15774568933/job/44465987369?pr=1842#step:4:3)
Creating virtual environment at: .venv
   Updating https://github.com/canonical/operator (92969e31e6169ccd1ca2[4](https://github.com/canonical/operator/actions/runs/15774568933/job/44465987369?pr=1842#step:4:4)5187522c9d9722e5535)
error: Git operation failed
  Caused by: failed to find branch, tag, or commit `92969e31e6169ccd1ca24[5](https://github.com/canonical/operator/actions/runs/15774568933/job/44465987369?pr=1842#step:4:5)187522c9d9722e5535`
  Caused by: process didn't exit successfully: `/usr/bin/git rev-parse '929[6](https://github.com/canonical/operator/actions/runs/15774568933/job/44465987369?pr=1842#step:4:6)9e31e6169ccd1ca245187522c9d9722e5535^0'` (exit status: 128)
--- stdout
92969e31e6169ccd1ca245187522c9d9722e5535^0

--- stderr
fatal: ambiguous argument '92969e31e6169ccd1ca24518[7](https://github.com/canonical/operator/actions/runs/15774568933/job/44465987369?pr=1842#step:4:7)522c9d9722e5535^0': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Metadata

Metadata

Labels

26.04An item we hope to do in the 26.04 cyclerainy daySmall items done in ~10% of each week's time

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions