Просмотр исходного кода

fix image building and testing for non maintainers in MQ (#3504)

Alex Meijer 5 месяцев назад
Родитель
Сommit
78e4b44697
2 измененных файлов с 13 добавлено и 12 удалено
  1. 2 1
      .github/workflows/build-test-image.yml
  2. 11 11
      .github/workflows/integration-testing.yaml

+ 2 - 1
.github/workflows/build-test-image.yml

@@ -15,6 +15,7 @@ env:
 jobs:
 jobs:
   check_actor_permissions:
   check_actor_permissions:
         runs-on: ubuntu-latest
         runs-on: ubuntu-latest
+        if: ${{ github.event_name == 'pull_request_target' || github.event_name == 'merge_group' }}
         outputs:
         outputs:
             ismaintainer: ${{ steps.determine-maintainer.outputs.ismaintainer }}
             ismaintainer: ${{ steps.determine-maintainer.outputs.ismaintainer }}
         steps:
         steps:
@@ -41,7 +42,7 @@ jobs:
   build-and-publish-test-image:
   build-and-publish-test-image:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     needs: check_actor_permissions
     needs: check_actor_permissions
-    if: ${{ (always() && !cancelled()) && ( github.event_name == 'merge_group' || needs.check_actor_permissions.outputs.ismaintainer == 'true') }}
+    if: ${{ (always() && !cancelled()) && ( github.event_name == 'merge_group' || (github.event_name == 'pull_request_target' && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
     permissions:
     permissions:
       contents: read
       contents: read
       packages: write
       packages: write

+ 11 - 11
.github/workflows/integration-testing.yaml

@@ -20,7 +20,7 @@ permissions: {}
 jobs:
 jobs:
     check_actor_permissions:
     check_actor_permissions:
       runs-on: ubuntu-latest
       runs-on: ubuntu-latest
-      if: ${{ github.event_name == 'pull_request_target' }}
+      if: ${{ github.event_name == 'pull_request_target' || github.event_name == 'merge_group' }}
       outputs:
       outputs:
           ismaintainer: ${{ steps.determine-maintainer.outputs.ismaintainer }}
           ismaintainer: ${{ steps.determine-maintainer.outputs.ismaintainer }}
       steps:
       steps:
@@ -60,7 +60,7 @@ jobs:
         runs-on: ubuntu-latest
         runs-on: ubuntu-latest
         permissions: {}
         permissions: {}
         needs: check_actor_permissions
         needs: check_actor_permissions
-        if: ${{ (always() && !cancelled()) && ( github.event.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
+        if: ${{ (always() && !cancelled()) && ( github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
         outputs:
         outputs:
             IMAGE_TAG: ${{ steps.set_image_tags.outputs.IMAGE_TAG }}
             IMAGE_TAG: ${{ steps.set_image_tags.outputs.IMAGE_TAG }}
             NAMESPACE: ${{ steps.set_image_tags.outputs.NAMESPACE }}
             NAMESPACE: ${{ steps.set_image_tags.outputs.NAMESPACE }}
@@ -130,7 +130,7 @@ jobs:
                 
                 
     build-test-stack:
     build-test-stack:
         needs: wait_for_image_ready
         needs: wait_for_image_ready
-        if: ${{ (always() && !cancelled()) && ( github.event.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
+        if: ${{ (always() && !cancelled()) && ( github.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
         uses: opencost/opencost-infra/.github/workflows/build-stack.yaml@main
         uses: opencost/opencost-infra/.github/workflows/build-stack.yaml@main
         secrets: inherit
         secrets: inherit
         with:
         with:
@@ -139,7 +139,7 @@ jobs:
             
             
     build-test-stack-promless:
     build-test-stack-promless:
         needs: wait_for_image_ready
         needs: wait_for_image_ready
-        if: ${{ (always() && !cancelled()) && ( github.event.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
+        if: ${{ (always() && !cancelled()) && ( github.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
         uses: opencost/opencost-infra/.github/workflows/build-stack.yaml@main
         uses: opencost/opencost-infra/.github/workflows/build-stack.yaml@main
         secrets: inherit
         secrets: inherit
         with:
         with:
@@ -150,7 +150,7 @@ jobs:
     wait-for-dns:
     wait-for-dns:
         needs: [wait_for_image_ready, build-test-stack]
         needs: [wait_for_image_ready, build-test-stack]
         runs-on: ubuntu-latest
         runs-on: ubuntu-latest
-        if: ${{ (always() && !cancelled()) && ( github.event.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
+        if: ${{ (always() && !cancelled()) && ( github.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
         permissions: {}
         permissions: {}
         steps:
         steps:
           - name: Wait for DNS to resolve
           - name: Wait for DNS to resolve
@@ -175,7 +175,7 @@ jobs:
 
 
     run-tests:
     run-tests:
         needs: [wait_for_image_ready, build-test-stack, wait-for-dns]
         needs: [wait_for_image_ready, build-test-stack, wait-for-dns]
-        if: ${{ (always() && !cancelled()) && ( github.event.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
+        if: ${{ (always() && !cancelled()) && ( github.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
         permissions: {}
         permissions: {}
         uses: opencost/opencost-infra/.github/workflows/test-stack.yaml@main
         uses: opencost/opencost-infra/.github/workflows/test-stack.yaml@main
         secrets: inherit
         secrets: inherit
@@ -186,7 +186,7 @@ jobs:
     wait-for-data-collection:
     wait-for-data-collection:
       needs: [wait_for_image_ready, build-test-stack, build-test-stack-promless]
       needs: [wait_for_image_ready, build-test-stack, build-test-stack-promless]
       runs-on: ubuntu-latest
       runs-on: ubuntu-latest
-      if: ${{ (always() && !cancelled()) && ( github.event.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
+      if: ${{ (always() && !cancelled()) && ( github.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
       permissions: {}
       permissions: {}
       steps:
       steps:
         - name: Wait 22 minutes for promless data collection
         - name: Wait 22 minutes for promless data collection
@@ -195,7 +195,7 @@ jobs:
     
     
     run-comparison-tests:
     run-comparison-tests:
       needs: [wait_for_image_ready, build-test-stack, build-test-stack-promless, wait-for-data-collection]
       needs: [wait_for_image_ready, build-test-stack, build-test-stack-promless, wait-for-data-collection]
-      if: ${{ (always() && !cancelled()) && ( github.event.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
+      if: ${{ (always() && !cancelled()) && ( github.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
       permissions: {}
       permissions: {}
       uses: opencost/opencost-infra/.github/workflows/test-stack.yaml@main
       uses: opencost/opencost-infra/.github/workflows/test-stack.yaml@main
       secrets: inherit
       secrets: inherit
@@ -207,7 +207,7 @@ jobs:
     
     
     print-outputs:
     print-outputs:
       needs: [run-comparison-tests, run-tests]
       needs: [run-comparison-tests, run-tests]
-      if: ${{ (always() && !cancelled()) && ( github.event.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
+      if: ${{ (always() && !cancelled()) && ( github.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
       runs-on: ubuntu-latest
       runs-on: ubuntu-latest
       permissions: {}
       permissions: {}
       steps:
       steps:
@@ -236,7 +236,7 @@ jobs:
 
 
     teardown-test-stack:
     teardown-test-stack:
         needs: [wait_for_image_ready, run-tests, run-comparison-tests, hold-on-failure]
         needs: [wait_for_image_ready, run-tests, run-comparison-tests, hold-on-failure]
-        if: ${{ (always() && !cancelled()) && ( github.event.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
+        if: ${{ (always() && !cancelled()) && ( github.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
         uses: opencost/opencost-infra/.github/workflows/destroy-stack.yaml@main
         uses: opencost/opencost-infra/.github/workflows/destroy-stack.yaml@main
         secrets: inherit 
         secrets: inherit 
         permissions: {}
         permissions: {}
@@ -245,7 +245,7 @@ jobs:
     
     
     teardown-test-stack-comparison:
     teardown-test-stack-comparison:
         needs: [wait_for_image_ready, run-comparison-tests, hold-on-failure]
         needs: [wait_for_image_ready, run-comparison-tests, hold-on-failure]
-        if: ${{ (always() && !cancelled()) && ( github.event.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
+        if: ${{ (always() && !cancelled()) && ( github.event_name == 'schedule'  || github.event_name == 'push' || github.event_name == 'merge_group' || (github.event_name == 'pull_request_target'  && needs.check_actor_permissions.outputs.ismaintainer == 'true')) }}
         uses: opencost/opencost-infra/.github/workflows/destroy-stack.yaml@main
         uses: opencost/opencost-infra/.github/workflows/destroy-stack.yaml@main
         secrets: inherit 
         secrets: inherit 
         permissions: {}
         permissions: {}