Skip to content

Cloud Installer And Upgrade Test Ref:v2.1.0-alpha.175 #1224

Cloud Installer And Upgrade Test Ref:v2.1.0-alpha.175

Cloud Installer And Upgrade Test Ref:v2.1.0-alpha.175 #1224

name: Cloud E2E Installer
on:
workflow_dispatch:
inputs:
CLOUD_BRANCH:
description: "The cloud branch name (e.g. main) "
type: string
required: false
default: 'main'
K3S_VERSION:
description: 'k3s cluster version (e.g. 1.32)'
type: string
required: false
default: '1.32'
CURRENT_VERSION:
description: "The current release version (e.g. v0.30) "
type: string
required: false
default: ''
APECD_REF:
description: "The branch name of apecloud-cd"
type: string
required: false
default: 'main'
workflow_call:
inputs:
CLOUD_BRANCH:
description: "The cloud branch name (e.g. main) "
type: string
required: false
default: 'main'
K3S_VERSION:
description: 'k3s cluster version (e.g. 1.32)'
type: string
required: false
default: '1.32'
CURRENT_VERSION:
description: "The current release version (e.g. v0.30) "
type: string
required: false
default: ''
APECD_REF:
description: "The branch name of apecloud-cd"
type: string
required: false
default: 'main'
run-name: Cloud Installer And Upgrade Test Ref:${{ inputs.CLOUD_BRANCH }}
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
K3D_NAME: kbcloud
CLOUD_LICENSE: ${{ secrets.CLOUD_LICENSE }}
DOCKER_REGISTRY_URL: docker.io
DOCKER_REGISTRY_URL_INDEX: "https://index.docker.io/v1/"
DOCKER_REGISTRY_USER: ${{ secrets.DOCKER_REGISTRY_USER }}
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
JIHULAB_ACCESS_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }}
JIHULAB_ACCESS_USER: ${{ secrets.GITLAB_ACCESS_USER }}
PROJECT_ID: 165897
UPGRADE_RESULT: 0
jobs:
get-cloud-branch:
runs-on: ubuntu-latest
outputs:
cloud-branch: ${{ steps.get_cloud_branch.outputs.cloud-branch }}
steps:
- name: Get cloud branch
id: get_cloud_branch
run: |
CLOUD_BRANCH="${{ inputs.CLOUD_BRANCH }}"
if [[ -z "$CLOUD_BRANCH" ]]; then
CLOUD_BRANCH="main"
fi
echo cloud-branch="$CLOUD_BRANCH" >> $GITHUB_OUTPUT
installer-test:
name: installer-test-${{ matrix.k3s-version }}
needs: [ get-cloud-branch ]
runs-on: ubuntu-latest
outputs:
installer-result-1-22: ${{ steps.install_kb_cloud.outputs.installer-result-1-22 }}
bootstrapper-result-1-22: ${{ steps.deploy_kb_cloud_env.outputs.bootstrapper-result-1-22 }}
installer-result-1-32: ${{ steps.install_kb_cloud.outputs.installer-result-1-32 }}
bootstrapper-result-1-32: ${{ steps.deploy_kb_cloud_env.outputs.bootstrapper-result-1-32 }}
strategy:
fail-fast: false
matrix:
k3s-version: [ v1.22, v1.32 ]
steps:
- name: Free disk space
continue-on-error: true
run: |
echo "Free space first:"
df -h
mnt_storage=$(df -h | (grep "/mnt" | grep "100%" ||true))
if [[ -n "${mnt_storage}" ]]; then
echo "Disk is full, please rerun the workflow."
exit 1
fi
sudo mkdir -p /mnt/new-storage
sudo touch /etc/docker/daemon.json
sudo tee /etc/docker/daemon.json <<EOF
{
"data-root": "/mnt/new-storage"
}
EOF
sudo systemctl restart docker
echo "Free space second:"
df -h
- name: Checkout apecloud-cd Code
uses: actions/checkout@v4
with:
repository: apecloud/apecloud-cd
path: apecloud-cd
ref: ${{ inputs.APECD_REF }}
- name: Setup kubectl
uses: azure/setup-kubectl@v3
with:
version: "v1.30.4"
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: "v3.16.3"
- name: setup k3d k3s
uses: apecloud-inc/setup-k3d-k3s@v2
with:
k3d-name: "${{ env.K3D_NAME }}"
version: "${{ matrix.k3s-version }}"
github-token: ${{ env.GH_TOKEN }}
k3d-args: -p 443:443@loadbalancer -p 80:80@loadbalancer --agents 3
- name: update k3d coredns cm
run: |
for i in {1..3}; do
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh --type 37
sleep 1
done
- name: install cert-manager
run: |
helm repo add jetstack https://charts.jetstack.io --force-update
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--version v1.16.0 \
--set crds.enabled=true
- name: install kb cloud
run: |
helm repo add kb-chart https://apecloud.github.io/helm-charts
helm install installer kb-chart/kb-cloud-installer \
--namespace kb-cloud \
--create-namespace \
--version ${{ needs.get-cloud-branch.outputs.cloud-branch }} \
--set image.registry="docker.io" \
--set version=${{ needs.get-cloud-branch.outputs.cloud-branch }} \
--set kubernetesProvider=k3d \
--set fqdn.domain=mytest.kubeblocks.com \
--set tls.enabled=true \
--set ingress.routeType="host" \
--set metaDB.zalandoOperator.clusterConfig.resources.requests.cpu="100m" \
--set metaDB.zalandoOperator.clusterConfig.resources.requests.memory="128Mi"
- if: ${{ env.DOCKER_REGISTRY_USER != '' && env.DOCKER_REGISTRY_PASSWORD != '' }}
name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY_URL }}
username: ${{ env.DOCKER_REGISTRY_USER }}
password: ${{ env.DOCKER_REGISTRY_PASSWORD }}
- name: check kb-cloud-installer pod Completed
id: install_kb_cloud
run: |
sleep 10
check_status=0
for i in {1..200}; do
if kubectl get pods -n kb-cloud | grep "kb-cloud-installer" | grep Completed ; then
echo "KB Cloud is ready"
check_status=1
break
fi
echo "Waiting for KB Cloud to be ready..."
kubectl get pods -n kb-cloud
echo ""
sleep 5
done
installer_result="[PASSED]"
K3S_VERSION="${{ matrix.k3s-version }}"
if [[ $check_status -eq 0 ]]; then
echo "KB Cloud is not ready"
installer_result="[FAILED]"
case $K3S_VERSION in
v1.22)
echo installer-result-1-22="${installer_result}" >> $GITHUB_OUTPUT
;;
v1.32)
echo installer-result-1-32="${installer_result}" >> $GITHUB_OUTPUT
;;
esac
installer_pods=$(kubectl get pods -n kb-cloud | (grep "kb-cloud-installer" || true) )
echo "installer pod: $installer_pods"
installer_pod_names="$(echo "${installer_pods}" | awk '{print $1}')"
for installer_pod_name in $(echo "${installer_pod_names}"); do
echo "==================== pod ${installer_pod_name} logs ===================="
kubectl logs --tail 100 -n kb-cloud ${installer_pod_name}
done
# logs kb-cloud error pod
kb_cloud_error_pods=$(kubectl get pods -n kb-cloud | (grep -v "kb-cloud-installer" | grep -v "Completed" | grep -v "Running" | grep -v "NAME" | grep -v "ImagePull" || true) | awk '{print $1}')
echo "kb-cloud error pod: $kb_cloud_error_pods"
for kb_cloud_error_pod in $(echo "${kb_cloud_error_pods}"); do
echo "==================== pod ${kb_cloud_error_pod} logs ===================="
kubectl logs --tail 100 -n kb-cloud ${kb_cloud_error_pod}
echo ""
done
exit 1
else
case $K3S_VERSION in
v1.22)
echo installer-result-1-22="${installer_result}" >> $GITHUB_OUTPUT
;;
v1.32)
echo installer-result-1-32="${installer_result}" >> $GITHUB_OUTPUT
;;
esac
fi
- name: deploy KB Cloud Env
if: ${{ inputs.CURRENT_VERSION != 'v0.28' && inputs.CURRENT_VERSION != '0.28' }}
run: |
echo "get k8s config"
k8s_cluster_name=$(kubectl config get-clusters | sed '1d')
kubectl config set-cluster ${k8s_cluster_name} --insecure-skip-tls-verify=true
k8s_kubeconfig_yaml=$(kubectl config view --minify -o yaml --raw)
kubeconfig_file_name="k8s_kubeconfig_file.yaml"
touch ${kubeconfig_file_name}
echo "${k8s_kubeconfig_yaml}" > ${kubeconfig_file_name}
yq e -i '.clusters[0].cluster.server = "https://kubernetes.default:443"' ${kubeconfig_file_name}
k8s_kubeconfig=$(cat ${kubeconfig_file_name})
echo "------------------------------------------------------------"
echo "${k8s_kubeconfig}"
echo "------------------------------------------------------------"
K8S_KUBECONFIG="$(echo "${k8s_kubeconfig}" | base64)"
CLOUD_LICENSE="${{ env.CLOUD_LICENSE }}"
echo "deploy KB Cloud Env"
helm install bootstrapper kb-chart/kb-cloud-bootstrapper \
--namespace kb-system \
--create-namespace \
--version ${{ needs.get-cloud-branch.outputs.cloud-branch }} \
--set image.registry="docker.io" \
--set license="${CLOUD_LICENSE}" \
--set kubeconfig="${K8S_KUBECONFIG}"
- name: check kb-cloud-bootstrapper pod Completed
if: ${{ inputs.CURRENT_VERSION != 'v0.28' && inputs.CURRENT_VERSION != '0.28' }}
id: deploy_kb_cloud_env
run: |
sleep 10
kubectl create secret docker-registry kb-addon-test-registry-key \
--docker-server="${{ env.DOCKER_REGISTRY_URL_INDEX }}" \
--docker-username='${{ env.DOCKER_REGISTRY_USER }}' \
--docker-password='${{ env.DOCKER_REGISTRY_PASSWORD }}' \
--docker-email="" -n kb-system
check_status=0
patch_sa_flag=0
cloud_e2e_installer_script="${{ github.workspace }}/apecloud-cd/.github/utils/cloud_e2e_installer.sh"
if [[ -f "${cloud_e2e_installer_script}" ]]; then
echo "update kb-monitor resources"
bash ${cloud_e2e_installer_script} &
fi
for i in {1..200}; do
if kubectl get pods -n kb-system | grep "kb-cloud-bootstrapper" | grep Completed ; then
echo "KB Cloud Env is ready"
check_status=1
break
fi
echo "Waiting for KB Cloud Env to be ready..."
kubectl get pods -n kb-system
KB_ADDON_SA="$(kubectl get serviceaccounts -n kb-system | (grep "kubeblocks-addon-installer" || true) | awk 'NR==1{print $1}')"
if [[ -n "${KB_ADDON_SA}" && ${patch_sa_flag} -eq 0 ]]; then
echo "patch serviceaccount kubeblocks-addon-installer..."
for i in {1..5}; do
kubectl patch -p '{"imagePullSecrets":[{"name":"kb-addon-test-registry-key"}]}' \
--type=merge serviceaccount -n kb-system kubeblocks-addon-installer
patch_ret=$?
if [[ $patch_ret -eq 0 ]]; then
echo "$(tput -T xterm setaf 2)patch serviceaccount kubeblocks-addon-installer success $(tput -T xterm sgr0)"
patch_sa_flag=1
break
fi
echo "Waiting for patch serviceaccount kubeblocks-addon-installer..."
sleep 1
done
fi
echo ""
sleep 5
done
bootstrapper_result="[PASSED]"
K3S_VERSION="${{ matrix.k3s-version }}"
if [[ $check_status -eq 0 ]]; then
echo "==================== describe node ===================="
kubectl describe node
df -h
echo "KB Cloud Env is not ready"
bootstrapper_result="[FAILED]"
case $K3S_VERSION in
v1.22)
echo bootstrapper-result-1-22="${bootstrapper_result}" >> $GITHUB_OUTPUT
;;
v1.32)
echo bootstrapper-result-1-32="${bootstrapper_result}" >> $GITHUB_OUTPUT
;;
esac
bootstrapper_pods=$(kubectl get pods -n kb-system | (grep "kb-cloud-bootstrapper" || true) )
echo "bootstrapper pod: $bootstrapper_pods"
bootstrapper_pod_names="$(echo "${bootstrapper_pods}" | grep -v "ImagePull" | awk '{print $1}')"
for bootstrapper_pod_name in $(echo "${bootstrapper_pod_names}"); do
echo "==================== pod ${bootstrapper_pod_name} logs ===================="
kubectl logs --tail 100 -n kb-system ${bootstrapper_pod_name}
done
# describe image pull error bootstrapper pod
bootstrapper_pod_names="$(echo "${bootstrapper_pods}" | (egrep "ImagePull|Pending|Evicted" || true) | awk '{print $1}')"
for bootstrapper_pod_name in $(echo "${bootstrapper_pod_names}"); do
echo "==================== pod ${bootstrapper_pod_name} describe ===================="
kubectl describe pod -n kb-system ${bootstrapper_pod_name}
done
# logs kb-system error pod
set +e
set -o nounset
kb_system_error_pods=$(kubectl get pods -n kb-system | (grep -v "kb-cloud-bootstrapper" | grep -v "Completed" | grep -v "Evicted" | grep -v "Running" | grep -v "NAME" | grep -v "ImagePull" || true) | awk '{print $1}')
echo "kb-system error pod: $kb_system_error_pods"
for kb_system_error_pod in $(echo "${kb_system_error_pods}"); do
echo "==================== pod ${kb_system_error_pod} logs ===================="
kubectl logs --tail 100 -n kb-system ${kb_system_error_pod}
echo ""
done
# describe image pull error kb-system pod
kb_system_error_pods=$(kubectl get pods -n kb-system | (grep -v "kb-cloud-bootstrapper" | grep -v "Completed" | grep -v "Running" | grep -v "NAME" | egrep "ImagePull|Pending|Evicted" || true) | awk '{print $1}')
echo "kb-system image pull error pod: $kb_system_error_pods"
for kb_system_error_pod in $(echo "${kb_system_error_pods}"); do
echo "==================== pod ${kb_system_error_pod} describe ===================="
kubectl describe pod -n kb-system ${kb_system_error_pod}
echo ""
done
set -e
exit 1
else
case $K3S_VERSION in
v1.22)
echo bootstrapper-result-1-22="${bootstrapper_result}" >> $GITHUB_OUTPUT
;;
v1.32)
echo bootstrapper-result-1-32="${bootstrapper_result}" >> $GITHUB_OUTPUT
;;
esac
fi
upgrade-test:
needs: [ get-cloud-branch ]
runs-on: ubuntu-latest
outputs:
installer-result: ${{ steps.install_kb_cloud.outputs.installer-result }}
upgrade-result: ${{ steps.upgrade_kb_cloud.outputs.upgrade-result }}
cloud-pre-version: ${{ steps.cloud_pre_version.outputs.cloud-pre-version }}
steps:
- name: Free disk space
continue-on-error: true
run: |
echo "Free space first:"
df -h
mnt_storage=$(df -h | (grep "/mnt" | grep "100%" ||true))
if [[ -n "${mnt_storage}" ]]; then
echo "Disk is full, please rerun the workflow."
exit 1
fi
sudo mkdir -p /mnt/new-storage
sudo touch /etc/docker/daemon.json
sudo tee /etc/docker/daemon.json <<EOF
{
"data-root": "/mnt/new-storage"
}
EOF
sudo systemctl restart docker
echo "Free space second:"
df -h
- name: Checkout apecloud-cd Code
uses: actions/checkout@v4
with:
repository: apecloud/apecloud-cd
path: apecloud-cd
ref: ${{ inputs.APECD_REF }}
- name: Setup kubectl
uses: azure/setup-kubectl@v3
with:
version: "v1.30.4"
- name: Install Helm
uses: azure/setup-helm@v3
with:
version: "v3.16.3"
- name: setup k3d k3s
uses: apecloud-inc/setup-k3d-k3s@v2
with:
k3d-name: "${{ env.K3D_NAME }}"
version: "v${{ inputs.K3S_VERSION }}"
github-token: ${{ env.GH_TOKEN }}
k3d-args: -p 443:443@loadbalancer -p 80:80@loadbalancer --agents 3
- name: update k3d coredns cm
run: |
for i in {1..3}; do
bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh --type 37
sleep 1
done
- name: install cert-manager
run: |
helm repo add jetstack https://charts.jetstack.io --force-update
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--create-namespace \
--version v1.16.0 \
--set crds.enabled=true
- name: get cloud pre version
id: cloud_pre_version
run: |
UPGRADE_VERSION="${{ needs.get-cloud-branch.outputs.cloud-branch }}"
if [[ "$UPGRADE_VERSION" != "v"* ]]; then
UPGRADE_VERSION="v${UPGRADE_VERSION}"
fi
CLOUD_PRE_VERSION=$(bash ${{ github.workspace }}/apecloud-cd/.github/utils/utils.sh --type 39 \
--github-repo "apecloud/apecloud" \
--github-token "${{ env.GH_TOKEN }}" \
--version "${UPGRADE_VERSION}")
echo "CLOUD_PRE_VERSION:$CLOUD_PRE_VERSION"
echo "cloud-pre-version=${CLOUD_PRE_VERSION}" >> $GITHUB_OUTPUT
- name: install kb cloud with ${{ steps.cloud_pre_version.outputs.cloud-pre-version }}
run: |
helm repo add kb-chart https://apecloud.github.io/helm-charts
CLOUD_PRE_VERSION="${{ steps.cloud_pre_version.outputs.cloud-pre-version }}"
HELM_CHART_PKG_NAME="kb-cloud-installer-${CLOUD_PRE_VERSION/v/}.tgz"
helm_pull_cmd="helm pull kb-chart/kb-cloud-installer --version ${CLOUD_PRE_VERSION}"
for i in {1..200}; do
eval "$helm_pull_cmd" || true
# check helm chart package
echo "helm chart package checking..."
if [[ -f "${HELM_CHART_PKG_NAME}" ]]; then
echo "found helm chart package ${HELM_CHART_PKG_NAME}"
break
fi
sleep 1
helm repo update kb-chart
done
helm install installer kb-chart/kb-cloud-installer \
--namespace kb-cloud \
--create-namespace \
--version "${CLOUD_PRE_VERSION}" \
--set "version=${CLOUD_PRE_VERSION}" \
--set image.registry="docker.io" \
--set kubernetesProvider=k3d \
--set fqdn.domain=mytest.kubeblocks.com \
--set tls.enabled=true \
--set ingress.routeType="host" \
--set metaDB.zalandoOperator.clusterConfig.resources.requests.cpu="100m" \
--set metaDB.zalandoOperator.clusterConfig.resources.requests.memory="128Mi"
- name: check kb-cloud-installer pod Completed
id: install_kb_cloud
run: |
sleep 10
check_status=0
for i in {1..200}; do
if kubectl get pods -n kb-cloud | grep "kb-cloud-installer" | grep Completed ; then
echo "KB Cloud is ready"
check_status=1
break
fi
echo "Waiting for KB Cloud to be ready..."
kubectl get pods -n kb-cloud
echo ""
sleep 5
done
installer_result="[PASSED]"
if [[ $check_status -eq 0 ]]; then
echo "KB Cloud is not ready"
installer_result="[FAILED]"
echo installer-result="${installer_result}" >> $GITHUB_OUTPUT
installer_pods=$(kubectl get pods -n kb-cloud | (grep "kb-cloud-installer" || true) )
echo "installer pod: $installer_pods"
installer_pod_names="$(echo "${installer_pods}" | awk '{print $1}')"
for installer_pod_name in $(echo "${installer_pod_names}"); do
echo "==================== pod ${installer_pod_name} logs ===================="
kubectl logs --tail 100 -n kb-cloud ${installer_pod_name}
done
# logs kb-cloud error pod
kb_cloud_error_pods=$(kubectl get pods -n kb-cloud | (grep -v "kb-cloud-installer" | grep -v "Completed" | grep -v "Running" | grep -v "NAME" | grep -v "ImagePull" || true) | awk '{print $1}')
echo "kb-cloud error pod: $kb_cloud_error_pods"
for kb_cloud_error_pod in $(echo "${kb_cloud_error_pods}"); do
echo "==================== pod ${kb_cloud_error_pod} logs ===================="
kubectl logs --tail 100 -n kb-cloud ${kb_cloud_error_pod}
echo ""
done
exit 1
else
echo installer-result="${installer_result}" >> $GITHUB_OUTPUT
fi
- name: upgrade kb cloud to ${{ needs.get-cloud-branch.outputs.cloud-branch }}
run: |
echo "add helm chart repo"
helm repo add kubeblocks-enterprise \
--username ${JIHULAB_ACCESS_USER} \
--password ${JIHULAB_ACCESS_TOKEN} \
https://jihulab.com/api/v4/projects/${PROJECT_ID}/packages/helm/stable
echo "update helm chart repo"
helm repo update kubeblocks-enterprise
echo "upgrade kubeblocks cloud"
CLOUD_VERSION="${{ needs.get-cloud-branch.outputs.cloud-branch }}"
if [[ "${CLOUD_VERSION}" == "v2.1."* ]]; then
helm upgrade --install kb-cloud kubeblocks-enterprise/kubeblocks-cloud \
--version ${CLOUD_VERSION} --namespace kb-cloud \
--set images.apiserver.tag=${CLOUD_VERSION} \
--set images.cr4w.tag=${CLOUD_VERSION} \
--set images.openconsole.tag=${CLOUD_VERSION} \
--set images.openconsoleAdmin.tag=${CLOUD_VERSION} \
--set images.hook.tag=${CLOUD_VERSION} \
--set images.cubetranFront.tag=${CLOUD_VERSION} \
--set grafana.global.imageRegistry='' \
--set grafana.image.repository='apecloud/grafana' \
--reset-then-reuse-values
else
helm upgrade --install kb-cloud kubeblocks-enterprise/kubeblocks-cloud \
--version ${CLOUD_VERSION} --namespace kb-cloud \
--set images.apiserver.tag=${CLOUD_VERSION} \
--set images.cr4w.tag=${CLOUD_VERSION} \
--set images.openconsole.tag=${CLOUD_VERSION} \
--set images.openconsoleAdmin.tag=${CLOUD_VERSION} \
--set images.hook.tag=${CLOUD_VERSION} \
--set images.cubetranFront.tag=${CLOUD_VERSION} \
--reset-then-reuse-values
fi
upgrade_ret=$?
if [[ $upgrade_ret -eq 0 ]]; then
echo UPGRADE_RESULT=1 >> $GITHUB_ENV
fi
- name: check upgrade result
if: ${{ always() }}
id: upgrade_kb_cloud
run: |
upgrade_result="[PASSED]"
sleep 10
check_status=0
for i in {1..200}; do
if ! (kubectl get pods -n kb-cloud --no-headers | grep -v "Running" | grep -v "Completed") ; then
echo "KB Cloud is ready"
check_status=1
break
fi
echo "Waiting for KB Cloud to be ready..."
kubectl get pods -n kb-cloud
echo ""
sleep 5
done
if [[ $check_status -eq 0 ]]; then
echo "==================== describe node ===================="
kubectl describe node
df -h
echo "KB Cloud is not ready"
upgrade_result="[FAILED]"
echo upgrade-result="${upgrade_result}" >> $GITHUB_OUTPUT
# logs kb-cloud error pod
kb_cloud_error_pods=$(kubectl get pods -n kb-cloud --no-headers | grep -v "Completed" | grep -v "Running" | awk '{print $1}')
echo "kb-cloud error pod: $kb_cloud_error_pods"
for kb_cloud_error_pod in $(echo "${kb_cloud_error_pods}"); do
echo "==================== pod ${kb_cloud_error_pod} logs ===================="
kubectl logs --tail 100 -n kb-cloud ${kb_cloud_error_pod}
echo ""
done
exit 1
else
echo upgrade-result="${upgrade_result}" >> $GITHUB_OUTPUT
fi
if [[ "${UPGRADE_RESULT}" != "1" ]]; then
echo "upgrade KB Cloud failed"
upgrade_result="[FAILED]"
echo upgrade-result="${upgrade_result}" >> $GITHUB_OUTPUT
exit 1
fi
send-message:
needs: [ get-cloud-branch, installer-test, upgrade-test ]
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Checkout apecloud-cd Code
uses: actions/checkout@v4
with:
repository: apecloud/apecloud-cd
ref: ${{ inputs.APECD_REF }}
- name: send test result message
run: |
CLOUD_BRANCH="${{ needs.get-cloud-branch.outputs.cloud-branch }}"
TEST_RESULT=""
echo "get installer test result"
INSTALLER_RESULT_1_21="${{ needs.installer-test.outputs.installer-result-1-22 }}"
INSTALLER_RESULT_1_32="${{ needs.installer-test.outputs.installer-result-1-32 }}"
if [[ -z "${INSTALLER_RESULT_1_21}" ]]; then
INSTALLER_RESULT_1_21="[FAILED]"
fi
if [[ -z "${INSTALLER_RESULT_1_32}" ]]; then
INSTALLER_RESULT_1_32="[FAILED]"
fi
BOOTSTRAPPER_RESULT_1_21="${{ needs.installer-test.outputs.bootstrapper-result-1-22 }}"
BOOTSTRAPPER_RESULT_1_32="${{ needs.installer-test.outputs.bootstrapper-result-1-32 }}"
if [[ -z "${BOOTSTRAPPER_RESULT_1_21}" ]]; then
BOOTSTRAPPER_RESULT_1_21="[FAILED]"
fi
if [[ -z "${BOOTSTRAPPER_RESULT_1_32}" ]]; then
BOOTSTRAPPER_RESULT_1_32="[FAILED]"
fi
echo "get upgrade test result"
CLOUD_PRE_VERSION="${{ needs.upgrade-test.outputs.cloud-pre-version }}"
INSTALLER_PRE_RESULT="${{ needs.upgrade-test.outputs.installer-result }}"
if [[ -z "${INSTALLER_PRE_RESULT}" ]]; then
INSTALLER_PRE_RESULT="[FAILED]"
fi
UPGRADE_RESULT="${{ needs.upgrade-test.outputs.upgrade-result }}"
if [[ -z "${UPGRADE_RESULT}" ]]; then
UPGRADE_RESULT="[FAILED]"
fi
TEST_RESULT="installer-test-v1.22|v1.22|installer-${CLOUD_BRANCH}|${INSTALLER_RESULT_1_21}"
if [[ "${{ inputs.CURRENT_VERSION }}" != 'v0.28' && "${{ inputs.CURRENT_VERSION }}" != '0.28' ]]; then
TEST_RESULT="${TEST_RESULT}##installer-test-v1.22|v1.22|bootstrapper-${CLOUD_BRANCH}|${BOOTSTRAPPER_RESULT_1_21}"
TEST_RESULT="${TEST_RESULT}##installer-test-v1.32|v1.32|installer-${CLOUD_BRANCH}|${INSTALLER_RESULT_1_32}"
TEST_RESULT="${TEST_RESULT}##installer-test-v1.32|v1.32|bootstrapper-${CLOUD_BRANCH}|${BOOTSTRAPPER_RESULT_1_32}"
else
TEST_RESULT="${TEST_RESULT}##installer-test-v1.32|v1.32|installer-${CLOUD_BRANCH}|${INSTALLER_RESULT_1_32}"
fi
TEST_RESULT="${TEST_RESULT}##upgrade-test|v${{ inputs.K3S_VERSION }}|installer-${CLOUD_PRE_VERSION}|${INSTALLER_PRE_RESULT}"
TEST_RESULT="${TEST_RESULT}##upgrade-test|v${{ inputs.K3S_VERSION }}|upgrade-${CLOUD_BRANCH}|${UPGRADE_RESULT}"
echo "TEST_RESULT:${TEST_RESULT}"
TEST_RESULT=$( bash .github/utils/utils.sh --type 38 \
--github-repo "${{ github.repository }}" \
--github-token "${{ env.GH_TOKEN }}" \
--test-result "${TEST_RESULT}" \
--run-id "$GITHUB_RUN_ID" )
echo "TEST_RESULT:$TEST_RESULT"
export TZ='Asia/Shanghai'
date_ret=$(date +%Y-%m-%d-%T)
TEST_TITLE="[${CLOUD_BRANCH}] Cloud Installer & Upgrade [${date_ret}]"
python3 .github/utils/send_mesage.py \
--send-type installer \
--url "${{ vars.CLOUD_E2E_BOT_WEBHOOK }}" \
--title "$TEST_TITLE" \
--result "$TEST_RESULT"