Skip to content

Commit

Permalink
fix: script and README.md cleanup
Browse files Browse the repository at this point in the history
This patch makes several fixes to the script, moves
the ktf main.go for better "go install" support, and
cleans up the README.md in preparation for the first
release.
  • Loading branch information
shaneutt committed Jul 12, 2021
1 parent 6b21631 commit a49f8c4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*.dll
*.so
*.dylib
ktf*
./ktf*

# Test binary, built with `go test -c`
*.test
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ clean:

.PHONY: build
build:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o ktf.$(GOOS).$(GOARCH) main.go
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o ktf.$(GOOS).$(GOARCH) cmd/ktf/main.go

.PHONY: test
test: test.unit
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,16 @@ This project provides a command line tool `ktf` which can be used for reason suc

### Install

If you have [Golang](https://go.dev) installed locally you can install with `go`:

```shell
$ go install github.com/kong/kubernetes-testing-framework/cmd/ktf@latest
```

Otherwise you can use the shell script to install the latest release for your operating system:

```shell
$ curl --proto '=https' --tls1.2 -sSf https://kong.github.io/kubernetes-testing-framework/install.sh | sh
$ curl --proto '=https' -sSf https://kong.github.io/kubernetes-testing-framework/install.sh | sh
```

### Testing Environments
Expand Down
File renamed without changes.
14 changes: 8 additions & 6 deletions docs/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fi
# Determine Latest Release
# ------------------------------------------------------------------------------

LATEST_RELEASE=$(curl -s https://api.github.com/repos/${BASE}/releases/latest | perl -ne 'print $1 if m{"name": "(.*)"}')
LATEST_RELEASE=$(curl -s https://api.github.com/repos/${BASE}/releases/latest | perl -ne 'print $1 if m{"name": "(v[0-9]+\.[0-9]+\.[0-9]+.*)"}')

if [ "$LATEST_RELEASE" = "" ]; then
echo "Error: could not find latest release for ${BASE}!${LATEST_RELEASE}"
Expand All @@ -60,18 +60,18 @@ DOWNLOAD_CHECKSUMS_URL="https://github.com/${BASE}/releases/download/${LATEST_RE
TEMPDIR=$(mktemp -d)

echo "INFO: downloading ktf cli for ${OSTYPE}/${ARCH}"
curl --proto '=https' --tlsv1.2 -sSf ${DOWNLOAD_URL} > ${TEMPDIR}/ktf.${OSTYPE}.${ARCH}
curl -L --proto '=https' --tlsv1.2 -sSf ${DOWNLOAD_URL} > ${TEMPDIR}/ktf.${OSTYPE}.${ARCH}

echo "INFO: downloading checksums for release ${LATEST_RELEASE}"
curl --proto '=https' --tlsv1.2 -sSf ${DOWNLOAD_CHECKSUMS_URL} > ${TEMPDIR}/CHECKSUMS
curl -L --proto '=https' --tlsv1.2 -sSf ${DOWNLOAD_CHECKSUMS_URL} > ${TEMPDIR}/CHECKSUMS

# ------------------------------------------------------------------------------
# Checksum Verification
# ------------------------------------------------------------------------------

pushd ${TEMPDIR}
sha256sum -c CHECKSUM --ignore-missing
popd
pushd ${TEMPDIR} 1>/dev/null
sha256sum -c CHECKSUMS --ignore-missing 1>/dev/null
popd 1>/dev/null

# ------------------------------------------------------------------------------
# Installation
Expand All @@ -90,3 +90,5 @@ chmod +x ${INSTALL_LOCATION}
rm -f ${TEMPDIR}/ktf.${OSTYPE}.${ARCH}
rm -f ${TEMPDIR}/CHECKSUMS
rmdir ${TEMPDIR}

echo "SUCCESS! Checksums verified, ktf (version: ${LATEST_RELEASE}) was installed at: ${INSTALL_LOCATION}"

0 comments on commit a49f8c4

Please sign in to comment.