forked from spidernet-io/spiderpool
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: ty-dc <[email protected]>
- Loading branch information
Showing
12 changed files
with
355 additions
and
838 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ on: | |
required: true | ||
default: main | ||
k8s_version: | ||
description: 'should be a released k8s version, format e.g: v1.25.2; if not set, versions 1.22 - 1.26 will be run.)' | ||
description: 'It should be the released version, for example: v1.25.2; if not set, the default version set will be run.' | ||
required: false | ||
type: string | ||
e2e_enabled: | ||
|
@@ -33,52 +33,53 @@ jobs: | |
get_ref: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
ref: ${{ steps.result.outputs.ref }} | ||
e2e_enabled: ${{ steps.get_ref.outputs.e2e_enabled }} | ||
inputs_k8s_version: ${{ steps.get_ref.outputs.inputs_k8s_version }} | ||
default_k8s_version: ${{ steps.get_ref.outputs.default_k8s_version }} | ||
ref: ${{ env.RUN_REF }} | ||
run_push: ${{ env.RUN_PUSH }} | ||
e2e_enabled: ${{ env.RUN_E2E_ENABLED }} | ||
inputs_k8s_version: ${{ env.INPUTS_K8S_VERSION }} | ||
default_k8s_version: ${{ env.DEFAULT_K8S_VERSION }} | ||
steps: | ||
- name: Get Ref | ||
id: get_ref | ||
run: | | ||
if ${{ github.event_name == 'workflow_dispatch' }} ; then | ||
echo "call by self workflow_dispatch" | ||
echo ::set-output name=tag::${{ github.event.inputs.ref }} | ||
echo "RUN_TAG=${{ github.event.inputs.ref }}" >> $GITHUB_ENV | ||
if ${{ github.event.inputs.k8s_version == '' }}; then | ||
echo ::set-output name=inputs_k8s_version::false | ||
echo ::set-output name=default_k8s_version::true | ||
echo "INPUTS_K8S_VERSION=false" >> $GITHUB_ENV | ||
echo "DEFAULT_K8S_VERSION=true" >> $GITHUB_ENV | ||
else | ||
echo "A custom version of k8s will be run: ${{ github.event.inputs.k8s_version }} " | ||
echo ::set-output name=inputs_k8s_version::true | ||
echo ::set-output name=default_k8s_version::false | ||
echo "INPUTS_K8S_VERSION=true" >> $GITHUB_ENV | ||
echo "DEFAULT_K8S_VERSION=false" >> $GITHUB_ENV | ||
fi | ||
if ${{ github.event.inputs.e2e_enabled == 'true' }}; then | ||
echo ::set-output name=e2e_enabled::true | ||
echo "RUN_E2E_ENABLED=true" >> $GITHUB_ENV | ||
else | ||
echo ::set-output name=e2e_enabled::false | ||
echo "RUN_E2E_ENABLED=false" >> $GITHUB_ENV | ||
fi | ||
else | ||
# schedule event | ||
# use main sha for ci image tag | ||
echo "trigger by schedule" | ||
echo ::set-output name=tag::main | ||
echo ::set-output name=push::false | ||
echo ::set-output name=e2e_enabled::true | ||
echo ::set-output name=inputs_k8s_version::false | ||
echo ::set-output name=default_k8s_version::true | ||
echo "RUN_TAG=main" >> $GITHUB_ENV | ||
echo "RUN_PUSH=false" >> $GITHUB_ENV | ||
echo "RUN_E2E_ENABLED=true" >> $GITHUB_ENV | ||
echo "INPUTS_K8S_VERSION=false" >> $GITHUB_ENV | ||
echo "DEFAULT_K8S_VERSION=true" >> $GITHUB_ENV | ||
fi | ||
# some event, the tag is not sha, so checkout it and get sha | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
ref: ${{ steps.get_ref.outputs.tag }} | ||
ref: ${{ env.RUN_TAG }} | ||
|
||
- name: Result Ref | ||
id: result | ||
run: | | ||
ref=$( git show -s --format='format:%H') | ||
echo ::set-output name=ref::${ref} | ||
echo "RUN_REF=${ref}" >> $GITHUB_ENV | ||
call_build_ci_image: | ||
needs: [get_ref] | ||
|
@@ -111,130 +112,14 @@ jobs: | |
# Synchronise with the latest releases of each version | ||
version: [v1.22.7, v1.23.5, v1.24.4, v1.25.3, v1.26.2, v1.27.1] | ||
needs: [call_build_ci_image, get_ref, call_release_chart] | ||
if: ${{ needs.get_ref.outputs.default_k8s_version == 'true' && needs.get_ref.outputs.inputs_k8s_version == 'false' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Prepare | ||
id: prepare | ||
run: | | ||
echo "ref: ${{ needs.get_ref.outputs.ref }} " | ||
echo "===== image " | ||
echo "ci image tag: ghcr.io/${{ github.repository }}/spiderpool-controller-ci:${{ needs.call_build_ci_image.outputs.imageTag }}" | ||
echo "ci race image tag: ghcr.io/${{ github.repository }}/spiderpool-controller-ci:${{ needs.call_build_ci_image.outputs.imageTag }}-race" | ||
echo "ci image tag: ghcr.io/${{ github.repository }}/spiderpool-agent-ci:${{ needs.call_build_ci_image.outputs.imageTag }}" | ||
echo "ci race image tag: ghcr.io/${{ github.repository }}/spiderpool-agent-ci:${{ needs.call_build_ci_image.outputs.imageTag }}-race" | ||
TMP=` date +%m%d%H%M%S ` | ||
E2E_CLUSTER_NAME="spiderpool${TMP}" | ||
echo ::set-output name=clusterName::${E2E_CLUSTER_NAME} | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
ref: ${{ needs.get_ref.outputs.ref }} | ||
|
||
- name: Setup Golang | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.20.0 | ||
id: go | ||
|
||
- name: Install Kind Bin | ||
uses: helm/[email protected] | ||
with: | ||
install_only: true | ||
|
||
- name: Install Tools | ||
run: | | ||
# install kind/p2ctl/helm/ginkgo | ||
bash ./test/scripts/install-tools.sh | ||
- name: Download spiderpool-agent image | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: image-tar-spiderpool-agent | ||
path: test/.download | ||
|
||
- name: Download spiderpool-controller image | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: image-tar-spiderpool-controller | ||
path: test/.download | ||
|
||
- name: Load Images | ||
run: | | ||
TAR_FILES=` ls test/.download ` | ||
echo $TAR_FILES | ||
for ITEM in $TAR_FILES ; do | ||
IMAGE_NAME=${ITEM%*.tar} | ||
echo ${IMAGE_NAME} | ||
cat test/.download/${ITEM} | docker import - ${IMAGE_NAME}:${{ needs.call_build_ci_image.outputs.imageTag }} | ||
done | ||
- name: Setting up a specific version of kind cluster | ||
uses: nick-invision/retry@v2 | ||
with: | ||
timeout_minutes: 10 | ||
max_attempts: 3 | ||
shell: bash | ||
command: | | ||
make e2e_init_underlay_subnet -e E2E_CLUSTER_NAME=${{ steps.prepare.outputs.clusterName }} \ | ||
-e E2E_SPIDERPOOL_TAG=${{ needs.call_build_ci_image.outputs.imageTag }} \ | ||
-e SPIDERPOOL_AGENT_IMAGE_NAME=spiderpool-agent-race \ | ||
-e SPIDERPOOL_CONTROLLER_IMAGE_NAME=spiderpool-controller-race \ | ||
-e E2E_IP_FAMILY=dual -e PYROSCOPE_LOCAL_PORT="" \ | ||
-e E2E_KIND_IMAGE_TAG=${{ matrix.version }} | ||
- name: Run e2e Test | ||
id: run_e2e | ||
if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' }} | ||
continue-on-error: true | ||
run: | | ||
echo ${{ github.event.inputs.labels }} | ||
RESULT=0 | ||
make e2e_test_underlay_subnet -e E2E_CLUSTER_NAME=${{ steps.prepare.outputs.clusterName }} \ | ||
-e E2E_TIMEOUT=${{ env.E2E_TIME_OUT }} || RESULT=1 | ||
if ((RESULT==0)) ; then | ||
echo ::set-output name=pass::true | ||
else | ||
echo ::set-output name=pass::false | ||
fi | ||
if [ -f "test/e2edebugLog" ] ; then | ||
echo ::set-output name=updaloadlog::true | ||
else | ||
echo ::set-output name=updaloadlog::false | ||
fi | ||
if [ -f "./e2ereport.json" ] ; then | ||
echo "error, did not find e2e report" | ||
echo ::set-output name=upload::true | ||
else | ||
echo ::set-output name=upload::false | ||
fi | ||
- name: Upload e2e log | ||
if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' }} | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ matrix.version }}-debuglog.txt | ||
path: test/e2edebugLog.txt | ||
retention-days: 7 | ||
|
||
- name: Upload e2e report | ||
if: ${{ steps.run_e2e.outputs.upload == 'true' && needs.get_ref.outputs.e2e_enabled == 'true' }} | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ matrix.version }}-e2ereport.json | ||
path: e2ereport.json | ||
retention-days: 1 | ||
|
||
- name: Show e2e Result | ||
if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' }} | ||
run: | | ||
if ${{ steps.run_e2e.outputs.pass == 'true' }} ;then | ||
exit 0 | ||
else | ||
exit 1 | ||
fi | ||
uses: ./.github/workflows/e2e-init.yaml | ||
with: | ||
ip_family: ipv4 | ||
image_tag: ${{ needs.call_build_ci_image.outputs.imageTag }} | ||
ref: ${{ needs.get_ref.outputs.ref }} | ||
k8s_version: ${{ matrix.version }} | ||
run_e2e: ${{ needs.get_ref.outputs.e2e_enabled }} | ||
secrets: inherit | ||
|
||
creat_issue: | ||
runs-on: ubuntu-latest | ||
|
@@ -261,126 +146,11 @@ jobs: | |
# workflow_dispatch event flow triggered by running the input k8s version | ||
needs: [call_build_ci_image, get_ref, call_release_chart] | ||
if: ${{ needs.get_ref.outputs.default_k8s_version == 'false' && needs.get_ref.outputs.inputs_k8s_version == 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Prepare | ||
id: prepare | ||
run: | | ||
echo "ref: ${{ needs.get_ref.outputs.ref }} " | ||
echo "===== image " | ||
echo "ci image tag: ghcr.io/${{ github.repository }}/spiderpool-controller-ci:${{ needs.call_build_ci_image.outputs.imageTag }}" | ||
echo "ci race image tag: ghcr.io/${{ github.repository }}/spiderpool-controller-ci:${{ needs.call_build_ci_image.outputs.imageTag }}-race" | ||
echo "ci image tag: ghcr.io/${{ github.repository }}/spiderpool-agent-ci:${{ needs.call_build_ci_image.outputs.imageTag }}" | ||
echo "ci race image tag: ghcr.io/${{ github.repository }}/spiderpool-agent-ci:${{ needs.call_build_ci_image.outputs.imageTag }}-race" | ||
TMP=` date +%m%d%H%M%S ` | ||
E2E_CLUSTER_NAME="spiderpool${TMP}" | ||
echo ::set-output name=clusterName::${E2E_CLUSTER_NAME} | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
ref: ${{ needs.get_ref.outputs.ref }} | ||
|
||
- name: Setup Golang | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.20.0 | ||
id: go | ||
|
||
- name: Install Kind Bin | ||
uses: helm/[email protected] | ||
with: | ||
install_only: true | ||
|
||
- name: Install Tools | ||
run: | | ||
# install kind/p2ctl/helm/ginkgo | ||
bash ./test/scripts/install-tools.sh | ||
- name: Download spiderpool-agent image | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: image-tar-spiderpool-agent | ||
path: test/.download | ||
|
||
- name: Download spiderpool-controller image | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: image-tar-spiderpool-controller | ||
path: test/.download | ||
|
||
- name: Load Images | ||
run: | | ||
TAR_FILES=` ls test/.download ` | ||
echo $TAR_FILES | ||
for ITEM in $TAR_FILES ; do | ||
IMAGE_NAME=${ITEM%*.tar} | ||
echo ${IMAGE_NAME} | ||
cat test/.download/${ITEM} | docker import - ${IMAGE_NAME}:${{ needs.call_build_ci_image.outputs.imageTag }} | ||
done | ||
- name: Setting up a specific version of kind cluster | ||
uses: nick-invision/retry@v2 | ||
with: | ||
timeout_minutes: 10 | ||
max_attempts: 3 | ||
shell: bash | ||
command: | | ||
make e2e_init_underlay_subnet -e E2E_CLUSTER_NAME=${{ steps.prepare.outputs.clusterName }} \ | ||
-e E2E_SPIDERPOOL_TAG=${{ needs.call_build_ci_image.outputs.imageTag }} \ | ||
-e SPIDERPOOL_AGENT_IMAGE_NAME=spiderpool-agent-race \ | ||
-e SPIDERPOOL_CONTROLLER_IMAGE_NAME=spiderpool-controller-race \ | ||
-e E2E_IP_FAMILY=dual -e PYROSCOPE_LOCAL_PORT="" \ | ||
-e E2E_KIND_IMAGE_TAG=${{ inputs.k8s_version }} | ||
- name: Run e2e Test | ||
id: run_e2e | ||
if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' }} | ||
continue-on-error: true | ||
run: | | ||
echo ${{ github.event.inputs.labels }} | ||
RESULT=0 | ||
make e2e_test_underlay_subnet -e E2E_CLUSTER_NAME=${{ steps.prepare.outputs.clusterName }} \ | ||
-e E2E_TIMEOUT=${{ env.E2E_TIME_OUT }} || RESULT=1 | ||
if ((RESULT==0)) ; then | ||
echo ::set-output name=pass::true | ||
else | ||
echo ::set-output name=pass::false | ||
fi | ||
if [ -f "test/e2edebugLog" ] ; then | ||
echo ::set-output name=updaloadlog::true | ||
else | ||
echo ::set-output name=updaloadlog::false | ||
fi | ||
if [ -f "./e2ereport.json" ] ; then | ||
echo "error, did not find e2e report" | ||
echo ::set-output name=upload::true | ||
else | ||
echo ::set-output name=upload::false | ||
fi | ||
- name: Upload e2e log | ||
if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' }} | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ inputs.k8s_version }}-debuglog.txt | ||
path: test/e2edebugLog.txt | ||
retention-days: 7 | ||
|
||
- name: Upload e2e report | ||
if: ${{ steps.run_e2e.outputs.upload == 'true' && needs.get_ref.outputs.e2e_enabled == 'true' }} | ||
uses: actions/[email protected] | ||
with: | ||
name: ${{ inputs.k8s_version }}-e2ereport.json | ||
path: e2ereport.json | ||
retention-days: 1 | ||
|
||
- name: Show e2e Result | ||
if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' }} | ||
run: | | ||
if ${{ steps.run_e2e.outputs.pass == 'true' }} ;then | ||
exit 0 | ||
else | ||
exit 1 | ||
fi | ||
uses: ./.github/workflows/e2e-init.yaml | ||
with: | ||
ip_family: ipv4 | ||
image_tag: ${{ needs.call_build_ci_image.outputs.imageTag }} | ||
ref: ${{ needs.get_ref.outputs.ref }} | ||
k8s_version: ${{ inputs.k8s_version }} | ||
run_e2e: ${{ needs.get_ref.outputs.e2e_enabled }} | ||
secrets: inherit |
Oops, something went wrong.