Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): address issues in integration test suite workflow #17928

Merged
merged 3 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 20 additions & 23 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,10 @@ jobs:
int_tests: true
secrets: inherit

detect-user:
neuronull marked this conversation as resolved.
Show resolved Hide resolved
name: Detect user team membership
runs-on: ubuntu-latest
outputs:
IS_TEAM_MEMBER: ${{ steps.author.outputs.isTeamMember }}
steps:
- name: Get PR author
if: github.event_name == 'pull_request'
id: author
uses: tspascoal/get-user-teams-membership@v2
with:
username: ${{ github.actor }}
team: 'Vector'
GITHUB_TOKEN: ${{ secrets.GH_PAT_ORG }}

integration-tests:
name: Integration Tests
runs-on: [linux, ubuntu-20.04-4core]
needs: [changes, detect-user]
needs: changes
if: always() && (
github.event_name == 'merge_group' || (
needs.changes.outputs.all-int == 'true'
Expand Down Expand Up @@ -110,6 +95,17 @@ jobs:

- run: docker image prune -af ; docker container prune -f

- name: Determine if secrets are defined (PR author is team member).
neuronull marked this conversation as resolved.
Show resolved Hide resolved
if: github.event_name == 'pull_request'
env:
GH_PAT_ORG: ${{ secrets.GH_PAT_ORG }}
run: |
if [[ "$GH_PAT_ORG" != "" ]] ; then
echo "PR_HAS_ACCESS_TO_SECRETS=true" >> "$GITHUB_ENV"
else
echo "PR_HAS_ACCESS_TO_SECRETS=false" >> "$GITHUB_ENV"
fi

- if: ${{ github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.amqp == 'true' }}
name: amqp
uses: nick-fields/retry@v2
Expand All @@ -119,7 +115,7 @@ jobs:
command: bash scripts/ci-integration-test.sh amqp

- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.appsignal == 'true') &&
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to change this now, but I'm thinking we could have actually had each integration test step that needed access to a given secret to just check access for that particular secret.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that is better.

If we move back to this workflow using a matrix (like when we get caching going) , that would still work, it would just be condensed.

name: appsignal
uses: nick-fields/retry@v2
with:
Expand All @@ -136,7 +132,7 @@ jobs:
command: bash scripts/ci-integration-test.sh aws

- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.axiom == 'true') &&
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
name: axiom
uses: nick-fields/retry@v2
with:
Expand All @@ -161,7 +157,7 @@ jobs:
command: bash scripts/ci-integration-test.sh clickhouse

- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.databend == 'true') &&
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
name: databend
uses: nick-fields/retry@v2
with:
Expand All @@ -170,7 +166,7 @@ jobs:
command: bash scripts/ci-integration-test.sh databend

- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true') &&
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
name: datadog-agent
uses: nick-fields/retry@v2
with:
Expand All @@ -179,7 +175,7 @@ jobs:
command: bash scripts/ci-integration-test.sh datadog-agent

- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true') &&
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
name: datadog-logs
uses: nick-fields/retry@v2
with:
Expand All @@ -188,7 +184,7 @@ jobs:
command: bash scripts/ci-integration-test.sh datadog-logs

- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true') &&
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
name: datadog-metrics
uses: nick-fields/retry@v2
with:
Expand All @@ -197,7 +193,7 @@ jobs:
command: bash scripts/ci-integration-test.sh datadog-metrics

- if: (github.event_name == 'merge_group' || needs.changes.outputs.all-int == 'true' || needs.changes.outputs.datadog == 'true') &&
(github.event_name != 'pull_request' || needs.detect-user.outputs.IS_TEAM_MEMBER == 'true')
(github.event_name != 'pull_request' || env.PR_HAS_ACCESS_TO_SECRETS == 'true')
name: datadog-traces
uses: nick-fields/retry@v2
with:
Expand Down Expand Up @@ -398,6 +394,7 @@ jobs:
runs-on: ubuntu-latest
if: always()
needs:
- changes
- integration-tests
env:
FAILED: ${{ contains(needs.*.result, 'failure') }}
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/k8s_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ jobs:
final-result:
name: K8s E2E Suite
runs-on: ubuntu-latest
needs: test-e2e-kubernetes
needs:
- changes
- build-x86_64-unknown-linux-gnu
- compute-k8s-test-plan
- test-e2e-kubernetes
if: always()
env:
FAILED: ${{ contains(needs.*.result, 'failure') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
name: Test Suite
runs-on: ubuntu-20.04
if: always()
needs: checks
needs: [changes, checks]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that that I believe the only other workflow with this issue is the integration comment trigger one- the fix is less simple than this so omitting that from this PR, plus it isn't part of the merge queue, the issue only manifests as a failure to properly update the PR status check.

env:
FAILED: ${{ contains(needs.*.result, 'failure') }}
steps:
Expand Down