Skip to content

Commit

Permalink
Merge pull request juju#18216 from Aflynn50/fix-local-charm-git-issue
Browse files Browse the repository at this point in the history
juju#18216

Git needed to have user details to commit, this sets the user. I hadn't realised this before because it worked with my own local git user settings.

<!-- 
The PR title should match: <type>(optional <scope>): <description>.

Please also ensure all commits in this PR comply with our conventional commits specification:
https://docs.google.com/document/d/1SYUo9G7qZ_jdoVXpUVamS5VCgHmtZ0QA-wZxKoMS-C0 
-->

<!-- Why this change is needed and what it does. -->

## Checklist

<!-- If an item is not applicable, use `~strikethrough~`. -->

- [x] Code style: imports ordered, good names, simple structure, etc
- [x] Comments saying why design decisions were made
- [x] Go unit tests, with comments saying what you're testing
- [x] [Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing
- [ ] [doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages

## QA steps

<!-- Describe steps to verify that the change works. -->
```
./main.sh -v cli
```
  • Loading branch information
jujubot authored Oct 11, 2024
2 parents 66abfe3 + 899e22f commit d60b269
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/suites/cli/local_charms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ run_deploy_local_charm_revision() {
cd "${TMP}/ubuntu-plus" || exit 1

# Initialise a git repo to check the commit SHA is used as the charm version.
git init
git add . && git commit -m "commit everything"
create_local_git_and_commit_all
SHA_OF_UBUNTU_PLUS=\"$(git describe --dirty --always)\"

# Deploy from directory.
Expand Down Expand Up @@ -100,8 +99,7 @@ run_deploy_local_charm_revision_relative_path() {
cd "${TMP}/ubuntu-plus" || exit 1

# Initialise a git repo and commit everything so that commit SHA is used as the charm version.
git init
git add . && git commit -m "commit everything"
create_local_git_and_commit_all
SHA_OF_UBUNTU_PLUS=\"$(git describe --dirty --always)\"

# Create git directory outside the charm directory
Expand Down Expand Up @@ -149,8 +147,7 @@ run_deploy_local_charm_revision_invalid_git() {
cd "${TMP_CHARM_GIT}/ubuntu-plus" || exit 1

# Initialise a git repo and commit everything so that commit SHA is used as the charm version.
git init
git add . && git commit -m "commit everything"
create_local_git_and_commit_all
SHA_OF_UBUNTU_PLUS=\"$(git describe --dirty --always)\"

WANTED_CHARM_SHA=\"$(git describe --dirty --always)\"
Expand Down Expand Up @@ -183,6 +180,15 @@ create_local_git_folder() {
git commit -am "rand_file"
}

create_local_git_and_commit_all() {
git init .
if [ -z "$(git config --global user.email)" ]; then
git config --global user.email "[email protected]"
git config --global user.name "John Doe"
fi
git add . && git commit -m "commit everything"
}

test_local_charms() {
if [ "$(skip 'test_local_charms')" ]; then
echo "==> TEST SKIPPED: deploy local charm tests"
Expand Down

0 comments on commit d60b269

Please sign in to comment.