Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

charm-build --write-lock-file doesn't find the branch properly if multiple branches point to the git hash #606

Closed
3 tasks done
ajkavanagh opened this issue Apr 7, 2021 · 1 comment
Assignees

Comments

@ajkavanagh
Copy link
Collaborator

Checklist

  • Confirmed this is an issue with charm-tools, not charmstore-client
  • Provide versions of tools used
  • Described the feature or ways to replicate the issue

What version am I running?

I ran the following command: snap info charm and got the following ouput:

charm-tools 2.8.3 from PyPi

I am using: Ubuntu 20.04

Issue/Feature

The charm-build --write-lock-file command produces a build.lock file to lock the layers and python modules. For git repositories, it attempts to get the branch for the git hash so that the --use-lock-file-branches option can rebuild from the head of a branch, rather than be locked to a commit hash.

I expect/expected the following

If the branch selected is also pointing to another branch (say master) then I expect just the branch to be selected.

What I got

An example of the problem is:

    {
      "type": "python_module",
      "package": "charms.openstack",
      "url": "git+https://opendev.org/openstack/charms.openstack.git",
      "branch": "refs/heads/master\nrefs/heads/stable/21.04",
      "version": "bcd0c9b4b4a19d4a4125e0a6a3f808a843a74fa1",
      "vcs": "git"
    },

i.e. the branch points to master and to stable/21.04. It should probably only point to stable/21.04.

This then breaks rebuilds as the branch isn't a single branch!

Options

  1. Filter out refs/heads/master (and refs/heads/main) from the list.
  2. If more than one branch remains, then exit the build.

However, that doesn't seem terribly useful.

This is currently a "problem" with python modules that spec it as git+https://... with a @branch#egg=... option to specify the branch. We should probably feed this into the detection of the branch to select it specifically. Not entirely sure how to do this.

As an interim fix, do the first option just to keep things going.

@ajkavanagh ajkavanagh self-assigned this Apr 7, 2021
openstack-mirroring pushed a commit to openstack/charm-cinder-lvm that referenced this issue Nov 23, 2021
Due to juju/charm-tools#606 the build.lock
contained the wrong branch info.  This fixes it to stable, and will
allow it to push.

* Also add cffi pin for py35 for charm-tools build support.

Change-Id: I278fa07c38d58cb29bbe81e4ad6fdd0901600f0a
@fnordahl
Copy link
Collaborator

fnordahl commented Oct 3, 2022

Fixed by #607

@fnordahl fnordahl closed this as completed Oct 3, 2022
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

No branches or pull requests

2 participants