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

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

Closed
3 tasks done
ajkavanagh opened this issue Apr 7, 2021 · 1 comment
Closed
3 tasks done
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

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.

@ajkavanagh ajkavanagh self-assigned this Apr 7, 2021
ajkavanagh added a commit to ajkavanagh/charm-tools that referenced this issue Apr 9, 2021
When the --use-lock-file-branches option was used, several bugs were
discovered in more complicated charms.

* Using the master branch as a tracking branch was the wrong idea.
  Instead, if the master branch is set in the lock file for a layer or
  python module, then the commit hash is used instead.  Use
  --ignore-lock-file to be able to just use master branches. Bug juju#605
* Detection of branches from a repository is just not possible in
  practice.  So remove the feature and (for compatibility with the build
  from 2.8.3 lockfiles) use the commit hash instead for the branch.
* For python modules use the revision, as detected by th revision-parser
  module, as the locked revision.
ajkavanagh added a commit to ajkavanagh/charm-tools that referenced this issue Sep 16, 2022
When the --use-lock-file-branches option was used, several bugs were
discovered in more complicated charms.

* Using the master branch as a tracking branch was the wrong idea.
  Instead, if the master branch is set in the lock file for a layer or
  python module, then the commit hash is used instead.  Use
  --ignore-lock-file to be able to just use master branches. Bug juju#605
* Detection of branches from a repository is just not possible in
  practice.  So remove the feature and (for compatibility with the build
  from 2.8.3 lockfiles) use the commit hash instead for the branch.
* For python modules use the revision, as detected by th revision-parser
  module, as the locked revision.
@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