Skip to content

[pull] main from labring:main #331

[pull] main from labring:main

[pull] main from labring:main #331

name: E2E Apply Test
on:
workflow_dispatch:
pull_request_target:
types: [ opened, synchronize, reopened, labeled ]
jobs:
call_ci_workflow:
uses: ./.github/workflows/import-patch-image.yml
if: ${{ contains(github.event.pull_request.labels.*.name, 'need-e2e-apply-test') }}
with:
arch: amd64,arm64
e2e: true
image: true
e2e_apply_test:
needs: [ call_ci_workflow ]
runs-on: ubuntu-latest
permissions:
issues: write
strategy:
matrix:
arch: [ arm64, amd64 ]
outputs:
test_result: ${{ steps.apply_test.outputs.test_result }}
steps:
- name: Download sealos binary
uses: actions/download-artifact@v3
with:
name: sealos-${{ matrix.arch }}
path: /tmp/sealos/bin/
- name: Download patch image tar
uses: actions/download-artifact@v3
with:
name: patch-image-${{ matrix.arch }}.tar
path: /tmp/sealos/images/
- name: Download e2e test
uses: actions/download-artifact@v3
with:
name: e2e.test
path: /tmp/
- name: Install ginkgo && Run e2e apply test
id: apply_test
shell: bash
run: |
set -ex
sudo chmod a+x /tmp/e2e.test
gzip /tmp/sealos/images/patch-${{ matrix.arch }}.tar
sudo export SEALOS_E2E_TEST_IMAGE_NAME="hub.sealos.cn/labring/kubernetes:v1.25.6" \
SEALOS_E2E_TEST_PATCH_IMAGE_TAR="/tmp/sealos/images/patch-${{ matrix.arch }}.tar.gz" \
SEALOS_E2E_TEST_PATCH_IMAGE_NAME="ghcr.io/labring/sealos-patch:${{ env.GIT_COMMIT_SHORT_SHA }}-${{ matrix.arch }}" \
SEALOS_E2E_TEST_SEALOS_BIN_PATH="/tmp/sealos/bin/sealos" \
ALIYUN_ACCESS_KEY_ID="${{ secrets.E2E_ALIYUN_ACCESS_KEY_ID }}" \
ALIYUN_ACCESS_KEY_SECRET="${{ secrets.E2E_ALIYUN_ACCESS_KEY_SECRET }}" \
ALIYUN_RESOURCE_GROUP_ID="${{ secrets.E2E_ALIYUN_RESOURCE_GROUP_ID }}" \
ALIYUN_REGION_ID="${{ secrets.E2E_ALIYUN_REGION_ID }}"
sudo /tmp/e2e.test --ginkgo.v --ginkgo.focus="E2E_sealos_apply_infra_test"
echo 'test_result=success' >> "$GITHUB_OUTPUT"
issue_commit:
needs: [ e2e_apply_test ]
runs-on: ubuntu-latest
permissions:
issues: write
if: ${{ always() && contains(github.event.pull_request.labels.*.name, 'need-e2e-apply-test') }} #success() || failure()
steps:
- name: Add comment to PR with test status
uses: peter-evans/create-or-update-comment@v1
env:
TEST_RESULT: ${{ needs.e2e_apply_test.outputs.test_result == 'success' && 'Success 🎉🎉!' || '‼️ Failure' }}
with:
issue-number: ${{ github.event.number }}
comment-author: 'github-actions[bot]'
repository: ${{ github.repository }}
body: |
🤖 says: E2E Apply Test Result: ${{ env.TEST_RESULT }} <br/>See: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
token: "${{ secrets.GH_PAT }}"