Merge pull request #8819 from medyagh/build_kic_gh
ci: test kic image changes in github actionpull/8828/head^2
commit
0ad2e34314
|
@ -0,0 +1,115 @@
|
|||
name: KIC_IMAGE
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "hack/images/**"
|
||||
env:
|
||||
GOPROXY: https://proxy.golang.org
|
||||
jobs:
|
||||
build_test_kic_image:
|
||||
runs-on: [self-hosted, Ubuntu, kvm, iso]
|
||||
steps:
|
||||
- name: Clean up workspace
|
||||
shell: bash
|
||||
run: |
|
||||
pwd
|
||||
ls -lah
|
||||
rm -rf out
|
||||
ls -lah
|
||||
df -h
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '1.14.6'
|
||||
stable: true
|
||||
- name: Download Dependencies
|
||||
run: go mod download
|
||||
- name: Build Binaries
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y make build-essential
|
||||
make linux
|
||||
make e2e-linux-amd64
|
||||
cp -r test/integration/testdata ./out
|
||||
whoami
|
||||
echo github ref $GITHUB_REF
|
||||
echo workflow $GITHUB_WORKFLOW
|
||||
echo home $HOME
|
||||
echo event name $GITHUB_EVENT_NAME
|
||||
echo workspace $GITHUB_WORKSPACE
|
||||
echo "end of debug stuff"
|
||||
echo $(which jq)
|
||||
- name: Build Image
|
||||
run: |
|
||||
sudo apt-get install -y docker.io
|
||||
make kic-base-image
|
||||
docker images
|
||||
- name: Install kubectl
|
||||
shell: bash
|
||||
run: |
|
||||
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
|
||||
sudo install kubectl /usr/local/bin/kubectl
|
||||
kubectl version --client=true
|
||||
- name: Install gopogh
|
||||
shell: bash
|
||||
run: |
|
||||
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.2.4/gopogh-linux-amd64
|
||||
sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
|
||||
sudo apt-get install -y jq
|
||||
- name: Install docker
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get install -y docker.io
|
||||
- name: Run Integration Test
|
||||
continue-on-error: false
|
||||
# bash {0} to allow test to continue to next step. in case of
|
||||
shell: bash {0}
|
||||
run: |
|
||||
cd out
|
||||
mkdir -p report
|
||||
mkdir -p testhome
|
||||
chmod a+x e2e-*
|
||||
chmod a+x minikube-*
|
||||
START_TIME=$(date -u +%s)
|
||||
KIC_VERSION=$(egrep "Version =" pkg/drivers/kic/types.go | cut -d \" -f2)
|
||||
KIC_IMG_HEAD="local/kicbase:${KIC_VERSION}-snapshot"
|
||||
KUBECONFIG=$(pwd)/testhome/kubeconfig MINIKUBE_HOME=$(pwd)/testhome ./e2e-linux-amd64 -minikube-start-args="--vm-driver=docker --base-image=${KIC_IMG_HEAD}" -test.v -binary=./minikube-linux-amd64 2>&1 | tee ./report/testout.txt
|
||||
END_TIME=$(date -u +%s)
|
||||
TIME_ELAPSED=$(($END_TIME-$START_TIME))
|
||||
min=$((${TIME_ELAPSED}/60))
|
||||
sec=$((${TIME_ELAPSED}%60))
|
||||
TIME_ELAPSED="${min} min $sec seconds "
|
||||
echo ::set-env name=TIME_ELAPSED::${TIME_ELAPSED}
|
||||
- name: Generate HTML Report
|
||||
shell: bash
|
||||
run: |
|
||||
cd out
|
||||
export PATH=${PATH}:`go env GOPATH`/bin
|
||||
go tool test2json -t < ./report/testout.txt > ./report/testout.json || true
|
||||
STAT=$(gopogh -in ./report/testout.json -out ./report/testout.html -name "${JOB_NAME} ${GITHUB_REF}" -repo "${GITHUB_REPOSITORY}" -details "${GITHUB_SHA}") || true
|
||||
echo status: ${STAT}
|
||||
FailNum=$(echo $STAT | jq '.NumberOfFail')
|
||||
TestsNum=$(echo $STAT | jq '.NumberOfTests')
|
||||
GOPOGH_RESULT="${JOB_NAME} : completed with ${FailNum} / ${TestsNum} failures in ${TIME_ELAPSED}"
|
||||
echo ::set-env name=GOPOGH_RESULT::${GOPOGH_RESULT}
|
||||
echo ::set-env name=STAT::${STAT}
|
||||
- uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: kic_image_functional_test_docker_ubuntu
|
||||
path: out/report
|
||||
- name: The End Result build_test_kic_image_docker_ubuntu
|
||||
shell: bash
|
||||
run: |
|
||||
echo ${GOPOGH_RESULT}
|
||||
numFail=$(echo $STAT | jq '.NumberOfFail')
|
||||
numPass=$(echo $STAT | jq '.NumberOfPass')
|
||||
echo "*******************${numPass} Passes :) *******************"
|
||||
echo $STAT | jq '.PassedTests' || true
|
||||
echo "*******************************************************"
|
||||
echo "---------------- ${numFail} Failures :( ----------------------------"
|
||||
echo $STAT | jq '.FailedTests' || true
|
||||
echo "-------------------------------------------------------"
|
||||
numPass=$(echo $STAT | jq '.NumberOfPass')
|
||||
if [ "$numFail" -gt 0 ];then echo "*** $numFail Failed ***";exit 2;fi
|
||||
if [ "$numPass" -eq 0 ];then echo "*** 0 Passed! ***";exit 2;fi
|
||||
if [ "$numPass" -eq 0 ];then echo "*** Passed! ***";exit 0;fi
|
|
@ -8,6 +8,7 @@ on:
|
|||
- "**.yml"
|
||||
- "**.yaml"
|
||||
- "Makefile"
|
||||
- "!hack/images/**"
|
||||
env:
|
||||
GOPROXY: https://proxy.golang.org
|
||||
jobs:
|
||||
|
|
|
@ -6,6 +6,7 @@ on:
|
|||
- "**.yml"
|
||||
- "**.yaml"
|
||||
- "Makefile"
|
||||
- "!hack/images/**"
|
||||
env:
|
||||
GOPROXY: https://proxy.golang.org
|
||||
jobs:
|
||||
|
|
3
Makefile
3
Makefile
|
@ -532,7 +532,8 @@ storage-provisioner-image: out/storage-provisioner-$(GOARCH) ## Build storage-pr
|
|||
.PHONY: kic-base-image
|
||||
kic-base-image: ## builds the base image used for kic.
|
||||
docker rmi -f $(REGISTRY)/kicbase:$(KIC_VERSION)-snapshot || true
|
||||
docker build -f ./hack/images/kicbase.Dockerfile -t $(REGISTRY)/kicbase:$(KIC_VERSION)-snapshot --build-arg COMMIT_SHA=${VERSION}-$(COMMIT) --cache-from $(REGISTRY)/kicbase:$(KIC_VERSION) --target base ./hack/images
|
||||
docker build -f ./hack/images/kicbase.Dockerfile -t local/kicbase:$(KIC_VERSION)-snapshot --build-arg COMMIT_SHA=${VERSION}-$(COMMIT) --cache-from $(REGISTRY)/kicbase:$(KIC_VERSION) --target base ./hack/images
|
||||
docker tag local/kicbase:$(KIC_VERSION)-snapshot $(REGISTRY)/kicbase:$(KIC_VERSION)-snapshot
|
||||
|
||||
.PHONY: upload-preloaded-images-tar
|
||||
upload-preloaded-images-tar: out/minikube # Upload the preloaded images for oldest supported, newest supported, and default kubernetes versions to GCS.
|
||||
|
|
Loading…
Reference in New Issue