mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-02-15 04:00:58 -05:00
update githbu
This commit is contained in:
4
.github/scripts/e2e_test_linux_darwin.sh
vendored
4
.github/scripts/e2e_test_linux_darwin.sh
vendored
@@ -7,12 +7,12 @@ set -uo pipefail
|
||||
if [[ $arch == 'arm' || $arch == 'arm64' ]]
|
||||
then
|
||||
export DIR=$(mktemp -d)
|
||||
unzip -d $DIR "${e2e_cache_path}/terraform-e2etest_${os}_${arch}.zip"
|
||||
unzip -d $DIR "${e2e_cache_path}/opentf-e2etest_${os}_${arch}.zip"
|
||||
unzip -d $DIR "./opentf_${version}_${os}_${arch}.zip"
|
||||
sudo chmod +x $DIR/e2etest
|
||||
docker run --platform=linux/arm64 -v $DIR:/src -w /src arm64v8/alpine ./e2etest -test.v
|
||||
else
|
||||
unzip "${e2e_cache_path}/terraform-e2etest_${os}_${arch}.zip"
|
||||
unzip "${e2e_cache_path}/opentf-e2etest_${os}_${arch}.zip"
|
||||
unzip "./opentf_${version}_${os}_${arch}.zip"
|
||||
TF_ACC=1 ./e2etest -test.v
|
||||
fi
|
||||
|
||||
94
.github/scripts/equivalence-test.sh
vendored
94
.github/scripts/equivalence-test.sh
vendored
@@ -10,27 +10,14 @@ Usage: ./equivalence-test.sh <command> [<args>] [<options>]
|
||||
|
||||
Description:
|
||||
This script will handle various commands related to the execution of the
|
||||
Terraform equivalence tests.
|
||||
opentf equivalence tests.
|
||||
|
||||
Commands:
|
||||
get_target_branch <version>
|
||||
get_target_branch returns the default target branch for a given Terraform
|
||||
version.
|
||||
|
||||
target_branch=$(./equivalence-test.sh get_target_branch v1.4.3); target_branch=v1.4
|
||||
target_branch=$(./equivalence-test.sh get_target_branch 1.4.3); target_branch=v1.4
|
||||
|
||||
download_equivalence_test_binary <version> <target> <os> <arch>
|
||||
download_equivalence_test_binary downloads the equivalence testing binary
|
||||
for a given version and places it at the target path.
|
||||
|
||||
./equivalence-test.sh download_equivalence_test_binary 0.3.0 ./bin/terraform-equivalence-testing linux amd64
|
||||
|
||||
download_terraform_binary <version> <target> <os> <arch>
|
||||
download_terraform_binary downloads the terraform release binary for a given
|
||||
version and places it at the target path.
|
||||
|
||||
./equivalence-test.sh download_terraform_binary 1.4.3 ./bin/terraform linux amd64
|
||||
./equivalence-test.sh download_equivalence_test_binary 0.3.0 ./bin/opentf-equivalence-testing linux amd64
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -50,7 +37,7 @@ function download_equivalence_test_binary {
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"https://api.github.com/repos/hashicorp/terraform-equivalence-testing/releases" > releases.json
|
||||
|
||||
ASSET="terraform-equivalence-testing_v${VERSION}_${OS}_${ARCH}.zip"
|
||||
ASSET="opentf-equivalence-testing_v${VERSION}_${OS}_${ARCH}.zip"
|
||||
ASSET_ID=$(jq -r --arg VERSION "v$VERSION" --arg ASSET "$ASSET" '.[] | select(.name == $VERSION) | .assets[] | select(.name == $ASSET) | .id' releases.json)
|
||||
|
||||
mkdir -p zip
|
||||
@@ -65,73 +52,8 @@ function download_equivalence_test_binary {
|
||||
rm releases.json
|
||||
}
|
||||
|
||||
function download_terraform_binary {
|
||||
VERSION="${1:-}"
|
||||
TARGET="${2:-}"
|
||||
OS="${3:-}"
|
||||
ARCH="${4:-}"
|
||||
|
||||
if [[ -z "$VERSION" || -z "$TARGET" || -z "$OS" || -z "$ARCH" ]]; then
|
||||
echo "missing at least one of [<version>, <target>, <os>, <arch>] arguments"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p zip
|
||||
curl "https://releases.hashicorp.com/terraform/${VERSION}/terraform_${VERSION}_${OS}_${ARCH}.zip" > "zip/terraform.zip"
|
||||
|
||||
mkdir -p bin
|
||||
unzip -p "zip/terraform.zip" terraform > "$TARGET"
|
||||
chmod u+x "$TARGET"
|
||||
rm -r zip
|
||||
}
|
||||
|
||||
function get_target_branch {
|
||||
VERSION="${1:-}"
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "missing <version> argument"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Split off the build metadata part, if any
|
||||
# (we won't actually include it in our final version, and handle it only for
|
||||
# completeness against semver syntax.)
|
||||
IFS='+' read -ra VERSION BUILD_META <<< "$VERSION"
|
||||
|
||||
# Separate out the prerelease part, if any
|
||||
IFS='-' read -r BASE_VERSION PRERELEASE <<< "$VERSION"
|
||||
|
||||
# Separate out major, minor and patch versions.
|
||||
IFS='.' read -r MAJOR_VERSION MINOR_VERSION PATCH_VERSION <<< "$BASE_VERSION"
|
||||
|
||||
if [[ "$PRERELEASE" == *"alpha"* ]]; then
|
||||
TARGET_BRANCH=main
|
||||
else
|
||||
if [[ $MAJOR_VERSION = v* ]]; then
|
||||
TARGET_BRANCH=${MAJOR_VERSION}.${MINOR_VERSION}
|
||||
else
|
||||
TARGET_BRANCH=v${MAJOR_VERSION}.${MINOR_VERSION}
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$TARGET_BRANCH"
|
||||
}
|
||||
|
||||
function main {
|
||||
case "$1" in
|
||||
get_target_branch)
|
||||
if [ "${#@}" != 2 ]; then
|
||||
echo "invalid number of arguments"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
get_target_branch "$2"
|
||||
|
||||
;;
|
||||
download_equivalence_test_binary)
|
||||
if [ "${#@}" != 5 ]; then
|
||||
echo "invalid number of arguments"
|
||||
@@ -141,16 +63,6 @@ function main {
|
||||
|
||||
download_equivalence_test_binary "$2" "$3" "$4" "$5"
|
||||
|
||||
;;
|
||||
download_terraform_binary)
|
||||
if [ "${#@}" != 5 ]; then
|
||||
echo "invalid number of arguments"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
download_terraform_binary "$2" "$3" "$4" "$5"
|
||||
|
||||
;;
|
||||
*)
|
||||
echo "unrecognized command $*"
|
||||
|
||||
2
.github/scripts/get_product_version.sh
vendored
2
.github/scripts/get_product_version.sh
vendored
@@ -30,7 +30,7 @@ LDFLAGS="${LDFLAGS} -X 'main.experimentsAllowed=yes'"
|
||||
fi
|
||||
LDFLAGS="${LDFLAGS} -X 'github.com/placeholderplaceholderplaceholder/opentf/version.dev=no'"
|
||||
|
||||
echo "Building Terraform CLI ${VERSION}"
|
||||
echo "Building OpenTF CLI ${VERSION}"
|
||||
if [[ "$EXPERIMENTS_ENABLED" == 1 ]]; then
|
||||
echo "This build allows use of experimental features"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user