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 --use-lock-file-branches fails to build if there is no branch recorded in the build.lock for a layer/interface #603

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

Comments

@ajkavanagh
Copy link
Contributor

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:

I'm using the PiPy version: "charm-tools 2.8.3"

I am using: Ubuntu 20.04

Issue/Feature

The charm-build command with --write-lock-file built a lock file for interface:ceph-mds with:

    {
      "type": "layer",
      "item": "interface:ceph-mds",
      "url": "https://opendev.org/openstack/charm-interface-ceph-client.git",
      "vcs": null,
      "branch": null,
      "commit": "72245e1d002fb9c65c9574d65b5952275b3411fb"
    },

I expect/expected the following

When rebuilding with --use-lock-file-branches, I'd expect it to ignore the null branch and use the commit hash instead.

What I got

charm-build crashed with:

make_url_from_lock_for_layer: {'type': 'layer', 'item': 'interface:ceph-mds', 'url': 'https://opendev.org/openstack/charm-interface-ceph-client.git', 'vcs': None, 'branch': None, 'commit': '72245e1d002fb9c65c9574d65b5952275b3411fb'} True
Traceback (most recent call last):
  File "/home/alex/Projects/Canonical/git/github.com/juju/charm-tools/venv/bin/charm-build", line 11, in <module>
    load_entry_point('charm-tools', 'console_scripts', 'charm-build')()
  File "/home/alex/Projects/Canonical/git/github.com/juju/charm-tools/charmtools/build/builder.py", line 1195, in main
    build()
  File "/home/alex/Projects/Canonical/git/github.com/juju/charm-tools/charmtools/build/builder.py", line 834, in __call__
    self.generate()
  File "/home/alex/Projects/Canonical/git/github.com/juju/charm-tools/charmtools/build/builder.py", line 771, in generate
    layers = self.fetch()
  File "/home/alex/Projects/Canonical/git/github.com/juju/charm-tools/charmtools/build/builder.py", line 306, in fetch
    return self.fetch_deps(self.top_layer)
  File "/home/alex/Projects/Canonical/git/github.com/juju/charm-tools/charmtools/build/builder.py", line 311, in fetch_deps
    self.fetch_dep(layer, results)
  File "/home/alex/Projects/Canonical/git/github.com/juju/charm-tools/charmtools/build/builder.py", line 343, in fetch_dep
    results["interfaces"].append(iface.fetch())
  File "/home/alex/Projects/Canonical/git/github.com/juju/charm-tools/charmtools/build/builder.py", line 99, in fetch
    url = make_url_from_lock_for_layer(
  File "/home/alex/Projects/Canonical/git/github.com/juju/charm-tools/charmtools/build/builder.py", line 982, in make_url_from_lock_for_layer
    if branch.startswith("refs/heads/"):
AttributeError: 'NoneType' object has no attribute 'startswith'

(Extra debug added at top to work out what was going on).

I'll file a separate bug as to why the option --write-lock-file didn't pick up the branch (which should be refs/heads/master) for the interface.

@ajkavanagh ajkavanagh self-assigned this Apr 7, 2021
openstack-mirroring pushed a commit to openstack/charm-ceph-fs that referenced this issue Apr 7, 2021
* charm-helpers sync for classic charms
* build.lock file for reactive charms
* ensure tox.ini is from release-tools
* ensure requirements.txt files are from release-tools
* On reactive charms:
  - ensure stable/21.04 branch for charms.openstack
  - ensure stable/21.04 branch for charm-helpers

* Manual fix to build.lock to work around bug [1]

[1] juju/charm-tools#603

Change-Id: I6be25d404436647a19e18231ccd0985dd49bb858
openstack-mirroring pushed a commit to openstack/openstack that referenced this issue Apr 7, 2021
* Update charm-ceph-fs from branch 'master'
  to 46797fc9869d86352e513aa4f7a26c0d9ab3c6ec
  - 21.04 libraries freeze for charms on master branch
    
    * charm-helpers sync for classic charms
    * build.lock file for reactive charms
    * ensure tox.ini is from release-tools
    * ensure requirements.txt files are from release-tools
    * On reactive charms:
      - ensure stable/21.04 branch for charms.openstack
      - ensure stable/21.04 branch for charm-helpers
    
    * Manual fix to build.lock to work around bug [1]
    
    [1] juju/charm-tools#603
    
    Change-Id: I6be25d404436647a19e18231ccd0985dd49bb858
@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