This change add support for testing documentation
using exec-docs

Signed-off-by: Qasim Sarfraz <qasimsarfraz@microsoft.com>
This commit is contained in:
Qasim Sarfraz 2023-10-27 14:42:01 +02:00
Родитель aa727b00b7
Коммит cfad0e121a
4 изменённых файлов: 81 добавлений и 3 удалений

27
.github/workflows/kubectl-aks.yml поставляемый
Просмотреть файл

@ -268,6 +268,33 @@ jobs:
export AZURE_NODE_NAME=$(echo '${{ needs.create-aks-cluster.outputs.nodes }}' | jq -r ".[${{ strategy.job-index }}]")
make integration-test -o kubectl-aks
documentation-test:
name: Run documentation tests
runs-on: ubuntu-latest
needs: [ build, unit-tests ]
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '>=1.20.0' # ie requires go 1.20+
check-latest: true
# Use official krew installation guide:
# https://krew.sigs.k8s.io/docs/user-guide/setup/install/
- name: Install krew
run: |
set -x; cd "$(mktemp -d)" && \
OS="$(uname | tr '[:upper:]' '[:lower:]')" && \
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" && \
KREW="krew-${OS}_${ARCH}" && \
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && \
tar zxvf "${KREW}.tar.gz" && \
./"${KREW}" install krew && \
cp ~/.krew/bin/kubectl-krew /usr/local/bin/kubectl-krew
echo "$HOME/.krew/bin" >> $GITHUB_PATH
- name: Run Documentation tests
run: make documentation-test -o kubectl-aks
release:
name: Release
needs: [ integration-tests ]

Просмотреть файл

@ -18,6 +18,8 @@ endif
LINTER_VERSION ?= v1.53.2
include ie.mk
LDFLAGS := "-X github.com/Azure/kubectl-aks/cmd.version=$(VERSION) -extldflags '-static'"
.DEFAULT_GOAL := kubectl-aks
@ -69,6 +71,11 @@ install: kubectl-aks
mkdir -p ~/.local/bin/
cp kubectl-aks ~/.local/bin/
# Uninstall
.PHONY: uninstall
uninstall:
rm -f ~/.local/bin/kubectl-aks
# Run unit tests
.PHONY: unit-test
unit-test:
@ -83,6 +90,12 @@ integration-test: kubectl-aks
AZURE_CLUSTER_NAME=$(AZURE_CLUSTER_NAME) \
go test -v ./test/integration/... -integration
# Run documentation tests
.PHONY: documentation-test
documentation-test: kubectl-aks install-ie
ie --help > /dev/null || (echo "ie is not installed, please install it from https://github.com/Azure/InnovationEngine" && exit 1)
ie execute README.md
# Clean
.PHONY: clean
clean:

Просмотреть файл

@ -49,6 +49,12 @@ kubectl krew install aks
kubectl aks version
```
It can be uninstalled using the following command:
```bash
kubectl krew uninstall aks
```
### Install a specific release
It is possible to download the asset for a given release and platform from the
@ -56,11 +62,17 @@ It is possible to download the asset for a given release and platform from the
move the `kubectl-aks` executable to any folder in your `$PATH`.
```bash
VERSION=v0.2.0
curl -sL https://github.com/azure/kubectl-aks/releases/latest/download/kubectl-aks-linux-amd64-${VERSION}.tar.gz | sudo tar -C /usr/local/bin -xzf - kubectl-aks
VERSION=$(curl -s https://api.github.com/repos/azure/kubectl-aks/releases/latest | jq -r .tag_name)
curl -sL https://github.com/azure/kubectl-aks/releases/latest/download/kubectl-aks-linux-amd64-${VERSION}.tar.gz | sudo tar -C ${HOME}/.local/bin -xzf - kubectl-aks
kubectl aks version
```
It can be uninstalled by using the following command:
```bash
rm ${HOME}/.local/bin/kubectl-aks
```
### Compile from source
To build `kubectl-aks` from source, you'll need to have a Golang version 1.17
@ -74,9 +86,15 @@ make install
kubectl aks version
```
## Usage
It can be uninstalled by using the following command:
```bash
make uninstall
```
## Usage
```
$ kubectl aks --help
Azure Kubernetes Service (AKS) kubectl plugin

20
ie.mk Normal file
Просмотреть файл

@ -0,0 +1,20 @@
IE_VERSION ?= 40e125e61516ab401084da65eed36095b2b3850a
INSTALLATION_DIR ?= ~/.local/bin
# Install innovation engine
.PHONY: install-ie
install-ie:
DIR=$$(mktemp -d) && \
cd $$DIR && \
git clone https://github.com/Azure/InnovationEngine.git && \
cd InnovationEngine && \
git checkout $(IE_VERSION) && \
make build-ie && \
mkdir -p $(INSTALLATION_DIR) && \
cp bin/ie $(INSTALLATION_DIR) && \
rm -rf $$DIR
# Uninstall innovation engine
.PHONY: uninstall-ie
uninstall-ie:
rm -f $(INSTALLATION_DIR)/ie