Browse Source

feat(ci): 20% rollout of new diff library for visual snapshots (#35907)

* fix(ci): split diff runs

* Update .github/workflows/acceptance.yml

Co-authored-by: Armen Zambrano G. <armenzg@sentry.io>

* Update .github/workflows/acceptance.yml

Co-authored-by: Armen Zambrano G. <armenzg@sentry.io>

* Update .github/workflows/acceptance.yml

Co-authored-by: Armen Zambrano G. <armenzg@sentry.io>

* fix(runs): reduce sample to 20%

* Update .github/workflows/acceptance.yml

Co-authored-by: Armen Zambrano G. <armenzg@sentry.io>

Co-authored-by: Armen Zambrano G. <armenzg@sentry.io>
Jonas 2 years ago
parent
commit
1a9044630c
1 changed files with 19 additions and 2 deletions
  1. 19 2
      .github/workflows/acceptance.yml

+ 19 - 2
.github/workflows/acceptance.yml

@@ -280,12 +280,29 @@ jobs:
         run: |
           echo "One of the dependent jobs have failed. You may need to re-run it." && exit 1
 
+      - name: Determine snapshot version
+        id: snapshot_ref
+        run: |
+          random=$(( ( RANDOM % 10 )  + 1 ));
+          echo "::set-output name=ref::$([[ $random -ge 2 ]] && echo "pixelmatch" || echo "odiff")"
+
       - name: Diff snapshots
-        id: visual-snapshots-diff
+        id: visual-snapshots-diff-pixelmatch
         uses: getsentry/action-visual-snapshot@main
         # Run this step only if there are acceptance related code changes
         # Forks are handled in visual-diff.yml
-        if: needs.files-changed.outputs.acceptance == 'true' && github.event.pull_request.head.repo.full_name == 'getsentry/sentry'
+        if: steps.snapshot_ref.outputs.ref == 'pixelmatch' && needs.files-changed.outputs.acceptance == 'true' && github.event.pull_request.head.repo.full_name == 'getsentry/sentry'
+        with:
+          api-token: ${{ secrets.VISUAL_SNAPSHOT_SECRET }}
+          gcs-bucket: 'sentry-visual-snapshots'
+          gcp-service-account-key: ${{ secrets.SNAPSHOT_GOOGLE_SERVICE_ACCOUNT_KEY }}
+
+      - name: Diff snapshots
+        id: visual-snapshots-diff-odiff
+        uses: getsentry/action-visual-snapshot@905b7e3a7fdd913189b9a35dcef51b6b927f9598
+        # Run this step only if there are acceptance related code changes
+        # Forks are handled in visual-diff.yml
+        if: steps.snapshot_ref.outputs.ref == 'odiff' && needs.files-changed.outputs.acceptance == 'true' && github.event.pull_request.head.repo.full_name == 'getsentry/sentry'
         with:
           api-token: ${{ secrets.VISUAL_SNAPSHOT_SECRET }}
           gcs-bucket: 'sentry-visual-snapshots'