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

Move VCR buckets #6034

Merged
merged 4 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .ci/containers/gcb-terraform-vcr-tester/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ ENV PATH $PATH:/root/google-cloud-sdk/bin

ADD test_terraform_vcr.sh /test_terraform_vcr.sh

RUN wget https://releases.hashicorp.com/terraform/0.14.8/terraform_0.14.8_linux_amd64.zip
RUN unzip terraform_0.14.8_linux_amd64.zip && rm terraform_0.14.8_linux_amd64.zip
RUN wget https://releases.hashicorp.com/terraform/1.1.8/terraform_1.1.8_linux_amd64.zip
RUN unzip terraform_1.1.8_linux_amd64.zip && rm terraform_1.1.8_linux_amd64.zip
RUN mv ./terraform /bin/terraform

ENTRYPOINT ["/test_terraform_vcr.sh"]
30 changes: 15 additions & 15 deletions .ci/containers/gcb-terraform-vcr-tester/test_terraform_vcr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ update_status "pending"
set +e
# cassette retrieval
mkdir fixtures
gsutil -m -q cp gs://vcr-$GOOGLE_PROJECT/beta/fixtures/* fixtures/
gsutil -m -q cp gs://ci-vcr-cassettes/beta/fixtures/* fixtures/
# copy branch specific cassettes over master. This might fail but that's ok if the folder doesnt exist
gsutil -m -q cp gs://vcr-$GOOGLE_PROJECT/beta/refs/heads/auto-pr-$pr_number/fixtures/* fixtures/
gsutil -m -q cp gs://ci-vcr-cassettes/beta/refs/heads/auto-pr-$pr_number/fixtures/* fixtures/

echo $SA_KEY > sa_key.json
gcloud auth activate-service-account $GOOGLE_SERVICE_ACCOUNT --key-file=$local_path/sa_key.json --project=$GOOGLE_PROJECT
Expand Down Expand Up @@ -90,11 +90,11 @@ test_suffix=""

while [[ -n $TESTS_TERMINATED ]]; do
# store the previous replaying build log
gsutil -h "Content-Type:text/plain" -q cp replaying_test$test_suffix.log gs://vcr-test-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/
gsutil -h "Content-Type:text/plain" -q cp replaying_test$test_suffix.log gs://ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/

if [[ $counter -gt 3 ]]; then
comment="Failed to run VCR tests in REPLAYING mode${NEWLINE}"
comment+="View the [build log](https://storage.cloud.google.com/vcr-test-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/replaying_test$test_suffix.log)${NEWLINE}"
comment+="View the [build log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/replaying_test$test_suffix.log)${NEWLINE}"
comment+="If you believe the error is unrelated to your PR, please rerun the tests"
add_comment "${comment}"
update_status "failure"
Expand All @@ -114,18 +114,18 @@ while [[ -n $TESTS_TERMINATED ]]; do
done

# store replaying build log
gsutil -h "Content-Type:text/plain" -q cp replaying_test$test_suffix.log gs://vcr-test-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/
gsutil -h "Content-Type:text/plain" -q cp replaying_test$test_suffix.log gs://ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/

# store replaying test logs
gsutil -h "Content-Type:text/plain" -m -q cp testlog/replaying/* gs://vcr-test-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/replaying/
gsutil -h "Content-Type:text/plain" -m -q cp testlog/replaying/* gs://ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/replaying/

# handle provider crash
TESTS_PANIC=$(grep "^panic: " replaying_test$test_suffix.log)

if [[ -n $TESTS_PANIC ]]; then
comment="The provider crashed while running the VCR tests in REPLAYING mode${NEWLINE}"
comment+="Please fix it to complete your PR${NEWLINE}"
comment+="View the [build log](https://storage.cloud.google.com/vcr-test-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/replaying_test$test_suffix.log)"
comment+="View the [build log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/replaying_test$test_suffix.log)"
add_comment "${comment}"
update_status "failure"
exit 0
Expand Down Expand Up @@ -173,29 +173,29 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then
test_exit_code=$?

# store cassettes
gsutil -m -q cp fixtures/* gs://vcr-$GOOGLE_PROJECT/beta/refs/heads/auto-pr-$pr_number/fixtures/
gsutil -m -q cp fixtures/* gs://ci-vcr-cassettes/beta/refs/heads/auto-pr-$pr_number/fixtures/

# store recording build log
gsutil -h "Content-Type:text/plain" -q cp recording_test.log gs://vcr-test-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/
gsutil -h "Content-Type:text/plain" -q cp recording_test.log gs://ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/

# store recording test logs
gsutil -h "Content-Type:text/plain" -m -q cp testlog/recording/* gs://vcr-test-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/recording/
gsutil -h "Content-Type:text/plain" -m -q cp testlog/recording/* gs://ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/recording/

# handle provider crash
RECORDING_TESTS_PANIC=$(grep "^panic: " recording_test.log)

if [[ -n $RECORDING_TESTS_PANIC ]]; then
comment="The provider crashed while running the VCR tests in RECORDING mode${NEWLINE}"
comment+="Please fix it to complete your PR${NEWLINE}"
comment+="View the [build log](https://storage.cloud.google.com/vcr-test-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/recording_test.log)"
comment+="View the [build log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/recording_test.log)"
add_comment "${comment}"
update_status "failure"
exit 0
fi


RECORDING_FAILED_TESTS=$(grep "^--- FAIL: TestAcc" recording_test.log | awk -v pr_number=$pr_number -v build_id=$build_id '{print "`"$3"`[[view](https://storage.cloud.google.com/vcr-test-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/recording/"$3".log)]"}')
RECORDING_PASSED_TESTS=$(grep "^--- PASS: TestAcc" recording_test.log | awk -v pr_number=$pr_number -v build_id=$build_id '{print "`"$3"`[[view](https://storage.cloud.google.com/vcr-test-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/recording/"$3".log)]"}')
RECORDING_FAILED_TESTS=$(grep "^--- FAIL: TestAcc" recording_test.log | awk -v pr_number=$pr_number -v build_id=$build_id '{print "`"$3"`[[view](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/recording/"$3".log)]"}')
RECORDING_PASSED_TESTS=$(grep "^--- PASS: TestAcc" recording_test.log | awk -v pr_number=$pr_number -v build_id=$build_id '{print "`"$3"`[[view](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-"pr_number"/artifacts/"build_id"/recording/"$3".log)]"}')

comment=""
if [[ -n $RECORDING_PASSED_TESTS ]]; then
Expand All @@ -214,7 +214,7 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then
fi
fi

comment+="View the [build log](https://storage.cloud.google.com/vcr-test-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/recording_test.log) or the [debug log](https://console.cloud.google.com/storage/browser/vcr-test-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/recording) for each test"
comment+="View the [build log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/recording_test.log) or the [debug log](https://console.cloud.google.com/storage/browser/ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/recording) for each test"
add_comment "${comment}"

else
Expand All @@ -224,7 +224,7 @@ else
else
comment+="All tests passed in REPLAYING mode${NEWLINE}"
fi
comment+="View the [build log](https://storage.cloud.google.com/vcr-test-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/replaying_test$test_suffix.log)"
comment+="View the [build log](https://storage.cloud.google.com/ci-vcr-logs/beta/refs/heads/auto-pr-$pr_number/artifacts/$build_id/build-log/replaying_test$test_suffix.log)"
add_comment "${comment}"
fi

Expand Down
12 changes: 6 additions & 6 deletions .ci/containers/vcr-cassette-merger/vcr_merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ PR_NUMBER=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
jq -r ".[] | if .merge_commit_sha == \"$REFERENCE\" then .number else empty end")

set +e
gsutil ls gs://vcr-$GOOGLE_PROJECT/refs/heads/auto-pr-$PR_NUMBER/fixtures/
gsutil ls gs://ci-vcr-cassettes/refs/heads/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/
gsutil -m cp gs://ci-vcr-cassettes/refs/heads/auto-pr-$PR_NUMBER/fixtures/* gs://ci-vcr-cassettes/fixtures/
gsutil -m rm -r gs://ci-vcr-cassettes/refs/heads/auto-pr-$PR_NUMBER/
fi

# Beta cassettes
gsutil ls gs://vcr-$GOOGLE_PROJECT/beta/refs/heads/auto-pr-$PR_NUMBER/fixtures/
gsutil ls gs://ci-vcr-cassettes/beta/refs/heads/auto-pr-$PR_NUMBER/fixtures/
if [ $? -eq 0 ]; then
# We have recorded new cassettes for this branch
gsutil -m cp gs://vcr-$GOOGLE_PROJECT/beta/refs/heads/auto-pr-$PR_NUMBER/fixtures/* gs://vcr-$GOOGLE_PROJECT/beta/fixtures/
gsutil -m rm -r gs://vcr-$GOOGLE_PROJECT/beta/refs/heads/auto-pr-$PR_NUMBER/
gsutil -m cp gs://ci-vcr-cassettes/beta/refs/heads/auto-pr-$PR_NUMBER/fixtures/* gs://ci-vcr-cassettes/beta/fixtures/
gsutil -m rm -r gs://ci-vcr-cassettes/beta/refs/heads/auto-pr-$PR_NUMBER/
fi


Expand Down
3 changes: 2 additions & 1 deletion .ci/gcb-generate-diffs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ steps:

- name: 'gcr.io/graphite-docker-images/gcb-terraform-vcr-tester'
id: gcb-tpg-vcr-test
secretEnv: ["GITHUB_TOKEN", "GOOGLE_BILLING_ACCOUNT", "GOOGLE_CUST_ID", "GOOGLE_FIRESTORE_PROJECT", "GOOGLE_MASTER_BILLING_ACCOUNT", "GOOGLE_ORG", "GOOGLE_ORG_2", "GOOGLE_ORG_DOMAIN", "GOOGLE_PROJECT", "GOOGLE_PROJECT_NUMBER", "GOOGLE_SERVICE_ACCOUNT", "SA_KEY"]
secretEnv: ["GITHUB_TOKEN", "GOOGLE_BILLING_ACCOUNT", "GOOGLE_CUST_ID", "GOOGLE_FIRESTORE_PROJECT", "GOOGLE_IDENTITY_USER", "GOOGLE_MASTER_BILLING_ACCOUNT", "GOOGLE_ORG", "GOOGLE_ORG_2", "GOOGLE_ORG_DOMAIN", "GOOGLE_PROJECT", "GOOGLE_PROJECT_NUMBER", "GOOGLE_SERVICE_ACCOUNT", "SA_KEY"]
waitFor: ["diff"]
args:
- $_PR_NUMBER
Expand All @@ -261,6 +261,7 @@ secrets:
GOOGLE_BILLING_ACCOUNT: CiQAis6xrGyvnmGipEEjCQVUzu3o1H4XRJSsp/B8A0IFqwRwnogSPQDOc1nLdG/+VCWpKtYtbEl12+luWkHmOYn/VtkDuMkz3bCj2DNbcuLw2fgvmkha1IjnouGPIah0qLkDmTU=
GOOGLE_CUST_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