-
Notifications
You must be signed in to change notification settings - Fork 153
Allow overriding spec when manually triggering E2E test workflow #664
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
Changes from all commits
20698e7
5063f19
ba4b2e1
0e18929
ba9f2ce
1269881
aa454b0
2b2f060
50da563
2823bf0
45915d2
cd1fac2
7eceff3
b91a779
6483c1c
ff1da19
fa1c18c
05a39c6
b4c33e9
71934ba
4e2d0c4
57e9ace
2a16f7a
c49197e
e1cf42b
6393473
b72431a
7b960c6
a91dad9
4ec9161
2910b0d
9db7fc6
b0b8305
97ec1bc
fa87742
8856f52
008e995
9bd6194
f9b190d
09686b7
d8da91e
120480b
9e42a6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,16 +7,20 @@ on: | |
| description: 'Use minimal test account' | ||
| required: false | ||
| default: 'false' | ||
| module: | ||
| description: "The module from 'test/integration' to the target to be tested, e.g. 'cli, domains, events, etc'" | ||
| test_path: | ||
| description: "The path from 'test/integration' to the target to be tested, e.g. 'cli'" | ||
| required: false | ||
| sha: | ||
| description: 'The hash value of the commit.' | ||
| required: true | ||
| required: false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we might want to leave this as it is |
||
| default: '' | ||
| pull_request_number: | ||
| description: 'The number of the PR. Ensure sha value is provided' | ||
| required: false | ||
| openapi_spec_url: | ||
| description: 'URL of the OpenAPI spec to use for the tests' | ||
| required: false | ||
| default: '' | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
@@ -28,6 +32,15 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'workflow_dispatch' && inputs.sha != '' || github.event_name == 'push' || github.event_name == 'pull_request' | ||
| steps: | ||
| - name: Validate Test Path | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you might have merged older local version of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes , raised the new PR |
||
| uses: actions-ecosystem/action-regex-match@v2 | ||
| id: validate-tests | ||
| if: ${{ inputs.test_path != '' }} | ||
| with: | ||
| text: ${{ inputs.test_path }} | ||
| regex: '[^a-z0-9-:.\/_]' # Tests validation | ||
| flags: gi | ||
|
|
||
| - name: Checkout Repository with SHA | ||
| if: ${{ inputs.sha != '' }} | ||
| uses: actions/checkout@v4 | ||
|
|
@@ -82,8 +95,22 @@ jobs: | |
| pip install certifi -U && \ | ||
| pip install .[obj,dev] | ||
|
|
||
| - name: Download kubectl and calicoctl for LKE clusters | ||
| run: | | ||
| curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" | ||
| curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64" | ||
| chmod +x calicoctl-linux-amd64 kubectl | ||
| mv calicoctl-linux-amd64 /usr/local/bin/calicoctl | ||
| mv kubectl /usr/local/bin/kubectl | ||
|
|
||
| - name: Set OpenAPI Spec URL | ||
| if: ${{ inputs.openapi_spec_url != '' }} | ||
| run: | | ||
| echo "Using OpenAPI Spec URL: ${{ inputs.openapi_spec_url }}" | ||
| echo "OPENAPI_SPEC_URL=${{ inputs.openapi_spec_url }}" >> $GITHUB_ENV | ||
|
|
||
| - name: Install Package | ||
| run: make install | ||
| run: make install SPEC="${{ env.OPENAPI_SPEC_URL }}" | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
|
|
@@ -95,10 +122,24 @@ jobs: | |
| run: | | ||
| timestamp=$(date +'%Y%m%d%H%M') | ||
| report_filename="${timestamp}_cli_test_report.xml" | ||
| make testint TEST_ARGS="--junitxml=${report_filename}" MODULE="${{ inputs.module }}" | ||
| if [ -n "$OPENAPI_SPEC_URL" ]; then | ||
| echo "Running tests with OpenAPI spec from: $OPENAPI_SPEC_URL" | ||
| make testint TEST_ARGS="--junitxml=${report_filename}" | ||
| else | ||
| echo "Running tests with default OpenAPI spec" | ||
| make testint TEST_ARGS="--junitxml=${report_filename}" | ||
| fi | ||
| if: ${{ steps.validate-tests.outputs.match == '' || inputs.test_path == '' }} | ||
| env: | ||
| LINODE_CLI_TOKEN: ${{ env.LINODE_CLI_TOKEN }} | ||
|
|
||
| - name: Apply Calico Rules to LKE | ||
| if: always() | ||
| run: | | ||
| cd scripts && ./lke_calico_rules_e2e.sh | ||
| env: | ||
| LINODE_TOKEN: ${{ env.LINODE_CLI_TOKEN }} | ||
|
|
||
| - name: Upload test results | ||
| if: always() | ||
| run: | | ||
|
|
@@ -143,75 +184,10 @@ jobs: | |
| }); | ||
| return result; | ||
|
|
||
| apply-calico-rules: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These jobs were recently added, let's keep these jobs as it makes the workflow easier to read |
||
| runs-on: ubuntu-latest | ||
| needs: [integration_tests] | ||
| if: ${{ success() || failure() }} | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| submodules: 'recursive' | ||
|
|
||
| - name: Set LINODE_CLI_TOKEN | ||
| run: | | ||
| echo "LINODE_CLI_TOKEN=${{ secrets[inputs.use_minimal_test_account == 'true' && 'MINIMAL_LINODE_TOKEN' || 'LINODE_TOKEN'] }}" >> $GITHUB_ENV | ||
|
|
||
| - name: Download kubectl and calicoctl for LKE clusters | ||
| run: | | ||
| curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" | ||
| curl -LO "https://github.com/projectcalico/calico/releases/download/v3.25.0/calicoctl-linux-amd64" | ||
| chmod +x calicoctl-linux-amd64 kubectl | ||
| mv calicoctl-linux-amd64 /usr/local/bin/calicoctl | ||
| mv kubectl /usr/local/bin/kubectl | ||
|
|
||
| - name: Apply Calico Rules to LKE | ||
| run: | | ||
| cd e2e_scripts/cloud_security_scripts/lke_calico_rules/ && ./lke_calico_rules_e2e.sh | ||
| env: | ||
| LINODE_TOKEN: ${{ env.LINODE_CLI_TOKEN }} | ||
|
|
||
| add-fw-to-remaining-instances: | ||
| runs-on: ubuntu-latest | ||
| needs: [integration_tests] | ||
| if: ${{ success() || failure() }} | ||
|
|
||
| steps: | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.x' | ||
|
|
||
| - name: Install Linode CLI | ||
| run: | | ||
| pip install linode-cli | ||
|
|
||
| - name: Set LINODE_CLI_TOKEN | ||
| run: | | ||
| echo "LINODE_CLI_TOKEN=${{ secrets[inputs.use_minimal_test_account == 'true' && 'MINIMAL_LINODE_TOKEN' || 'LINODE_TOKEN'] }}" >> $GITHUB_ENV | ||
|
|
||
| - name: Create Firewall and Attach to Instances | ||
| run: | | ||
| FIREWALL_ID=$(linode-cli firewalls create --label "e2e-fw-$(date +%s)" --rules.inbound_policy "DROP" --rules.outbound_policy "ACCEPT" --text --format=id --no-headers) | ||
| echo "Created Firewall with ID: $FIREWALL_ID" | ||
|
|
||
| for instance_id in $(linode-cli linodes list --format "id" --text --no-header); do | ||
| echo "Attaching firewall to instance: $instance_id" | ||
| if linode-cli firewalls device-create "$FIREWALL_ID" --id "$instance_id" --type linode; then | ||
| echo "Firewall attached to instance $instance_id successfully." | ||
| else | ||
| echo "An error occurred while attaching firewall to instance $instance_id. Skipping..." | ||
| fi | ||
| done | ||
| env: | ||
| LINODE_CLI_TOKEN: ${{ env.LINODE_CLI_TOKEN }} | ||
|
|
||
| notify-slack: | ||
| runs-on: ubuntu-latest | ||
| needs: [integration_tests] | ||
| if: ${{ (success() || failure()) && github.repository == 'linode/linode-cli' }} # Run even if integration tests fail and only on main repository | ||
| if: always() && github.repository == 'linode/linode-cli' # Run even if integration tests fail and only on main repository | ||
|
|
||
| steps: | ||
| - name: Notify Slack | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to take what is in
devfor this. I personally think module make things a bit more simpler