From 28236cdbf93212f7fbf5ca43439b8cb797d6e025 Mon Sep 17 00:00:00 2001 From: Cyclinder Kuo Date: Wed, 25 Dec 2024 18:46:08 +0800 Subject: [PATCH] CI: FIx fail to upload multiple artifacts with the same name Signed-off-by: Cyclinder Kuo --- .github/workflows/auto-upgrade-ci.yaml | 8 ++++---- .github/workflows/build-image-base.yaml | 4 +++- .github/workflows/build-image-ci.yaml | 8 ++++---- .github/workflows/build-image-plugins.yaml | 4 +++- .github/workflows/call-release-changelog.yaml | 4 ++-- .github/workflows/call-release-chart.yaml | 4 ++-- .github/workflows/call-release-doc.yaml | 6 ++++-- .github/workflows/e2e-init.yaml | 14 ++++++++------ .github/workflows/lint-golang.yaml | 10 +++++----- .github/workflows/trivy-scan-image.yaml | 4 ++-- .github/workflows/update-chart-readme.yml | 6 +++--- 11 files changed, 40 insertions(+), 32 deletions(-) diff --git a/.github/workflows/auto-upgrade-ci.yaml b/.github/workflows/auto-upgrade-ci.yaml index f788bb35e0..c8600f19fc 100644 --- a/.github/workflows/auto-upgrade-ci.yaml +++ b/.github/workflows/auto-upgrade-ci.yaml @@ -212,15 +212,15 @@ jobs: if: ${{ needs.get_ref.outputs.build_old_image_tag == 'true' }} uses: actions/download-artifact@v4.1.8 with: - name: old-image-tar-spiderpool-agent path: test/.download + pattern: old-image-tar-spiderpool-agent-${{ needs.call_build_old_ci_image.outputs.imageTag }} - 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@v4.1.8 with: - name: old-image-tar-spiderpool-controller path: test/.download + pattern: old-image-tar-spiderpool-controller-${{ needs.call_build_old_ci_image.outputs.imageTag }} - name: Load Images if: ${{ needs.get_ref.outputs.build_old_image_tag == 'true' }} @@ -306,14 +306,14 @@ jobs: - name: Download new spiderpool-agent image with tag ${{ needs.call_build_new_ci_image.outputs.imageTag }} uses: actions/download-artifact@v4.1.8 with: - name: new-image-tar-spiderpool-agent path: test/.download + pattern: new-image-tar-spiderpool-agent-${{ needs.call_build_old_ci_image.outputs.imageTag }} - name: Download new spiderpool-controller image with tag ${{ needs.call_build_new_ci_image.outputs.imageTag }} uses: actions/download-artifact@v4.1.8 with: - name: new-image-tar-spiderpool-controller path: test/.download + pattern: new-image-tar-spiderpool-controller-${{ needs.call_build_old_ci_image.outputs.imageTag }} - name: Load Images with tag ${{ needs.call_build_new_ci_image.outputs.imageTag }} run: | diff --git a/.github/workflows/build-image-base.yaml b/.github/workflows/build-image-base.yaml index 67d64bd20e..13ba131b3d 100644 --- a/.github/workflows/build-image-base.yaml +++ b/.github/workflows/build-image-base.yaml @@ -133,7 +133,7 @@ jobs: if: ${{ env.exists == 'false' }} uses: actions/upload-artifact@v4.5.0 with: - name: image-digest ${{ env.IMAGE_NAME }} + name: image-digest-${{ env.IMAGE_NAME }}-${{ env.tag }} path: image-digest retention-days: 1 @@ -151,6 +151,8 @@ jobs: uses: actions/download-artifact@v4.1.8 with: path: image-digest/ + pattern: image-digest-${{ env.IMAGE_NAME }}-${{ env.tag }} + merge-multiple: true - name: Image Digests Output shell: bash diff --git a/.github/workflows/build-image-ci.yaml b/.github/workflows/build-image-ci.yaml index d13c60b86b..6039080510 100644 --- a/.github/workflows/build-image-ci.yaml +++ b/.github/workflows/build-image-ci.yaml @@ -252,7 +252,7 @@ jobs: - name: Upload artifact digests uses: actions/upload-artifact@v4.5.0 with: - name: image-digest-${{ matrix.name }} + name: image-digest-${{ matrix.name }}-${{ env.tag }} path: image-digest retention-days: 1 @@ -260,7 +260,7 @@ jobs: - name: Upload artifact race image tar uses: actions/upload-artifact@v4.5.0 with: - name: ${{ inputs.imageTarName }}-${{ matrix.name }} + name: ${{ inputs.imageTarName }}-${{ matrix.name }}-${{ env.tag }} path: /tmp/${{ matrix.name }}-race.tar retention-days: 1 @@ -303,14 +303,14 @@ jobs: - name: Download digests of all images built uses: actions/download-artifact@v4.1.8 with: + pattern: image-digest-spiderpool-agent-* path: image-digest/ - name: image-digest-spiderpool-agent - name: Download digests of all images built uses: actions/download-artifact@v4.1.8 with: + pattern: image-digest-spiderpool-controller-* path: image-digest/ - name: image-digest-spiderpool-controller - name: Image Digests Output shell: bash diff --git a/.github/workflows/build-image-plugins.yaml b/.github/workflows/build-image-plugins.yaml index ee40c06a34..c737ddf0be 100644 --- a/.github/workflows/build-image-plugins.yaml +++ b/.github/workflows/build-image-plugins.yaml @@ -133,7 +133,7 @@ jobs: if: ${{ env == 'false' }} uses: actions/upload-artifact@v4.5.0 with: - name: image-digest ${{ env.IMAGE_NAME }} + name: image-digest-${{ env.IMAGE_NAME }}-${{ steps.arg.outputs.image_tag }} path: image-digest retention-days: 1 @@ -151,6 +151,8 @@ jobs: uses: actions/download-artifact@v4.1.8 with: path: image-digest/ + pattern: image-digest-* + merge-multiple: true - name: Image Digests Output shell: bash diff --git a/.github/workflows/call-release-changelog.yaml b/.github/workflows/call-release-changelog.yaml index 340d04b09c..4e6f66c47d 100644 --- a/.github/workflows/call-release-changelog.yaml +++ b/.github/workflows/call-release-changelog.yaml @@ -111,7 +111,7 @@ jobs: - name: Upload Changelog uses: actions/upload-artifact@v4.5.0 with: - name: changelog_artifact + name: changelog_artifact_${{ env.RUN_dest_tag }} path: ${{ env.FILE_PATH }} retention-days: 1 if-no-files-found: error @@ -128,7 +128,7 @@ jobs: - name: Download Artifact uses: actions/download-artifact@v4.1.8 with: - name: changelog_artifact + pattern: changelog_artifact_${{ env.RUN_dest_tag }} path: ${{ env.DEST_DIRECTORY }} - uses: crazy-max/ghaction-import-gpg@v6 diff --git a/.github/workflows/call-release-chart.yaml b/.github/workflows/call-release-chart.yaml index 13d3cb193b..59c338a5eb 100644 --- a/.github/workflows/call-release-chart.yaml +++ b/.github/workflows/call-release-chart.yaml @@ -89,7 +89,7 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v4.5.0 with: - name: chart_package_artifact + name: chart_package_artifact_${{ needs.get_ref.outputs.ref }} path: tmp/* retention-days: 1 if-no-files-found: error @@ -117,7 +117,7 @@ jobs: - name: Download Artifact uses: actions/download-artifact@v4.1.8 with: - name: chart_package_artifact + pattern: chart_package_artifact_${{ needs.get_ref.outputs.ref }} path: charts/ - name: Update Chart Yaml diff --git a/.github/workflows/call-release-doc.yaml b/.github/workflows/call-release-doc.yaml index 6ae62a85d7..956bf3af66 100644 --- a/.github/workflows/call-release-doc.yaml +++ b/.github/workflows/call-release-doc.yaml @@ -135,7 +135,7 @@ jobs: - name: Upload Artifact uses: actions/upload-artifact@v4.5.0 with: - name: website_package_artifact + name: website_package_artifact_${{ env.REF }} path: site.tar.gz retention-days: 0 if-no-files-found: error @@ -154,7 +154,9 @@ jobs: - name: Download Artifact uses: actions/download-artifact@v4.1.8 with: - name: website_package_artifact + pattern: website_package_artifact_${{ env.REF }} + path: ./ + merge-multiple: true - name: Untar Doc run: | diff --git a/.github/workflows/e2e-init.yaml b/.github/workflows/e2e-init.yaml index b3fee08f13..737e8af1ad 100644 --- a/.github/workflows/e2e-init.yaml +++ b/.github/workflows/e2e-init.yaml @@ -106,14 +106,16 @@ jobs: - name: Download spiderpool-agent image uses: actions/download-artifact@v4.1.8 with: - name: image-tar-spiderpool-agent path: test/.download + pattern: image-tar-spiderpool-agent-${{ inputs.ref }} + merge-multiple: true - name: Download spiderpool-controller image uses: actions/download-artifact@v4.1.8 with: - name: image-tar-spiderpool-controller path: test/.download + pattern: image-tar-spiderpool-controller-${{ inputs.ref }} + merge-multiple: true - name: Load Images run: | @@ -179,7 +181,7 @@ jobs: if: ${{ env.RUN_SETUP_KIND_CLUSTER_PASS == 'false' && env.UPLOAD_SETUP_KIND_CLUSTER_LOG == 'true' }} uses: actions/upload-artifact@v4.5.0 with: - name: ${{ inputs.os }}-${{ inputs.ip_family }}-${{ matrix.e2e_test_mode }}-${{ inputs.k8s_version }}-setupkind.txt + name: ${{ inputs.os }}-${{ inputs.ip_family }}-${{ matrix.e2e_test_mode }}-${{ inputs.k8s_version }}-${{ inputs.image_tag }}-setupkind.txt path: test/e2edebugLog.txt retention-days: 7 @@ -225,7 +227,7 @@ jobs: if: ${{ inputs.run_e2e == 'true' }} uses: actions/upload-artifact@v4.5.0 with: - name: ${{ inputs.os }}-${{ inputs.ip_family }}-${{ matrix.e2e_test_mode }}-${{ inputs.k8s_version }}-debuglog.txt + name: ${{ inputs.os }}-${{ inputs.ip_family }}-${{ matrix.e2e_test_mode }}-${{ inputs.k8s_version }}-${{ inputs.image_tag }}-debuglog.txt path: test/e2edebugLog.txt retention-days: 7 @@ -233,7 +235,7 @@ jobs: if: ${{ env.UPLOAD_E2E_REPORT == 'true' }} uses: actions/upload-artifact@v4.5.0 with: - name: ${{ inputs.os }}-${{ inputs.ip_family }}-${{ matrix.e2e_test_mode }}-${{ inputs.k8s_version }}-e2ereport.json + name: ${{ inputs.os }}-${{ inputs.ip_family }}-${{ matrix.e2e_test_mode }}-${{ inputs.k8s_version }}-${{ inputs.image_tag }}-e2ereport.json path: e2ereport.json retention-days: 1 @@ -293,7 +295,7 @@ jobs: if: ${{ env.UNINSTALL_E2E_PASS == 'false' && env.UPLOAD_UNINSTALL_E2E_LOG == 'true' }} uses: actions/upload-artifact@v4.5.0 with: - name: ${{ inputs.os }}-${{ inputs.ip_family }}-${{ matrix.e2e_test_mode }}-${{ inputs.k8s_version }}-uninstall-debugLog.txt + name: ${{ inputs.os }}-${{ inputs.ip_family }}-${{ matrix.e2e_test_mode }}-${{ inputs.k8s_version }}-${{ inputs.image_tag }}-uninstall-debugLog.txt path: test/e2e-uninstall-debugLog.txt retention-days: 7 diff --git a/.github/workflows/lint-golang.yaml b/.github/workflows/lint-golang.yaml index cf774f96ea..277ffcba46 100644 --- a/.github/workflows/lint-golang.yaml +++ b/.github/workflows/lint-golang.yaml @@ -216,16 +216,16 @@ jobs: if: ${{ steps.unittest.outcome == 'failure' }} uses: actions/upload-artifact@v4.5.0 with: - name: coverage.out - path: coverage.out + name: ${{ needs.filter_changes.outputs.ref }}-coverage.out + path: ${{ needs.filter_changes.outputs.ref }}-coverage.out retention-days: 1 - name: Upload Report Artifact if: ${{ steps.unittest.outcome == 'failure' }} uses: actions/upload-artifact@v4.5.0 with: - name: unittestreport.json - path: unittestreport.json + name: ${{ needs.filter_changes.outputs.ref }}-unittestreport.json + path: ${{ needs.filter_changes.outputs.ref }}-unittestreport.json retention-days: 1 # ============= upload coverage report @@ -234,7 +234,7 @@ jobs: uses: codecov/codecov-action@v4 with: directory: './' - files: 'coverage.out' + files: '${{ needs.filter_changes.outputs.ref }}-coverage.out' flags: unittests name: my-codecov-umbrella fail_ci_if_error: true diff --git a/.github/workflows/trivy-scan-image.yaml b/.github/workflows/trivy-scan-image.yaml index ef5d62ebe5..3a8ae50fe7 100644 --- a/.github/workflows/trivy-scan-image.yaml +++ b/.github/workflows/trivy-scan-image.yaml @@ -26,13 +26,13 @@ jobs: - name: Download spiderpool-agent image uses: actions/download-artifact@v4.1.8 with: - name: image-tar-spiderpool-agent + name: image-tar-spiderpool-agent-${{ inputs.ref }} path: test/.download - name: Download spiderpool-controller image uses: actions/download-artifact@v4.1.8 with: - name: image-tar-spiderpool-controller + name: image-tar-spiderpool-controller-${{ inputs.ref }} path: test/.download - name: List downloaded files diff --git a/.github/workflows/update-chart-readme.yml b/.github/workflows/update-chart-readme.yml index 21a480c1f3..fdcfe7245d 100644 --- a/.github/workflows/update-chart-readme.yml +++ b/.github/workflows/update-chart-readme.yml @@ -54,8 +54,8 @@ jobs: - name: Upload artifact digests uses: actions/upload-artifact@v4.5.0 with: - name: README.md - path: thisProject/charts/spiderpool/README.md + name: ${{github.event.pull_request.head.ref}}-README.md + path: thisProject/charts/spiderpool/${{github.event.pull_request.head.ref}}-README.md - name: Diff chart/README.md run: | @@ -67,6 +67,6 @@ jobs: echo -e "\033[31mPlease refer to artifact, and then commit the code.\033[0m" echo -e "\033[31mAlternatively, copy the contents of the new README.md below into your commit.\033[0m" echo -e "\033[31m-----------------------------\033[0m" - cat charts/spiderpool/README.md + cat charts/spiderpool/${{github.event.pull_request.head.ref}}-README.md exit 1 fi