Skip to content

Adding BP and BPA resources to beta version with examples #7

Adding BP and BPA resources to beta version with examples

Adding BP and BPA resources to beta version with examples #7

name: TeamCity Services Diff Check
permissions: read-all
on:
pull_request:
paths:
- '.github/workflows/teamcity-services-diff-check.yml'
- 'mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt'
- 'mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt'
- 'mmv1/products/**'
jobs:
teamcity-services-diff-check:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
with:
fetch-depth: 0
- name: "Check for New Services"
id: services
run: |
newServices=$(($(git diff --name-only --diff-filter=A origin/main HEAD | grep -P "mmv1/products/.*/product.yaml" | wc -l)))
echo "services=$newServices" >> "${GITHUB_OUTPUT}"
if [ "$newServices" = "0" ];then
echo "No new service found."
fi
- name: TeamCity Google Provider Generate
id: generate
if: ${{steps.services.outputs.services != '0'}}
uses: ./.github/actions/build-downstream
with:
repo: 'terraform-provider-google'
token: '$GITHUB_TOKEN'
# The path where GA/Beta providers are generated is grabbed from the OUTPUT_PATH that's set in build_downstream.yaml
# export OUTPUT_PATH=$GOPATH/src/github.com/$UPSTREAM_OWNER/$GH_REPO
# OUTPUT_PATH changes after each generate (GA/beta)
- name: Set GOOGLE_REPO_PATH to path where GA provider was generated
run: echo "GOOGLE_REPO_PATH=${{ env.OUTPUT_PATH}}" >> $GITHUB_ENV
- name: TeamCity Google Beta Provider Generate
if: steps.generate.outcome == 'success'
uses: ./.github/actions/build-downstream
with:
repo: 'terraform-provider-google-beta'
token: '$GITHUB_TOKEN'
- name: Set GOOGLE_BETA_REPO_PATH to path where beta provider was generated
run: echo "GOOGLE_BETA_REPO_PATH=${{ env.OUTPUT_PATH}}" >> $GITHUB_ENV
- name: Checkout Repository
if: steps.generate.outcome == 'success'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
- name: Check that new services have been added to the TeamCity configuration code
if: steps.generate.outcome == 'success'
run: |
# Create lists of service packages in providers
ls ${{env.GOOGLE_REPO_PATH}}/google/services > tools/teamcity-diff-check/services_ga.txt
ls ${{env.GOOGLE_BETA_REPO_PATH}}/google-beta/services > tools/teamcity-diff-check/services_beta.txt
# Run tool to compare service packages in the providers vs those listed in TeamCity config files
cd tools/teamcity-diff-check
go run main.go -service_file=services_ga
go run main.go -service_file=services_beta