Skip to content

Commit

Permalink
Merge branch 'GoogleCloudPlatform:main' into hns_folders
Browse files Browse the repository at this point in the history
  • Loading branch information
gurusai-voleti authored Dec 11, 2024
2 parents 9221d77 + 1faadb6 commit 2fa4f7a
Show file tree
Hide file tree
Showing 42 changed files with 1,847 additions and 607 deletions.
330 changes: 0 additions & 330 deletions .ci/gcb-generate-diffs-new.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .ci/gcb-pr-downstream-generation-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ steps:
- COMMIT_SHA=$COMMIT_SHA

# Long timeout to enable waiting on VCR test
timeout: 20000s
timeout: 64800s
options:
machineType: 'N1_HIGHCPU_32'

Expand Down
57 changes: 57 additions & 0 deletions .ci/magician/cmd/vcr_merge_eap.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package cmd

import (
"fmt"
"magician/exec"
"magician/github"
"magician/source"
"os"

"github.com/spf13/cobra"
)

var vcrMergeEapCmd = &cobra.Command{
Use: "vcr-merge-eap",
Short: "Merge VCR cassettes for EAP",
Long: `This command is triggered in .ci/gcb-push-downstream.yml to merge vcr cassettes.
The command expects the following as arguments:
1. CL number
It then performs the following operations:
1. Run gsutil to list, copy, and remove the vcr cassettes fixtures.
`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clNumber := args[0]
fmt.Println("CL number:", clNumber)

githubToken, ok := os.LookupEnv("GITHUB_TOKEN_CLASSIC")
if !ok {
return fmt.Errorf("did not provide GITHUB_TOKEN_CLASSIC environment variable")
}

baseBranch := os.Getenv("BASE_BRANCH")
if baseBranch == "" {
return fmt.Errorf("environment variable BASE_BRANCH is empty")
}

rnr, err := exec.NewRunner()
if err != nil {
return fmt.Errorf("error creating Runner: %w", err)
}

gh := github.NewClient(githubToken)
return execVCRMergeEAP(gh, clNumber, baseBranch, rnr)
},
}

func execVCRMergeEAP(gh GithubClient, clNumber, baseBranch string, runner source.Runner) error {
head := "auto-cl-" + clNumber
mergeCassettes("gs://ci-vcr-cassettes/private", baseBranch, fmt.Sprintf("refs/heads/%s", head), runner)
return nil
}

func init() {
rootCmd.AddCommand(vcrMergeEapCmd)
}
Loading

0 comments on commit 2fa4f7a

Please sign in to comment.