diff --git a/.github/workflows/teamcity-services-diff-check-beta.yml b/.github/workflows/teamcity-services-diff-check-beta.yml index 2bc966427460..20121b4b29e8 100644 --- a/.github/workflows/teamcity-services-diff-check-beta.yml +++ b/.github/workflows/teamcity-services-diff-check-beta.yml @@ -18,6 +18,8 @@ jobs: needs: terraform-provider-google-beta runs-on: ubuntu-22.04 steps: + - uses: actions/checkout@v3 + - name: Download built artifacts uses: actions/download-artifact@v2 with: diff --git a/.github/workflows/teamcity-services-diff-check-ga.yml b/.github/workflows/teamcity-services-diff-check-ga.yml index 66ec44d18555..fb4e5d85b4d8 100644 --- a/.github/workflows/teamcity-services-diff-check-ga.yml +++ b/.github/workflows/teamcity-services-diff-check-ga.yml @@ -18,6 +18,12 @@ jobs: needs: terraform-provider-google runs-on: ubuntu-22.04 steps: + - uses: actions/checkout@v3 + + - name: this + run: | + cd tools/teamcity-diff-check + go run main.go google services_ga.kt - name: Download built artifacts uses: actions/download-artifact@v2 with: @@ -51,5 +57,5 @@ jobs: - name: Diff Check run: | - cd .teamcity/components/inputs - go run diff_check.go google services_ga.kt \ No newline at end of file + cd tools/teamcity-diff-check + go run main.go google services_ga.kt \ No newline at end of file diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/diff_check.go b/tools/teamcity-diff-check/main.go similarity index 85% rename from mmv1/third_party/terraform/.teamcity/components/inputs/diff_check.go rename to tools/teamcity-diff-check/main.go index eed74d6c43e2..11a44f5785ec 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/diff_check.go +++ b/tools/teamcity-diff-check/main.go @@ -12,6 +12,7 @@ package main import ( "bufio" "bytes" + "flag" "fmt" "io" "os" @@ -19,9 +20,12 @@ import ( "regexp" ) +var serviceFile = flag.String("service_file", "services_ga.kt", "kotlin service file to be parsed") +var provider = flag.String("provider", "google", "Specify which provider to run diff_check on") + func main() { - repo := os.Args - services := fmt.Sprintf("../../../%v/services/...", repo[1]) + flag.Parse() + services := fmt.Sprintf("../%v/services/...", *provider) fmt.Println(services) cmd := exec.Command("go", "list", services) stdout, err := cmd.Output() @@ -47,8 +51,7 @@ func main() { //////////////////////////////////////////////////////////////////////////////// - service_file := os.Args[2] - f, err := os.Open(service_file) + f, err := os.Open(*serviceFile) if err != nil { panic(err) } @@ -85,7 +88,7 @@ func main() { } if !bytes.Equal(googleServices, teamcityServices) { - fmt.Fprintf(os.Stderr, "error: diff in services_ga.kt\n") + fmt.Fprintf(os.Stderr, "error: diff in %s\n", *serviceFile) os.Exit(1) } }