Skip to content

Separate freezing components from publishing them #388

@andyk

Description

@andyk

Currently agentos freeze and Component.to_versioned_component() with fail if the Component's repo is a GithubRepo and the local HEAD is different than the github remote HEAD. It prints an error (as shown below).

We should wait to check if the local git HEAD exists in the github remote until we try to publish, instead of checking when we do the freeze.

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/agentos_dev2/bin/agentos", line 33, in <module>
    sys.exit(load_entry_point('agentos', 'console_scripts', 'agentos')())
  File "/opt/homebrew/Caskroom/miniforge/base/envs/agentos_dev2/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/agentos_dev2/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/agentos_dev2/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/homebrew/Caskroom/miniforge/base/envs/agentos_dev2/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/agentos_dev2/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/Users/andyk/Development/agentos/agentos/cli.py", line 258, in freeze
    frozen_reg = component.to_frozen_registry(force=force)
  File "/Users/andyk/Development/agentos/pcs/component.py", line 615, in to_frozen_registry
    versioned = self.to_versioned_component(force)
  File "/Users/andyk/Development/agentos/pcs/component.py", line 495, in to_versioned_component
    repo_url, version = self.repo.get_version_from_git(
  File "/Users/andyk/Development/agentos/pcs/repo.py", line 150, in get_version_from_git
    return self.GIT.get_public_url_and_hash(full_path, force)
  File "/Users/andyk/Development/agentos/pcs/git_manager.py", line 59, in get_public_url_and_hash
    curr_head_hash = self._check_remote_branch_status(
  File "/Users/andyk/Development/agentos/pcs/git_manager.py", line 194, in _check_remote_branch_status
    raise BadGitStateException(error_msg)
pcs.exceptions.BadGitStateException: Current head hash 845a553739b7805c2a7df2f7145fd30a076b7b3a in PCS repo <Repo at '/Users/andyk/Development/agentos'> is not on remote git@github.com:andyk/agentos.git. Push your changes to your remote!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions