Skip to content

Commit

Permalink
Update teamcity-diff-check script and GHAs to have more explicit ca…
Browse files Browse the repository at this point in the history
…lls to action (#10098)
  • Loading branch information
SarahFrench authored Mar 1, 2024
1 parent 59e75bc commit 8a90833
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/teamcity-services-diff-check-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
unzip -o artifacts/output.zip -d ./provider
rm artifacts/output.zip
- name: Diff Check
- name: Check that new services have been added to the TeamCity configuration code
run: |
# Create lists of service packages in providers
ls provider/google/services > tools/teamcity-diff-check/services_ga.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/teamcity-services-diff-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
unzip -o artifacts/output.zip -d ./provider
rm artifacts/output.zip
- name: Diff Check
- name: Check that new services have been added to the TeamCity configuration code
run: |
# Create lists of service packages in providers
ls provider/google/services > tools/teamcity-diff-check/services_ga.txt
Expand Down
9 changes: 5 additions & 4 deletions tools/teamcity-diff-check/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ func main() {

////////////////////////////////////////////////////////////////////////////////

f, err := os.Open(fmt.Sprintf("../../mmv1/third_party/terraform/.teamcity/components/inputs/%s", *serviceFile+".kt"))
filePath := fmt.Sprintf("mmv1/third_party/terraform/.teamcity/components/inputs/%s.kt", *serviceFile)
f, err := os.Open(fmt.Sprintf("../../%s", filePath)) // Need to make path relative to where the script is called
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -79,13 +80,13 @@ func main() {
teamcityServices = append(teamcityServices, string(service))
}
if len(teamcityServices) == 0 {
fmt.Fprintf(os.Stderr, "teamcityServices error: regex produced no matches.\n")
fmt.Fprintf(os.Stderr, "error: script could not find any services listed in the file %s.kt .\n", filePath)
os.Exit(1)
}

if diff := serviceDifference(googleServices, teamcityServices); len(diff) != 0 {
fmt.Fprintf(os.Stderr, "error: diff in %s\n", *serviceFile)
fmt.Fprintf(os.Stderr, "Missing Services: %s\n", diff)
fmt.Fprintf(os.Stderr, "error: missing services detected in %s\n", filePath)
fmt.Fprintf(os.Stderr, "Please update file to include these new services: %s\n", diff)
os.Exit(1)
}

Expand Down

0 comments on commit 8a90833

Please sign in to comment.