Skip to content

Commit

Permalink
fix workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
chengxiangdong committed Aug 19, 2024
1 parent d602479 commit fdf3e20
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: run e2e
run: |
export ARTIFACTS_PATH=${{ github.workspace }}/e2e-logs
sh hack/run-e2e.sh
./hack/run-e2e.sh
- name: upload logs
if: always()
uses: actions/upload-artifact@v3
Expand Down
2 changes: 2 additions & 0 deletions hack/deploy/huawei-cloud-controller-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ spec:
effect: NoSchedule
- key: node-role.kubernetes.io/control-plane
effect: NoSchedule
- key: node-role.kubernetes.io/controlplane
effect: NoSchedule
serviceAccountName: cloud-controller-manager
containers:
- name: huawei-cloud-controller-manager
Expand Down
23 changes: 13 additions & 10 deletions hack/pre-run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,33 @@ export REGISTRY_SERVER_ADDRESS=swr.ap-southeast-1.myhuaweicloud.com
export REGISTRY=${REGISTRY_SERVER_ADDRESS}/cloud-native
export VERSION=v$(echo $RANDOM | sha1sum |cut -c 1-5)

echo -e "\nBuild images"
echo -e "\n:::::: Check KUBECONFIG ::::::"
echo "KUBECONFIG="$KUBECONFIG

echo -e "\n:::::: Check cloud-config Secret ::::::"
count=$(kubectl get -n kube-system secret | grep cloud-config | wc -l)
if [[ "$count" -ne 1 ]]; then
echo ":::::: Please create the cloud-config secret."
exit 1
fi

echo -e "\n:::::: Build images ::::::"
# todo: Maybe we need load the image to target cluster node.
make image-huawei-cloud-controller-manager

tmpPath=$(mktemp -d)
is_containerd=`command -v containerd`
is_containerd=$(command -v containerd)
echo "is_containerd: ${is_containerd}"
if [[ -x ${is_containerd} ]]; then
docker save -o "${tmpPath}/huawei-cloud-controller-manager.tar" ${REGISTRY}/huawei-cloud-controller-manager:${VERSION}
ctr -n=k8s.io i import ${tmpPath}/huawei-cloud-controller-manager.tar
rm -rf ${tmpPath}/huawei-cloud-controller-manager.tar
fi

echo -e "\nCheck cloud-config secret"
count=`kubectl get -n kube-system secret cloud-config | grep cloud-config | wc -l`
if [[ "$count" -ne 1 ]]; then
echo "Please create the cloud-config secret."
exit 1
fi

# Remove the existing provider if it exists.
kubectl delete -n kube-system deployment --ignore-not-found=true huawei-cloud-controller-manager

echo -e "\nDeploy huawei-cloud-controller-manager"
echo -e "\n:::::: Deploy huawei-cloud-controller-manager ::::::"

REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
image_url=${REGISTRY}/huawei-cloud-controller-manager:${VERSION}
Expand Down
8 changes: 4 additions & 4 deletions hack/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ GOPATH=$(go env GOPATH | awk -F ':' '{print $1}')
export PATH=$PATH:$GOPATH/bin

# Pre run e2e for extra components
echo -e "\nRun pre run e2e"
echo -e "\n:::::: Run pre run e2e ::::::"
"${REPO_ROOT}"/hack/pre-run-e2e.sh

# Run e2e
echo -e "\nRun e2e"
echo -e "\n:::::: Run e2e ::::::"
set +e
ginkgo -v --race --trace --fail-fast -p --randomize-all ./test/e2e/
TESTING_RESULT=$?

# Collect logs
kubectl logs deployment/huawei-cloud-controller-manager -n kube-system > ${ARTIFACTS_PATH}/huawei-cloud-controller-manager.log
echo -e "\nCollected logs at ${ARTIFACTS_PATH}:"
echo -e "\n:::::: Collected logs at ${ARTIFACTS_PATH}:"

# Post run e2e for delete extra components
echo -e "\nRun post run e2e"
echo -e "\n:::::: Run post run e2e ::::::"
"${REPO_ROOT}"/hack/post-run-e2e.sh

exit $TESTING_RESULT

0 comments on commit fdf3e20

Please sign in to comment.