Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix repo - update documentation #253

Merged
merged 10 commits into from
Jun 20, 2022
22 changes: 12 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:

steps:
- checkout
- run:
command: |
set +e
- run:
command: |
set -e
echo "Building website"
sudo apt-get update
sudo apt-get install python3 python3-pip
Expand All @@ -22,13 +22,15 @@ jobs:
mkdocs gh-deploy --force
cd ..

echo "Building application"
echo "Building application"
go get -v -t -d ./...
go vet -tests=false ./...
go test -v ./...
mkdir -p build
go build -v -o build/tfswitch
find ./test-data/* -type d | xargs -n 1 ./build/tfswitch -c
find ./test-data/* -type d -print0 | while read -r -d $'\0' TEST_PATH; do
./build/tfswitch -c "${TEST_PATH}" || exit 1
done

release:
docker:
Expand All @@ -38,11 +40,11 @@ jobs:

steps:
- checkout
- run:
- run:
command: |
set +e
set -e
source version
export RELEASE_VERSION;
export RELEASE_VERSION;
RELEASE_VERSION=$RELEASE_VERSION.${CIRCLE_BUILD_NUM}
export RELEASE_VERSION;
echo $RELEASE_VERSION
Expand All @@ -54,7 +56,7 @@ jobs:
git tag -a ${RELEASE_VERSION} -m "Release Version"
git push origin ${RELEASE_VERSION}
curl -sL https://git.io/goreleaser | bash

workflows:
version: 2

Expand All @@ -70,6 +72,6 @@ workflows:
- build
filters:
branches:
only:
only:
- release

3 changes: 1 addition & 2 deletions lib/list_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func GetTFList(mirrorURL string, preRelease bool) ([]string, error) {
var semver string
if preRelease == true {
// Getting versions from body; should return match /X.X.X-@/ where X is a number,@ is a word character between a-z or A-Z
semver = `\/(\d+\.\d+\.\d+)(-[a-zA-z]+\d*)?"`
semver = `\/(\d+\.\d+\.\d+)(-[a-zA-z]+\d*)?/?"`
} else if preRelease == false {
// Getting versions from body; should return match /X.X.X/ where X is a number
// without the ending '"' pre-release folders would be tried and break.
Expand Down Expand Up @@ -73,7 +73,6 @@ func GetTFLatest(mirrorURL string) (string, error) {

//GetTFLatestImplicit : Get the latest implicit terraform version given the hashicorp url
func GetTFLatestImplicit(mirrorURL string, preRelease bool, version string) (string, error) {

if preRelease == true {
//TODO: use GetTFList() instead of GetTFURLBody
versions, error := GetTFURLBody(mirrorURL)
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func main() {
listAllFlag := getopt.BoolLong("list-all", 'l', "List all versions of terraform - including beta and rc")
latestPre := getopt.StringLong("latest-pre", 'p', defaultLatest, "Latest pre-release implicit version. Ex: tfswitch --latest-pre 0.13 downloads 0.13.0-rc1 (latest)")
showLatestPre := getopt.StringLong("show-latest-pre", 'P', defaultLatest, "Show latest pre-release implicit version. Ex: tfswitch --show-latest-pre 0.13 prints 0.13.0-rc1 (latest)")
latestStable := getopt.StringLong("latest-stable", 's', defaultLatest, "Latest implicit version. Ex: tfswitch --latest-stable 0.13 downloads 0.13.7 (latest)")
latestStable := getopt.StringLong("latest-stable", 's', defaultLatest, "Latest implicit version based on a constraint. Ex: tfswitch --latest-stable 0.13.0 downloads 0.13.7 and 0.13 downloads 0.15.5 (latest)")
showLatestStable := getopt.StringLong("show-latest-stable", 'S', defaultLatest, "Show latest implicit version. Ex: tfswitch --show-latest-stable 0.13 prints 0.13.7 (latest)")
latestFlag := getopt.BoolLong("latest", 'u', "Get latest stable version")
showLatestFlag := getopt.BoolLong("show-latest", 'U', "Show latest stable version")
Expand Down