-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* work * fix * fix * checkout current commit * fix
- Loading branch information
Showing
5 changed files
with
71 additions
and
103 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
source scripts/libschema.sh | ||
|
||
BASE_BRANCH="master" | ||
|
||
checkout_branch() { | ||
local branch=$1 | ||
echo "Checking out branch: $branch" | ||
git checkout $branch | ||
} | ||
|
||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "There are uncommitted changes. Please commit them before running this script." | ||
exit 1 | ||
fi | ||
|
||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
NEW_SCHEMA=$(generate_schema) | ||
checkout_branch $BASE_BRANCH | ||
CURRENT_SCHEMA=$(generate_schema) | ||
checkout_branch $CURRENT_BRANCH | ||
|
||
set +e | ||
jd -color "$CURRENT_SCHEMA" "$NEW_SCHEMA" | ||
RES=$? | ||
set -e | ||
if [ $RES -eq 0 ]; then | ||
echo "No schema changes detected." | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Function to generate provider schema | ||
generate_schema() { | ||
>&2 make install | ||
version=$(./terraform-provider-databricks version) | ||
|
||
local TMPDIR=$(mktemp -d) | ||
>&2 echo "Generating provider schema in $TMPDIR..." | ||
>&2 pushd $TMPDIR | ||
cat > main.tf <<EOF | ||
terraform { | ||
required_providers { | ||
databricks = { | ||
source = "databricks/databricks" | ||
version = "$version" | ||
} | ||
} | ||
} | ||
EOF | ||
>&2 terraform init | ||
terraform providers schema -json > schema.json | ||
>&2 popd | ||
>&2 echo "Provider schema available in $TMPDIR/schema.json" | ||
echo "$TMPDIR/schema.json" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
source scripts/libschema.sh | ||
|
||
cat $(generate_schema) | jq |