Skip to content

Commit 228886c

Browse files
Merge branch 'master' into errors
2 parents 1cfc75d + cbc5a74 commit 228886c

File tree

8 files changed

+96
-3
lines changed

8 files changed

+96
-3
lines changed

.ci/README.md

+55
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,58 @@ The merge job sets the submodules back to tracking their downstream repositories
9595
`magic-modules` PR #1 is created. `downstream-repo-a` PR #7 and `downstream-repo-b` PR #8 are created from that PR. `magic-modules` PR #2 is created. `downstream-repo-a` PR #9 is created from that PR. PR #7 is merged, then PR #9. Since all of PR #2's downstream PRs are merged, PR #2 is merged, and it includes the changes from PR #1. PR #8 is finally merged, and so PR #1 is ready to be merged.
9696

9797
When merging PR #1, if we update `downstream-repo-a` to the merge commit for PR #7, we will go backwards, erasing PR #2. If we update to `master`, we will definitely include both the changes of both PR #1 and PR #2.
98+
99+
-------
100+
101+
# Troubleshooting The Magician
102+
103+
Sometimes, the Magician won't do what you expect! When that happens, try some of these things.
104+
105+
## My PR didn't get a Magician run!
106+
There are several possible reasons. Does your PR have a merge conflict? Is it written by someone who is a collaborator / contributor / member of the `magic-modules` repo?
107+
108+
### Check the `magic-modules-new-prs` resource.
109+
Find your PR number and commit hash, and click on that version to get a detail view.
110+
#### It didn't work!
111+
If you don't see your PR number and commit hash, verify the following things:
112+
- The PR is mergeable.
113+
- If not, fix the merge conflicts.
114+
- The author of the PR has the `member`, `contributor`, or `collaborator` badge on the PR page.
115+
- If not, **manually verify that the PR is appropriate to run through the magician**, and then run the `authorize-single-rev` task on the PR number and hash.
116+
117+
### Find the number of the `mm-generate` command that was run.
118+
It should be prominent in the detail view.
119+
#### It didn't work!
120+
Press the 'power' button on the PRs above it and click the '+' button in `mm-generate` - it's very rare, but sometimes Concourse falls behind and drops some things it ought to do. It's also plausible that Concourse was briefly paused for maintenance and more PRs stacked up on top of yours, which prevented Concourse from ever reaching it. In any event, it should continue now. If you *ever* have to do this, tell a Magician maintainer - this is one of those things that we could build alarms for.
121+
122+
### Open `mm-generate` and find your run.
123+
It should be green and list a bunch of tasks that were performed to generate your downstream repos.
124+
125+
#### It didn't work!
126+
If the run isn't listed there, probably it's the case that it's still pending (grey) or there's been a global Magician reboot - find a Magician maintainer to solve the mystery. If the run is listed there but it's red, the error message should help you out. If you're having trouble figuring out what's gone wrong (e.g. it's a puppet / chef build and the error message is swallowed by Concourse), try `fly -t prod hijack magic-modules/mm-generate`. You may have to configure Fly first - see up the page for help on that.
127+
128+
### Find the `magic-modules` output hash.
129+
It should be at the bottom of the page, after `point-to-submodules`.
130+
131+
#### It didn't work!
132+
Something has gone strangely and you should find a Magician maintainer. Make them update this page. :)
133+
134+
### Open the `magic-modules` resource from the main page.
135+
Find your version and click on it to get a detail view. Confirm that the unit tests have run and are green.
136+
137+
#### It didn't work!
138+
If the unit tests didn't run, see above for what happens if `mm-generate` didn't run. If they didn't *pass* ... :)
139+
140+
## There was a confusing git error message
141+
Git's error messages can be obtuse! If you see something about how the `git push` failed, because a rev cannot be pushed if it already exists, you probably have accidentally triggered two Magician runs at the same time - two force pushes which try to push to the same rev at the same time will conflict with each other. If you see something about how the `git clone` failed because an object is unadvertised, you probably have done a `push` / `amend` / `push -f` sequence. Both these errors can be ignored if the pipeline is progressing. If the pipeline has stopped progressing, try to run the failing step again with the '+' button.
142+
143+
## The Magician failed while running on my submitted PR
144+
If Concourse notices the Magician's pushes to your PR before it notices that the Magician has merged your PR, it might try to generate again - this is always safe, don't worry. :)
145+
146+
## I submitted some generated PRs, but not all of them, and I need to make a change.
147+
This is the most common issue and the solution isn't complicated. If you delete all the `depends: ...` lines from the Magician's comments, the Magician will think that it is starting over from scratch. It'll push to the `codegen-pr-##` branch, instead of the `codegen-sha-######` branches, and it'll try to open PRs from those branches. If you want a clean experience, you can close your existing PRs (just hit 'Close' at the bottom of the PR, don't merge them) and The Magician will do the right thing.
148+
149+
If you want to leave those PRs open for some reason (preserve comments, because an external partner is watching them, etc), no problem, the magician will still do the right thing, it'll just update the PRs in the `mm-generate` step (*before* the tests) rather than in `create-prs` (*after* the tests) - your PR will still get updated even if the generated code fails tests.
150+
151+
## Other: Consult your local Magician Expert
152+
Remind them to update this page.

.ci/magic-modules/helpers.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function apply_patches {
77
shopt -s nullglob
88
for patch in "$1"/*; do
99
# This is going to apply the patch as at least 1 commit, possibly more.
10-
git am --signoff "$patch"
10+
git am --3way --signoff "$patch"
1111
done
1212
shopt -u nullglob
1313
# Now, collapse the patch commits into one.

.ci/magic-modules/merge-pr.sh

+15-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pushd mm-approved-prs
1515
ID=$(git config --get pullrequest.id)
1616
# We need to know what branch to check out for the update.
1717
BRANCH=$(git config --get pullrequest.branch)
18+
REPO=$(git config --get pullrequest.repo)
1819
popd
1920

2021
cp -r mm-approved-prs/* mm-output
@@ -28,11 +29,24 @@ git config --global user.name "Modular Magician"
2829
ssh-agent bash -c "ssh-add ~/github_private_key; git submodule update --remote --init $ALL_SUBMODULES"
2930

3031
# Word-splitting here is intentional.
31-
git add $ALL_SUBMODULES
32+
git add $ALL_SUBMODULES
3233

3334
# It's okay for the commit to fail if there's no changes.
3435
set +e
3536
git commit -m "Update tracked submodules -> HEAD on $(date)
3637
3738
Tracked submodules are $ALL_SUBMODULES."
3839
echo "Merged PR #$ID." > ./commit_message
40+
41+
# If the repo isn't 'GoogleCloudPlatform/magic-modules', then the PR has been
42+
# opened from someone's fork. We ought to have push rights to that fork, no
43+
# problem, but if we don't, that's also okay.
44+
45+
set +e
46+
if [ "$REPO" != "GoogleCloudPlatform/magic-modules" ]; then
47+
git remote add push-target "[email protected]:$REPO"
48+
# We know we have a commit, so all the machinery of the git resources is
49+
# unnecessary. We can just try to push directly, without forcing.
50+
ssh-agent bash -c "ssh-add ~/github_private_key; git push push-target $BRANCH"
51+
fi
52+
set -e

products/compute/api.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,7 @@ objects:
14321432
- !ruby/object:Api::Resource
14331433
name: 'InstanceTemplate'
14341434
kind: 'compute#instanceTemplate'
1435+
input: true
14351436
base_url: projects/{{project}}/global/instanceTemplates
14361437
exports:
14371438
- !ruby/object:Api::Type::SelfLink

products/redis/api.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ objects:
9494
description: Resource labels to represent user provided metadata.
9595
key_type: Api::Type::String
9696
value_type: Api::Type::String
97+
- !ruby/object:Api::Type::NameValues
98+
name: 'redisConfigs'
99+
description: Redis configuration parameters, according to http://redis.io/topics/config.
100+
key_type: Api::Type::String
101+
value_type: Api::Type::String
97102
- !ruby/object:Api::Type::String
98103
name: locationId
99104
description: |

templates/puppet/property/nested_object.rb.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ module Google
8787
[
8888
"#{prop.out_name}: ['[',",
8989
indent([
90-
"#{prop.out_name}.map(&:to_json).join(', '),",
90+
"(#{prop.out_name} || []).map(&:to_json).join(', '),",
9191
"']'].join(' ')"
9292
], prop.out_name.length + 3), # 3 = ": ["
9393
]

templates/terraform/pre_update/redis_instance.erb

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ if d.HasChange("labels") {
88
if d.HasChange("memory_size_gb") {
99
updateMask = append(updateMask, "memorySizeGb")
1010
}
11+
if d.HasChange("redis_configs") {
12+
updateMask = append(updateMask, "redisConfigs")
13+
}
1114
// updateMask is a URL parameter but not present in the schema, so replaceVars
1215
// won't set it
1316
url, err = addQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")})

templates/terraform/tests/resource_redis_instance_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ resource "google_redis_instance" "test" {
129129
my_key = "my_val"
130130
other_key = "other_val"
131131
}
132+
133+
redis_configs {
134+
maxmemory-policy = "allkeys-lru"
135+
notify-keyspace-events = "KEA"
136+
}
132137
}`, name)
133138
}
134139

@@ -143,6 +148,11 @@ resource "google_redis_instance" "test" {
143148
my_key = "my_val"
144149
other_key = "new_val"
145150
}
151+
152+
redis_configs {
153+
maxmemory-policy = "noeviction"
154+
notify-keyspace-events = ""
155+
}
146156
}`, name)
147157
}
148158

@@ -171,5 +181,10 @@ resource "google_redis_instance" "test" {
171181
my_key = "my_val"
172182
other_key = "other_val"
173183
}
184+
185+
redis_configs {
186+
maxmemory-policy = "allkeys-lru"
187+
notify-keyspace-events = "KEA"
188+
}
174189
}`, network, name)
175190
}

0 commit comments

Comments
 (0)