juju / charm-tools

Tools for charm authors and maintainers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature change: charm-build --use-lock-file-branches shouldn't use master branch

ajkavanagh opened this issue · comments

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

When a charm is rebuilt with --use-lock-file-branches it also uses the refs/heads/master branch rather than using the commit hash. This isn't really what is wanted, I'd hazard a guess (especially as I wrote the feature!)

The idea was that anything that was from a branch would track that branch, but that anything on the master (and I guess 'main') branch would be pinned to the commit hash. But that's not what happened.

I expect/expected the following

The master branch would be ignored, and it would select the commit hash.

What I got

It selects the master branch, rather than the commit hash.

Proposal

So the principle development branch for git is master (or more recently, also main). My proposal is to pick the commit hash if the branch in the build.lock file is refs/heads/master or refs/heads/main. This will then build the charm according to the stable branches and (if they are not available) commit hashes.

Fixed by #607