feat: 🎸 get export env KUBECONFIG #601
Workflow file for this run
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
name: E2E Test | |
on: | |
push: | |
branches: | |
- "master" | |
paths: | |
- '**.go' | |
- '**.yaml' | |
- '**.mod' | |
pull_request: | |
paths: | |
- '**.go' | |
- '**.yaml' | |
- '**.mod' | |
jobs: | |
kind: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Get dependencies | |
run: | | |
go get -v -t -d ./... | |
- name: Go build | |
run: | | |
go build -ldflags="-X github.com/sunny0826/kubecm/version.Version=${{ github.run_id }} \ | |
-X github.com/sunny0826/kubecm/version.GitRevision=${{ github.sha }} \ | |
-X 'github.com/sunny0826/kubecm/version.BuildDate=${{ steps.date.outputs.date }}'" \ | |
-o bin/kubecm . | |
- name: Setup Kind | |
uses: engineerd/[email protected] | |
with: | |
version: "v0.20.0" | |
- name: Setup 2nd Kind | |
run: | | |
kind create cluster --image kindest/node:v1.24.15 --name 2nd-kind --kubeconfig 2nd-kind | |
kind get clusters | |
- name: Setup 3rd Kind | |
run: | | |
kind create cluster --image kindest/node:v1.21.14 --name 3rd-kind --kubeconfig 3rd-kind | |
kind get clusters | |
- name: E2E Test | |
run: | | |
bin/kubecm version | |
echo "********************************************************************************" | |
echo "Running kubecm add..." | |
echo "********************************************************************************" | |
bin/kubecm add -cf 2nd-kind | |
bin/kubecm add -cf 3rd-kind --context-name 3rd | |
echo "********************************************************************************" | |
echo "Running kubecm merge multiple kubeconfig..." | |
echo "********************************************************************************" | |
bin/kubecm merge -y 2nd-kind 3rd-kind --config multi.config | |
cat multi.config | |
echo "********************************************************************************" | |
echo "Running kubecm merge in dir..." | |
echo "********************************************************************************" | |
mkdir -p tmp/kubecm-merge | |
cp -r 2nd-kind tmp/kubecm-merge/2nd-kind | |
cp -r 3rd-kind tmp/kubecm-merge/3rd-kind | |
bin/kubecm merge -f tmp/kubecm-merge -y --config merge.config | |
cat merge.config | |
echo "********************************************************************************" | |
echo "Running kubecm ls..." | |
echo "********************************************************************************" | |
bin/kubecm list | |
echo "********************************************************************************" | |
echo "Running kubecm switch..." | |
echo "********************************************************************************" | |
bin/kubecm s 3rd | |
echo "********************************************************************************" | |
echo "Running kubecm delete..." | |
echo "********************************************************************************" | |
bin/kubecm d kind-kind | |
echo "********************************************************************************" | |
echo "Running kubecm global flag --config..." | |
echo "********************************************************************************" | |
bin/kubecm s kind-2nd-kind --config merge.config | |
echo "********************************************************************************" | |
echo "Running kubecm list from env KUBECONFIG..." | |
echo "********************************************************************************" | |
echo "default config" | |
bin/kubecm ls | |
echo "set env" | |
export KUBECONFIG="$PWD/multi.config" | |
bin/kubecm s kind-3rd-kind |