Skip to content

Commit

Permalink
Merge branch '3.2' into 3.2-into-3.3
Browse files Browse the repository at this point in the history
 Conflicts:
- api/client/charms/client.go
- apiserver/facades/client/application/backend.go
- apiserver/facades/client/application/deployrepository.go
- apiserver/facades/client/application/deployrepository_mocks_test.go
- apiserver/facades/client/application/deployrepository_test.go
- apiserver/facades/client/application/mocks/application_mock.go
- apiserver/facades/client/resources/mocks/backend.go
- apiserver/facades/client/resources/package_test.go
- apiserver/facades/client/resources/repository.go
- apiserver/facades/client/resources/repository_test.go
- cmd/juju/application/bundle/bundle_test.go
- cmd/juju/application/deployer/deployer_test.go
- cmd/juju/application/deployer/lxdprofilestep.go
- cmd/juju/application/deployer/lxdprofilestep_test.go
- cmd/juju/application/export_test.go
- cmd/juju/resource/charmresources_test.go
- cmd/juju/resource/list_test.go
- cmd/juju/resource/upload_test.go
- core/bundle/changes/changes.go
- core/bundle/changes/handlers.go
- core/charm/charmpath.go
- core/charm/package_test.go
- core/charm/repository/charmhub_test.go
  • Loading branch information
jack-w-shaw committed Sep 2, 2023
2 parents a6cc97e + a42c1ab commit 0be57e3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ jobs:
if: success() || failure()
shell: bash
run: |
git checkout go.sum
# The generation sometimes adds things to go.sum. Tidy to remove these.
go mod tidy
git add -A
if [[ -n $(git diff HEAD) ]]; then
echo "*****"
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ steps.branch.outputs.target }}
ref: ${{ steps.branch.outputs.source }}

- name: Set up Go
uses: actions/setup-go@v4
Expand All @@ -46,15 +46,17 @@ jobs:
id: merge
env:
SOURCE_BRANCH: ${{ steps.branch.outputs.source }}
TARGET_BRANCH: ${{ steps.branch.outputs.target }}
run: |
set -x
git fetch origin "$SOURCE_BRANCH"
git branch "$SOURCE_BRANCH" "origin/$SOURCE_BRANCH"
git fetch origin "$TARGET_BRANCH"
git branch "$TARGET_BRANCH" "origin/$TARGET_BRANCH"
# Need to set Git username/email to do the merge (yawn)
git config user.name 'jujubot'
git config user.email 'fake@address.me'
set +e
git switch "$TARGET_BRANCH"
git merge "$SOURCE_BRANCH"
case $? in
0)
Expand Down
2 changes: 2 additions & 0 deletions allowed_signers
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ john@arbash-meinel.com namespaces="git" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHu5
stickupkid@gmail.com namespaces="git" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPqO5HpXaSh6MJ9FVt8nyoxhWN+AqlFxIXE68JGrRysb stickupkid@gmail.com
stickupkid@gmail.com namespaces="git" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDwmnwQng7gaXz47aRDnNTo7i2iTKq7BMnl+UwuXA/Mubrvtrc/XrcixNNm7iS7khVValIc1bIf1m7oTBp72rFWyuZ5FLDgVsjYn8nFfv3g9HlGlGOyN76xX6gOyGfcGCWWKvUPpuX3DjKDm2z8a95lbYZVjXL7ViqVTXnu2G6c7PnbHTTL+n0IO+5hzdXyq7UxAc+T+sfIdCTC7ru8mY+31CP6ovbEMBf37Qowjp9SIUxqj4nMeRjKUFB0XnkFLBuFWqZq1kIcSTSNMWjEK6b6W/dRWfQ6gsQ4Ybe/8HEKoB9IuOy9HcdZT9H97LCSkQHUgma/kB89NO/YV59STksD stickupkid@gmail.com
vitaly.antonenko@canonical.com namespaces="git" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMA/Wg23FBdk2ui9BQPcjzqlN5OjHZgXJ3471LssH4ko anvial-git-signing-key
kelvin.liu@canonical.com namespaces="git" ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFSGIXtXjfQq2CZuc50xrcRY5xcRSAME/pnPTjv5e+LD kelvin-signing-key
kelvin.liu@canonical.com namespaces="git" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCZjSCnVEPOxZICHcHTVjFhKuRcEUIqB2xDSXgimDL9lJdngTHPtkLiLBki8dxAzDOsKYFiQm2XK5vLNjhwa71SwYKHONZZta4Lqg/4/qYRhVn9cd+bcrhMjOcl/m0/APRyKQjhXVMD3k5WiECINLvICCObJfjTKV0J6AZJJbsfwTXfoR6Xo95K2xvb8dxIS9jsp6kd1B0jdr6K6bO16IMrMiLCfLwS4ABEaOmE31iowQF2SvRFNeYkywEewYk+DKS7uB14vgEOmWRwx1XUE/doI+084LcZ03KCWhIr7OjwvLKdTkWMj+HF77vNyj1FphUzRs+qyRgus6feTOpvYlWj kelvin.liu@canonical.com
2 changes: 1 addition & 1 deletion cmd/juju/application/bundle/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func (s *composeAndVerifyRepSuite) TestComposeAndVerifyBundleMixingBaseAndSeries
s.expectParts(&charm.BundleDataPart{Data: bundleData})
s.expectBasePath()

obtained, _, err := ComposeAndVerifyBundle(s.bundleDataSource, []string{s.overlayFile})
obtained, _, err := ComposeAndVerifyBundle(s.bundleDataSource, nil)
c.Assert(err, gc.ErrorMatches, `(?s)the provided bundle has the following errors:.*application "wordpress" series "jammy" and base "ubuntu@20.04" must match if both supplied.*invalid constraints.*`)
c.Assert(obtained, gc.IsNil)
}
Expand Down
37 changes: 21 additions & 16 deletions scripts/try-merge/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"os"
"strings"
"text/template"

"github.com/juju/collections/set"
)
Expand Down Expand Up @@ -109,17 +110,9 @@ func printErrMsg() {
}
}

// If no-one to notify: don't send a message
if peopleToNotify.IsEmpty() {
return
if !peopleToNotify.IsEmpty() {
printMessage(peopleToNotify)
}

// Construct the message
taggedUsers := strings.Join(peopleToNotify.Values(), ", ")
message := fmt.Sprintf(
"%[1]s: your recent changes to `%[2]s` have caused merge conflicts. Please merge `%[2]s` into `%[3]s` and resolve the conflicts.",
taggedUsers, sourceBranch, targetBranch)
stdoutf(message)
}

// findOffendingCommits returns a list of commits that may be causing merge
Expand Down Expand Up @@ -199,19 +192,31 @@ func commitHasOpenPR(commit commitInfo) (prNumber int, ok bool) {
return -1, false
}

func printMessage(peopleToNotify set.Strings) {
messageData := struct{ TaggedUsers, SourceBranch, TargetBranch, LogsLink string }{
TaggedUsers: strings.Join(peopleToNotify.Values(), ", "),
SourceBranch: sourceBranch,
TargetBranch: targetBranch,
LogsLink: fmt.Sprintf("https://github.com/%s/actions/runs/%s",
os.Getenv("GITHUB_REPOSITORY"), os.Getenv("GITHUB_RUN_ID")),
}

tmpl, err := template.New("test").Parse(
"{{.TaggedUsers}}: your recent changes to `{{.SourceBranch}}` have caused merge conflicts. " +
"Please merge `{{.SourceBranch}}` into `{{.TargetBranch}}` and resolve the conflicts." +
"[[logs]({{.LogsLink}})]",
)
check(err)
check(tmpl.Execute(os.Stdout, messageData))
}

func check(err error) {
if err != nil {
stderrf("%#v\n", err)
panic(err)
}
}

// Print to stdout. Only the actual result should go here (the generated
// notification message).
func stdoutf(f string, v ...any) {
_, _ = fmt.Fprintf(os.Stdout, f, v...)
}

// Print to stderr. Logging/debug info should go here, so that it is kept
// separate from the actual output.
func stderrf(f string, v ...any) {
Expand Down

0 comments on commit 0be57e3

Please sign in to comment.