Skip to content

Commit

Permalink
retain old base build pathway
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottSuarez committed Oct 30, 2023
1 parent 178de0f commit 474066d
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,74 @@ clone_repo
git config --local user.name "Modular Magician"
git config --local user.email "[email protected]"

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."
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ jobs:
clone_repo
make tf-ocis
else
echo "case not supported"
exit 1
echo "case not supported"
exit 1
fi

0 comments on commit 474066d

Please sign in to comment.