-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add post-merge VCR copy step (#3583)
* Test PR * Swapped if/else * Add test trigger for manual testing * File ordering * Newline? * Hard code sha * Bad encoding * Remove manual trigger * Newline * Trigger all tests on PR
- Loading branch information
Showing
5 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from gcr.io/google.com/cloudsdktool/cloud-sdk:alpine as resource | ||
|
||
RUN apk add --no-cache bash | ||
RUN apk add --no-cache curl | ||
RUN apk add --no-cache jq | ||
|
||
ADD vcr_merge.sh /vcr_merge.sh | ||
ENTRYPOINT ["/vcr_merge.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
REFERENCE=$1 | ||
|
||
PR_NUMBER=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \ | ||
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/pulls?state=closed&base=master&sort=updated&direction=desc" | \ | ||
jq -r ".[] | if .merge_commit_sha == \"$REFERENCE\" then .number else empty end") | ||
|
||
set +e | ||
gsutil ls gs://vcr-$GOOGLE_PROJECT/auto-pr-$PR_NUMBER/fixtures/ | ||
if [ $? -eq 0 ]; then | ||
# We have recorded new cassettes for this branch | ||
gsutil -m cp gs://vcr-$GOOGLE_PROJECT/refs/heads/auto-pr-$PR_NUMBER/fixtures/* gs://vcr-$GOOGLE_PROJECT/fixtures/ | ||
gsutil -m rm -r gs://vcr-$GOOGLE_PROJECT/refs/heads/auto-pr-$PR_NUMBER/ | ||
fi | ||
set -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,6 +192,12 @@ steps: | |
- -c | ||
- git push https://modular-magician:[email protected]/GoogleCloudPlatform/magic-modules $COMMIT_SHA:inspec-sync | ||
|
||
- name: 'gcr.io/graphite-docker-images/vcr-cassette-merger' | ||
secretEnv: ["GITHUB_TOKEN", "GOOGLE_PROJECT"] | ||
waitFor: ["tpg-push"] | ||
args: | ||
- $COMMIT_SHA | ||
|
||
# set extremely long 1 day timeout, in order to ensure that any jams / backlogs can be cleared. | ||
timeout: 86400s | ||
options: | ||
|
@@ -202,3 +208,6 @@ secrets: | |
- kmsKeyName: projects/graphite-docker-images/locations/global/keyRings/token-keyring/cryptoKeys/github-token | ||
secretEnv: | ||
GITHUB_TOKEN: CiQADkR4NnCVXo1OLSWFuPX7eSiifaOfQVzSYmKi2jZdVbKlfYMSUQBfF82vNAgpvSVyhzM8JsQaP6Oky0SAdoR5fPED5cU3qxsCB9wArmdGcgQoRzP7S6jEWHRcvxv/xauznjkJQMWCORzcbUbk6T7k80bdo2mpqw== | ||
- kmsKeyName: projects/graphite-docker-images/locations/global/keyRings/environment-keyring/cryptoKeys/ci-project-key | ||
secretEnv: | ||
GOOGLE_PROJECT: CiQAis6xrDDU4Wcxn5s8Y790IMxTUEe2d3SaYEXUGScHfaLjOw8SPwDOc1nLe6Yz0zzA0mcYTsXaeGSFYu7uQ5+QCtTProJWRv2ITrNwCS3AF/kvMCrHvltx7O1CZnJveutlVpZH3w== |