-
Notifications
You must be signed in to change notification settings - Fork 83
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: Cyclinder Kuo <[email protected]>
- Loading branch information
Showing
16 changed files
with
120 additions
and
158 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 |
---|---|---|
|
@@ -219,19 +219,13 @@ jobs: | |
run: | | ||
bash ./test/scripts/install-tools.sh | ||
- name: Download old spiderpool-agent image with tag ${{ needs.call_build_old_ci_image.outputs.imageTag }} | ||
- name: Download old spiderpool-agent and spiderpool-controller image with tag ${{ needs.call_build_old_ci_image.outputs.imageTag }} | ||
if: ${{ needs.get_ref.outputs.build_old_image_tag == 'true' }} | ||
uses: actions/download-artifact@v3 | ||
uses: actions/download-artifact@v4.1.8 | ||
with: | ||
name: old-image-tar-spiderpool-agent | ||
path: test/.download | ||
|
||
- name: Download old spiderpool-controller image with tag ${{ needs.call_build_old_ci_image.outputs.imageTag }} | ||
if: ${{ needs.get_ref.outputs.build_old_image_tag == 'true' }} | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: old-image-tar-spiderpool-controller | ||
path: test/.download | ||
merge-multiple: true | ||
pattern: old-image-tar-spiderpool-*-${{ needs.call_build_old_ci_image.outputs.imageTag }} | ||
|
||
- name: Load Images | ||
if: ${{ needs.get_ref.outputs.build_old_image_tag == 'true' }} | ||
|
@@ -306,17 +300,12 @@ jobs: | |
mkdir -p ${{ env.KUBECONFIG_PATH }}/${{ env.E2E_CLUSTER_NAME }}/.kube/ | ||
cp -r /tmp/config ${{ env.KUBECONFIG_PATH }}/${{ env.E2E_CLUSTER_NAME }}/.kube/config | ||
- name: Download new spiderpool-agent image with tag ${{ needs.call_build_new_ci_image.outputs.imageTag }} | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: new-image-tar-spiderpool-agent | ||
path: test/.download | ||
|
||
- name: Download new spiderpool-controller image with tag ${{ needs.call_build_new_ci_image.outputs.imageTag }} | ||
uses: actions/download-artifact@v3 | ||
- name: Download new spiderpool-agent and spiderpool-controller image with tag ${{ needs.call_build_new_ci_image.outputs.imageTag }} | ||
uses: actions/[email protected] | ||
with: | ||
name: new-image-tar-spiderpool-controller | ||
path: test/.download | ||
pattern: new-image-tar-spiderpool-*-${{ needs.call_build_new_ci_image.outputs.imageTag }} | ||
merge-multiple: true | ||
|
||
- name: Load Images with tag ${{ needs.call_build_new_ci_image.outputs.imageTag }} | ||
run: | | ||
|
@@ -377,15 +366,15 @@ jobs: | |
- name: Upload e2e log | ||
if: ${{ needs.get_ref.outputs.e2e_enabled == 'true' }} | ||
uses: actions/upload-artifact@v3.1.3 | ||
uses: actions/upload-artifact@v4.6.0 | ||
with: | ||
name: ${{ needs.get_ref.outputs.old_version }}-to-${{ needs.get_ref.outputs.new_version }}-debuglog.txt | ||
path: test/e2edebugLog.txt | ||
retention-days: 7 | ||
|
||
- name: Upload e2e report | ||
if: ${{ env.UPLOAD_E2E_REPORT == 'true' }} | ||
uses: actions/upload-artifact@v3.1.3 | ||
uses: actions/upload-artifact@v4.6.0 | ||
with: | ||
name: ${{ needs.get_ref.outputs.old_version }}-to-${{ needs.get_ref.outputs.new_version }}-e2ereport.json | ||
path: e2ereport.json | ||
|
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
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
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 |
---|---|---|
|
@@ -42,7 +42,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
# run if filters.src was changed | ||
outputs: | ||
imageTag: ${{ steps.tag.outputs.tag }} | ||
imageTag: ${{ env.tag }} | ||
e2e: ${{ steps.tag.outputs.e2e }} | ||
strategy: | ||
matrix: | ||
|
@@ -65,29 +65,29 @@ jobs: | |
echo ${{ github.event_name }} | ||
if ${{ inputs.ref != '' }}; then | ||
echo "trigger by workflow_call" | ||
echo ::set-output name=tag::${{ inputs.ref }} | ||
echo ::set-output name=push::${{ inputs.push }} | ||
echo "tag=${{ inputs.ref }}" >> $GITHUB_ENV | ||
echo "push=${{ inputs.push }}" >> $GITHUB_ENV | ||
elif ${{ github.event_name == 'push' }} ; then | ||
echo "trigger by push" | ||
echo ::set-output name=tag::${{ github.sha }} | ||
echo ::set-output name=push::false | ||
echo "tag=${{ github.sha }}" >> $GITHUB_ENV | ||
echo "push=false" >> $GITHUB_ENV | ||
elif ${{ github.event_name == 'pull_request_target' }} ; then | ||
echo "trigger by pull_request_target" | ||
echo ::set-output name=tag::${{ github.event.pull_request.head.sha }} | ||
echo ::set-output name=push::false | ||
echo "tag=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV | ||
echo "push=false" >> $GITHUB_ENV | ||
elif ${{ github.event_name == 'workflow_run' }} ; then | ||
echo "trigger by workflow_run" | ||
echo ::set-output name=tag::main | ||
echo ::set-output name=push::false | ||
echo "tag=main" >> $GITHUB_ENV | ||
echo "push=false" >> $GITHUB_ENV | ||
else | ||
echo "trigger by ${{ github.event_name }}" | ||
echo ::set-output name=tag::${{ github.sha }} | ||
echo ::set-output name=push::false | ||
echo "tag=${{ github.sha }}" >> $GITHUB_ENV | ||
echo "push=false" >> $GITHUB_ENV | ||
fi | ||
- name: Login to online register | ||
uses: docker/[email protected] | ||
if: ${{ steps.tag.outputs.push == 'true' }} | ||
if: ${{ env.push == 'true' }} | ||
with: | ||
username: ${{ env.ONLINE_REGISTER_USER }} | ||
password: ${{ env.ONLINE_REGISTER_PASSWORD }} | ||
|
@@ -98,7 +98,7 @@ jobs: | |
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
ref: ${{ steps.tag.outputs.tag }} | ||
ref: ${{ env.tag }} | ||
|
||
- name: Getting Build Arg | ||
id: arg | ||
|
@@ -135,7 +135,7 @@ jobs: | |
# Import GitHub's cache build to docker cache | ||
- name: Copy ${{ matrix.name }} Golang cache to docker cache | ||
uses: docker/build-push-action@v5.1.0 | ||
uses: docker/build-push-action@v6.13.0 | ||
with: | ||
context: /tmp/.cache/${{ matrix.name }} | ||
file: ./images/cache/Dockerfile | ||
|
@@ -148,7 +148,7 @@ jobs: | |
# build normal image | ||
- name: CI Build ${{ matrix.name }} | ||
if: ${{ github.event_name != 'pull_request_target' }} | ||
uses: docker/build-push-action@v5.1.0 | ||
uses: docker/build-push-action@v6.13.0 | ||
continue-on-error: false | ||
id: docker_build_ci_master | ||
with: | ||
|
@@ -157,21 +157,21 @@ jobs: | |
# Only push when the event name was a GitHub push, this is to avoid | ||
# re-pushing the image tags when we only want to re-create the Golang | ||
# docker cache after the workflow "Image CI Cache Cleaner" was terminated. | ||
push: ${{ steps.tag.outputs.push }} | ||
push: ${{ env.push }} | ||
provenance: false | ||
platforms: linux/amd64,linux/arm64 | ||
github-token: ${{ secrets.WELAN_PAT }} | ||
tags: | | ||
${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }} | ||
${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ env.tag }} | ||
build-args: | | ||
GIT_COMMIT_VERSION=${{ steps.arg.outputs.commitver }} | ||
GIT_COMMIT_TIME=${{ steps.arg.outputs.committime }} | ||
VERSION=${{ steps.tag.outputs.tag }} | ||
VERSION=${{ env.tag }} | ||
# build debug image who turn on race and deadlock detection | ||
- name: CI race detection Build ${{ matrix.name }} | ||
if: ${{ github.event_name != 'pull_request_target' }} | ||
uses: docker/build-push-action@v5.1.0 | ||
uses: docker/build-push-action@v6.13.0 | ||
continue-on-error: false | ||
id: docker_build_ci_master_detect_race_condition | ||
with: | ||
|
@@ -180,95 +180,95 @@ jobs: | |
# Only push when the event name was a GitHub push, this is to avoid | ||
# re-pushing the image tags when we only want to re-create the Golang | ||
# docker cache after the workflow "Image CI Cache Cleaner" was terminated. | ||
push: ${{ steps.tag.outputs.push }} | ||
push: ${{ env.push }} | ||
platforms: linux/amd64 | ||
outputs: type=docker,dest=/tmp/${{ matrix.name }}-race.tar | ||
github-token: ${{ secrets.WELAN_PAT }} | ||
tags: | | ||
${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-race | ||
${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ env.tag }}-race | ||
build-args: | | ||
RACE=1 | ||
GIT_COMMIT_VERSION=${{ steps.arg.outputs.commitver }} | ||
GIT_COMMIT_TIME=${{ steps.arg.outputs.committime }} | ||
VERSION=${{ steps.tag.outputs.tag }} | ||
VERSION=${{ env.tag }} | ||
- name: CI Image Releases digests | ||
if: ${{ github.event_name != 'pull_request_target' }} | ||
shell: bash | ||
run: | | ||
mkdir -p image-digest/ | ||
echo "${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}@${{ steps.docker_build_ci_master.outputs.digest }}" > image-digest/${{ matrix.name }}.txt | ||
echo "${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-race@${{ steps.docker_build_ci_master_detect_race_condition.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | ||
echo "${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ env.tag }}@${{ steps.docker_build_ci_master.outputs.digest }}" > image-digest/${{ matrix.name }}.txt | ||
echo "${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ env.tag }}-race@${{ steps.docker_build_ci_master_detect_race_condition.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | ||
# =========== trigger by PR updates , build 2 images | ||
- name: CI Build ${{ matrix.name }} | ||
if: ${{ github.event_name == 'pull_request_target' }} | ||
uses: docker/build-push-action@v5.1.0 | ||
uses: docker/build-push-action@v6.13.0 | ||
continue-on-error: false | ||
id: docker_build_ci_pr | ||
with: | ||
context: . | ||
file: ${{ matrix.dockerfile }} | ||
push: ${{ steps.tag.outputs.push }} | ||
push: ${{ env.push }} | ||
provenance: false | ||
github-token: ${{ secrets.WELAN_PAT }} | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }} | ||
${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ env.tag }} | ||
build-args: | | ||
GIT_COMMIT_VERSION=${{ steps.arg.outputs.commitver }} | ||
GIT_COMMIT_TIME=${{ steps.arg.outputs.committime }} | ||
VERSION=${{ steps.tag.outputs.tag }} | ||
VERSION=${{ env.tag }} | ||
- name: CI race detection Build ${{ matrix.name }} | ||
if: ${{ github.event_name == 'pull_request_target' }} | ||
uses: docker/build-push-action@v5.1.0 | ||
uses: docker/build-push-action@v6.13.0 | ||
continue-on-error: false | ||
id: docker_build_ci_pr_detect_race_condition | ||
with: | ||
context: . | ||
file: ${{ matrix.dockerfile }} | ||
push: ${{ steps.tag.outputs.push }} | ||
push: ${{ env.push }} | ||
platforms: linux/amd64 | ||
github-token: ${{ secrets.WELAN_PAT }} | ||
outputs: type=docker,dest=/tmp/${{ matrix.name }}-race.tar | ||
tags: | | ||
${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-race | ||
${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ env.tag }}-race | ||
build-args: | | ||
RACE=1 | ||
GIT_COMMIT_VERSION=${{ steps.arg.outputs.commitver }} | ||
GIT_COMMIT_TIME=${{ steps.arg.outputs.committime }} | ||
VERSION=${{ steps.tag.outputs.tag }} | ||
VERSION=${{ env.tag }} | ||
- name: CI Image Releases digests | ||
if: ${{ github.event_name == 'pull_request_target' }} | ||
shell: bash | ||
run: | | ||
mkdir -p image-digest/ | ||
echo "${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}@${{ steps.docker_build_ci_pr.outputs.digest }}" > image-digest/${{ matrix.name }}.txt | ||
echo "${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-race@${{ steps.docker_build_ci_pr_detect_race_condition.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | ||
echo "${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ env.tag }}@${{ steps.docker_build_ci_pr.outputs.digest }}" > image-digest/${{ matrix.name }}.txt | ||
echo "${{ env.ONLINE_REGISTER }}/${{ github.repository }}/${{ matrix.name }}-ci:${{ env.tag }}-race@${{ steps.docker_build_ci_pr_detect_race_condition.outputs.digest }}" >> image-digest/${{ matrix.name }}.txt | ||
# Upload artifact digests | ||
- name: Upload artifact digests | ||
uses: actions/upload-artifact@v3.1.3 | ||
uses: actions/upload-artifact@v4.6.0 | ||
with: | ||
name: image-digest-${{ matrix.name }} | ||
name: image-digest-${{ matrix.name }}-${{ env.tag }} | ||
path: image-digest | ||
retention-days: 1 | ||
|
||
# Upload artifact race images tar | ||
- name: Upload artifact race image tar | ||
uses: actions/upload-artifact@v3.1.3 | ||
uses: actions/upload-artifact@v4.6.0 | ||
with: | ||
name: ${{ inputs.imageTarName }}-${{ matrix.name }} | ||
name: ${{ inputs.imageTarName }}-${{ matrix.name }}-${{ env.tag }} | ||
path: /tmp/${{ matrix.name }}-race.tar | ||
retention-days: 1 | ||
|
||
# ============= restore cache =========== | ||
# Store docker's golang's cache build locally only on the main branch | ||
- name: Store ${{ matrix.name }} Golang cache build locally | ||
if: ${{ github.event_name != 'pull_request_target' && steps.cache.outputs.cache-hit != 'true' }} | ||
uses: docker/build-push-action@v5.1.0 | ||
uses: docker/build-push-action@v6.13.0 | ||
with: | ||
context: . | ||
file: ./images/cache/Dockerfile | ||
|
@@ -301,16 +301,11 @@ jobs: | |
mkdir -p image-digest/ | ||
- name: Download digests of all images built | ||
uses: actions/download-artifact@v3 | ||
uses: actions/download-artifact@v4.1.8 | ||
with: | ||
pattern: image-digest-spiderpool-*-${{ needs.build_and_push_prs.outputs.imageTag }} | ||
path: image-digest/ | ||
name: image-digest-spiderpool-agent | ||
|
||
- name: Download digests of all images built | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: image-digest/ | ||
name: image-digest-spiderpool-controller | ||
merge-multiple: true | ||
|
||
- name: Image Digests Output | ||
shell: bash | ||
|
Oops, something went wrong.