-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3596 from hashicorp/automation/refactor-and-enabl…
…e-data-api-v2-for-terraform-generator automation: updating the Terraform Generator to use Data API V2
- Loading branch information
Showing
11 changed files
with
117 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,28 +5,34 @@ set -e | |
DIR="$(cd "$(dirname "$0")" && pwd)/.." | ||
|
||
function buildAndInstallDependencies { | ||
echo "Installing the Go SDK Generator into the GOBIN.." | ||
cd "${DIR}/tools/generator-go-sdk" | ||
go install . | ||
cd "${DIR}" | ||
|
||
echo "Building Wrapper.." | ||
cd "${DIR}/tools/wrapper-automation" | ||
go build -o wrapper-automation | ||
cd "${DIR}" | ||
echo "Outputting Go Version.." | ||
go version | ||
|
||
echo "Installing the Data API V2 onto the GOBIN.." | ||
cd "${DIR}/tools/data-api" | ||
go install . | ||
cd "${DIR}" | ||
|
||
echo "Installing the Go SDK Generator into the GOBIN.." | ||
cd "${DIR}/tools/generator-go-sdk" | ||
go install . | ||
cd "${DIR}" | ||
|
||
echo "Building Wrapper.." | ||
cd "${DIR}/tools/wrapper-automation" | ||
go build -o wrapper-automation | ||
cd "${DIR}" | ||
} | ||
|
||
function runWrapper { | ||
local dataApiAssemblyPath=$1 | ||
local apiDefinitionsDirectory=$1 | ||
local outputDirectory=$2 | ||
local useV2Generator=$4 | ||
|
||
echo "Running Wrapper.." | ||
cd "${DIR}/tools/wrapper-automation" | ||
./wrapper-automation go-sdk \ | ||
-data-api-assembly-path="../../$dataApiAssemblyPath"\ | ||
-output-dir="../../$outputDirectory"\ | ||
-use-v2-generator="$useV2Generator" | ||
--api-definitions-dir="../../$apiDefinitionsDirectory"\ | ||
--output-dir="../../$outputDirectory" | ||
|
||
cd "${DIR}" | ||
|
||
|
@@ -109,23 +115,16 @@ function cleanup { | |
} | ||
|
||
function main { | ||
local dataApiAssemblyPath="data/Pandora.Api/bin/Debug/net7.0/Pandora.Api.dll" | ||
local dataApiV2Path="tools/data-api/data-api" | ||
local apiDefinitionsDirectory="./api-definitions" | ||
local swaggerSubmodule="./submodules/rest-api-specs" | ||
local outputDirectory="tmp/go-azure-sdk" | ||
local sdkRepo="[email protected]:hashicorp/go-azure-sdk.git" | ||
local sha | ||
local useV2Generator=true | ||
|
||
buildAndInstallDependencies | ||
sha=$(getSwaggerSubmoduleSha "$swaggerSubmodule") | ||
prepareGoSdk "$outputDirectory" "$sdkRepo" | ||
if [ "$useV2Generator" = true ] | ||
then | ||
runWrapper "$dataApiV2Path" "$outputDirectory" "$sha" "$useV2Generator" | ||
else | ||
runWrapper "$dataApiAssemblyPath" "$outputDirectory" "$sha" "$useV2Generator" | ||
fi | ||
runWrapper "$apiDefinitionsDirectory" "$outputDirectory" | ||
conditionallyCommitAndPushGoSdk "$outputDirectory" "$sha" | ||
cleanup "$outputDirectory" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,34 +5,34 @@ set -e | |
DIR="$(cd "$(dirname "$0")" && pwd)/.." | ||
|
||
function buildAndInstallDependencies { | ||
echo "Outputting Go Version.." | ||
go version | ||
echo "Outputting Go Version.." | ||
go version | ||
|
||
echo "Outputting .net Version.." | ||
dotnet --version | ||
echo "Installing the Data API into the GOBIN.." | ||
cd "${DIR}/tools/data-api" | ||
go install . | ||
cd "${DIR}" | ||
|
||
echo "Installing the Terraform Generator into the GOBIN.." | ||
cd "${DIR}/tools/generator-terraform" | ||
go install . | ||
cd "${DIR}" | ||
echo "Installing the Terraform Generator into the GOBIN.." | ||
cd "${DIR}/tools/generator-terraform" | ||
go install . | ||
cd "${DIR}" | ||
|
||
echo "Building Wrapper.." | ||
cd "${DIR}/tools/wrapper-automation" | ||
go build -o wrapper-automation | ||
cd "${DIR}" | ||
echo "Building Wrapper.." | ||
cd "${DIR}/tools/wrapper-automation" | ||
go build -o wrapper-automation | ||
cd "${DIR}" | ||
} | ||
|
||
function runWrapper { | ||
local dataApiAssemblyPath=$1 | ||
local apiDefinitionsDirectory=$1 | ||
local outputDirectory=$2 | ||
local useV2Generator=$4 | ||
|
||
echo "Running Wrapper.." | ||
cd "${DIR}/tools/wrapper-automation" | ||
./wrapper-automation terraform \ | ||
-data-api-assembly-path="../../$dataApiAssemblyPath"\ | ||
-output-dir="../../$outputDirectory"\ | ||
-use-v2-generator="$useV2Generator" | ||
--api-definitions-dir="../../$apiDefinitionsDirectory"\ | ||
--output-dir="../../$outputDirectory" | ||
|
||
cd "${DIR}" | ||
|
||
|
@@ -141,23 +141,16 @@ function cleanup { | |
} | ||
|
||
function main { | ||
local dataApiAssemblyPath="data/Pandora.Api/bin/Debug/net7.0/Pandora.Api.dll" | ||
local dataApiV2Path="tools/data-api/data-api" | ||
local apiDefinitionsDirectory="./api-definitions" | ||
local swaggerSubmodule="./submodules/rest-api-specs" | ||
local outputDirectory="tmp/terraform-provider-azurerm" | ||
local providerRepo="[email protected]:hashicorp/terraform-provider-azurerm.git" | ||
local sha | ||
local useV2Generator=false | ||
|
||
buildAndInstallDependencies | ||
sha=$(getSwaggerSubmoduleSha "$swaggerSubmodule") | ||
prepareTerraformProvider "$outputDirectory" "$providerRepo" | ||
if [ "$useV2Generator" = true ] | ||
then | ||
runWrapper "$dataApiV2Path" "$outputDirectory" "$sha" "$useV2Generator" | ||
else | ||
runWrapper "$dataApiAssemblyPath" "$outputDirectory" "$sha" "$useV2Generator" | ||
fi | ||
runWrapper "$apiDefinitionsDirectory" "$outputDirectory" | ||
runFmtImportsAndGenerate "$outputDirectory" | ||
conditionallyCommitAndPushTerraformProvider "$outputDirectory" "$sha" | ||
cleanup "$outputDirectory" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,34 +5,34 @@ set -e | |
DIR="$(cd "$(dirname "$0")" && pwd)/.." | ||
|
||
function buildAndInstallDependencies { | ||
echo "Outputting Go Version.." | ||
go version | ||
echo "Outputting Go Version.." | ||
go version | ||
|
||
echo "Outputting .net Version.." | ||
dotnet --version | ||
echo "Installing the Data API V2 onto the GOBIN.." | ||
cd "${DIR}/tools/data-api" | ||
go install . | ||
cd "${DIR}" | ||
|
||
echo "Installing the Terraform Generator into the GOBIN.." | ||
cd "${DIR}/tools/generator-terraform" | ||
go install . | ||
cd "${DIR}" | ||
echo "Installing the Terraform Generator into the GOBIN.." | ||
cd "${DIR}/tools/generator-terraform" | ||
go install . | ||
cd "${DIR}" | ||
|
||
echo "Building Wrapper.." | ||
cd "${DIR}/tools/wrapper-automation" | ||
go build -o wrapper-automation | ||
cd "${DIR}" | ||
echo "Building Wrapper.." | ||
cd "${DIR}/tools/wrapper-automation" | ||
go build -o wrapper-automation | ||
cd "${DIR}" | ||
} | ||
|
||
function runWrapper { | ||
local dataApiAssemblyPath=$1 | ||
local apiDefinitionsDirectory=$1 | ||
local outputDirectory=$2 | ||
local useV2Generator=$3 | ||
|
||
echo "Running Wrapper.." | ||
cd "${DIR}/tools/wrapper-automation" | ||
./wrapper-automation terraform \ | ||
-data-api-assembly-path="../../$dataApiAssemblyPath"\ | ||
-output-dir="../../$outputDirectory"\ | ||
-use-v2-generator="$useV2Generator" | ||
--api-definitions-dir="../../$apiDefinitionsDirectory"\ | ||
--output-dir="../../$outputDirectory" | ||
|
||
cd "${DIR}" | ||
|
||
|
@@ -110,20 +110,13 @@ function cleanup { | |
} | ||
|
||
function main { | ||
local dataApiAssemblyPath="data/Pandora.Api/bin/Debug/net7.0/Pandora.Api.dll" | ||
local dataApiV2Path="tools/data-api/data-api" | ||
local apiDefinitionsDirectory="./api-definitions" | ||
local outputDirectory="tmp/provider-azurerm" | ||
local providerRepo="[email protected]:hashicorp/terraform-provider-azurerm.git" | ||
local useV2Generator=false | ||
|
||
buildAndInstallDependencies | ||
prepareTerraformProvider "$outputDirectory" "$providerRepo" | ||
if [ "$useV2Generator" = true ] | ||
then | ||
runWrapper "$dataApiV2Path" "$outputDirectory" "$useV2Generator" | ||
else | ||
runWrapper "$dataApiAssemblyPath" "$outputDirectory" "$useV2Generator" | ||
fi | ||
runWrapper "$apiDefinitionsDirectory" "$outputDirectory" | ||
runFmtImportsAndGenerate "$outputDirectory" | ||
runTerraformProviderUnitTests "$outputDirectory" | ||
cleanup "$outputDirectory" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.