From 474066d242f4c3f5dfaa3e6b96847ef204dd2012 Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Mon, 30 Oct 2023 16:31:07 -0700 Subject: [PATCH] retain old base build pathway --- .../downstream-builder/generate_downstream.sh | 68 +++++++++++++++++++ .github/workflows/build-downstream.yml | 4 +- 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/.ci/scripts/build-environment/downstream-builder/generate_downstream.sh b/.ci/scripts/build-environment/downstream-builder/generate_downstream.sh index 3fcc7562b4a6..17ea28574350 100755 --- a/.ci/scripts/build-environment/downstream-builder/generate_downstream.sh +++ b/.ci/scripts/build-environment/downstream-builder/generate_downstream.sh @@ -82,6 +82,74 @@ clone_repo git config --local user.name "Modular Magician" git config --local user.email "magic-modules@google.com" +if [ "$COMMAND" != "base" ]; then + pushd mmv1 + if [ "$REPO" == "terraform" ]; then + pushd $LOCAL_PATH + go mod download + find . -type f -not -wholename "./.git*" -not -wholename "./.changelog*" -not -name ".travis.yml" -not -name ".golangci.yml" -not -name "CHANGELOG.md" -not -name "CHANGELOG_v*.md" -not -name "GNUmakefile" -not -name "docscheck.sh" -not -name "LICENSE" -not -name "README.md" -not -wholename "./examples*" -not -name ".go-version" -not -name ".hashibot.hcl" -print0 | xargs -0 git rm + popd + fi + + if [ "$REPO" == "terraform-google-conversion" ]; then + # Generate tfplan2cai + pushd $LOCAL_PATH + # clear out the templates as they are copied during + # generation from mmv1/third_party/validator/tests/data + rm -rf ./tfplan2cai/testdata/templates/ + rm -rf ./tfplan2cai/testdata/generatedconvert/ + rm -rf ./tfplan2cai/converters/google/provider + rm -rf ./tfplan2cai/converters/google/resources + find ./tfplan2cai/test/** -type f -exec git rm {} \; + popd + + bundle exec compiler.rb -a -e terraform -f validator -o $LOCAL_PATH/tfplan2cai -v $VERSION + + # Ignore 'tgc-base' step, because this is a new provider. + # TODO: remove this condition on next cai2hcl-related PR. + if [ "$COMMAND" != "base" ]; then + # Generate cai2hcl + pushd $LOCAL_PATH + rm -rf ./cai2hcl/* + popd + + bundle exec compiler.rb -a -e terraform -f tgc_cai2hcl -o $LOCAL_PATH/cai2hcl -v $VERSION + fi + + if [ "$COMMAND" == "downstream" ]; then + pushd $LOCAL_PATH + go get -d github.com/hashicorp/terraform-provider-google-beta@$BASE_BRANCH + go mod tidy + set +e + make build + set -e + popd + fi + elif [ "$REPO" == "tf-oics" ]; then + # use terraform generator with oics override + bundle exec compiler.rb -a -e terraform -f oics -o $LOCAL_PATH -v $VERSION + else + if [ "$REPO" == "terraform" ]; then + if [ "$VERSION" == "ga" ]; then + bundle exec compiler.rb -a -e $REPO -o $LOCAL_PATH -v $VERSION --no-docs + bundle exec compiler.rb -a -e $REPO -o $LOCAL_PATH -v beta --no-code + else + bundle exec compiler.rb -a -e $REPO -o $LOCAL_PATH -v $VERSION + fi + pushd ../ + make tpgtools OUTPUT_PATH=$LOCAL_PATH VERSION=$VERSION + + # Only generate TeamCity-related file for TPG and TPGB + if [ "$VERSION" == "ga" ] || [ "$VERSION" == "beta" ]; then + make teamcity-servicemap-generate OUTPUT_PATH=$LOCAL_PATH VERSION=$VERSION + fi + popd + fi + fi + popd +fi + + if [ "$COMMAND" == "head" ]; then BRANCH=auto-pr-$REFERENCE COMMIT_MESSAGE="New generated code for MM PR $REFERENCE." diff --git a/.github/workflows/build-downstream.yml b/.github/workflows/build-downstream.yml index 87a5f56e9302..f280e6ba7ae6 100644 --- a/.github/workflows/build-downstream.yml +++ b/.github/workflows/build-downstream.yml @@ -102,6 +102,6 @@ jobs: clone_repo make tf-ocis else - echo "case not supported" - exit 1 + echo "case not supported" + exit 1 fi