You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
st2 3.7.0, on Python 3.8.10
st2 3.8.1, on Python 3.8.10
OS, environment, install method
This is happening in the st2-docker environment and on Ubuntu Focal 20.04.6 LTS.
Steps to reproduce the problem
You can verify this with st2-docker most easily. Create a new pack as a git repository that has main as the main branch. export ST2_PACKS_DEV to point to the folder where you create the new pack before starting up docker-compose. Then run:
.
id: 66a285e4d8efba08aebc8028
action.ref: packs.get
context.user: st2admin
parameters:
pack: test_pack
status: failed
start_timestamp: Thu, 25 Jul 2024 17:05:40 UTC
end_timestamp: Thu, 25 Jul 2024 17:05:41 UTC
result:
exit_code: 1
result: None
stderr: "Traceback (most recent call last):
File "/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py", line 395, in <module>
obj.run()
File "/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py", line 214, in run
output = action.run(**self._parameters)
File "/opt/stackstorm/packs/packs/actions/pack_mgmt/get_installed.py", line 73, in run
ahead_behind = repo.git.rev_list(
File "/opt/stackstorm/st2/lib/python3.8/site-packages/git/cmd.py", line 739, in <lambda>
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File "/opt/stackstorm/st2/lib/python3.8/site-packages/git/cmd.py", line 1315, in _call_process
return self.execute(call, **exec_kwargs)
File "/opt/stackstorm/st2/lib/python3.8/site-packages/git/cmd.py", line 1110, in execute
raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git rev-list --left-right --count HEAD...origin/master
stderr: 'fatal: ambiguous argument 'HEAD...origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]''
"
stdout: ''
This is caused by this line. There is an assumption that the main branch is master, but this is likely to become less and less common over time.
It should be easy enough to fix, but just updating the action to include a branch_name or main_branch parameter and then turning the argument into a format string that includes the input from the user. Plus, it might be nice to actually catch this error and provide some better feedback about why it failed.
The text was updated successfully, but these errors were encountered:
jpavlav
added a commit
to jpavlav/st2
that referenced
this issue
Jul 25, 2024
Addresses StackStorm#6225. This should allow users to specify a branch when using
the `packs.get` command. This addresses the assumption in the code that
the primary branch of a git repository corresponding to an action is
`master`.
* Add `branch` parameter to `get.yaml`. Default to `master` to maintain
current functionality/expectations.
* Update `run` in `pack_mgmt.get_install.py`. Now accepts `branch` param
and uses an `fstring` to represent the in `git rev list`.
* Fix `packs.get` action
Addresses #6225. This should allow users to specify a branch when using
the `packs.get` command. This addresses the assumption in the code that
the primary branch of a git repository corresponding to an action is
`master`.
* Add `branch` parameter to `get.yaml`. Default to `master` to maintain
current functionality/expectations.
* Update `run` in `pack_mgmt.get_install.py`. Now accepts `branch` param
and uses an `fstring` to represent the in `git rev list`.
* Update Changelog
SUMMARY
When running
packs.get
against a pack that usesmain
as the main branch, the action errors out on:git rev-list --left-right --count HEAD...origin/master
STACKSTORM VERSION
OS, environment, install method
This is happening in the
st2-docker
environment and onUbuntu Focal 20.04.6 LTS
.Steps to reproduce the problem
You can verify this with
st2-docker
most easily. Create a new pack as a git repository that hasmain
as the main branch. exportST2_PACKS_DEV
to point to the folder where you create the new pack before starting updocker-compose
. Then run:Expected Results
I would expect something like this as output:
Actual Results
This is caused by this line. There is an assumption that the main branch is
master
, but this is likely to become less and less common over time.It should be easy enough to fix, but just updating the action to include a
branch_name
ormain_branch
parameter and then turning the argument into a format string that includes the input from the user. Plus, it might be nice to actually catch this error and provide some better feedback about why it failed.The text was updated successfully, but these errors were encountered: