| Eric Ball | 96e7f8f | 2026-06-26 16:56:18 -0700 | [diff] [blame^] | 1 | --- |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # SPDX-FileCopyrightText: 2026 The Linux Foundation |
| 4 | name: Sanity Test |
| 5 | |
| 6 | # yamllint disable-line rule:truthy |
| 7 | on: |
| 8 | workflow_call: |
| 9 | inputs: |
| 10 | GERRIT_BRANCH: |
| 11 | description: "Branch that change is against" |
| 12 | required: true |
| 13 | type: string |
| 14 | GERRIT_PROJECT: |
| 15 | description: "Project in Gerrit" |
| 16 | required: true |
| 17 | type: string |
| 18 | GERRIT_REFSPEC: |
| 19 | description: "Gerrit refspec of change" |
| 20 | required: true |
| 21 | type: string |
| 22 | EC2_INSTANCE_TYPE: |
| 23 | description: "EC2 instance type" |
| 24 | required: false |
| 25 | type: string |
| 26 | default: "t2.xlarge" |
| 27 | TEST_TARGETS: |
| 28 | description: "List of test targets" |
| 29 | required: false |
| 30 | type: string |
| 31 | default: | |
| 32 | - target: sanity-kind-att |
| 33 | workflow: att |
| 34 | flags: "" |
| 35 | teardown: true |
| 36 | logging: true |
| 37 | - target: sanity-kind-dt |
| 38 | workflow: dt |
| 39 | flags: "" |
| 40 | teardown: true |
| 41 | logging: true |
| 42 | - target: sanity-kind-tt |
| 43 | workflow: tt |
| 44 | flags: "" |
| 45 | teardown: true |
| 46 | logging: true |
| 47 | EXTRA_HELM_FLAGS: |
| 48 | description: "Additional Helm flags for deployment" |
| 49 | required: false |
| 50 | type: string |
| 51 | default: "" |
| 52 | LOG_LEVEL: |
| 53 | description: "Log level for VOLTHA components (DEBUG, INFO, WARN, ERROR)" |
| 54 | required: false |
| 55 | type: string |
| 56 | default: "INFO" |
| 57 | TIMEOUT: |
| 58 | description: "Timeout in minutes for the entire action" |
| 59 | required: false |
| 60 | type: string |
| 61 | default: "240" |
| 62 | OLTS: |
| 63 | description: "Number of OLTs to simulate" |
| 64 | required: false |
| 65 | type: string |
| 66 | default: "1" |
| 67 | WITH_MONITORING: |
| 68 | description: "Enable monitoring with prometheus" |
| 69 | required: false |
| 70 | type: string |
| 71 | default: "false" |
| 72 | ENABLE_MAC_LEARNING: |
| 73 | description: "Enable MAC learning in VOLTHA" |
| 74 | required: false |
| 75 | type: string |
| 76 | default: "false" |
| 77 | EXTRA_ROBOT_ARGS: |
| 78 | description: "Additional arguments for Robot Framework" |
| 79 | required: false |
| 80 | type: string |
| 81 | default: "" |
| 82 | secrets: |
| 83 | GERRIT_SSH_PRIVKEY: |
| 84 | description: "SSH Key for the authorized user account" |
| 85 | required: true |
| 86 | AWS_ACCESS_KEY_ID: |
| 87 | description: "AWS access key ID" |
| 88 | required: true |
| 89 | AWS_SECRET_ACCESS_KEY: |
| 90 | description: "AWS secret access key" |
| 91 | required: true |
| 92 | EC2_IMAGE_ID: |
| 93 | description: "EC2 image ID" |
| 94 | required: true |
| 95 | EC2_SUBNET_ID: |
| 96 | description: "EC2 subnet ID" |
| 97 | required: true |
| 98 | EC2_SG_ID: |
| 99 | description: "EC2 security group ID" |
| 100 | required: true |
| 101 | GH_TO_AWS_KEY: |
| 102 | description: "GitHub to AWS key" |
| 103 | required: true |
| 104 | |
| 105 | jobs: |
| 106 | start-runner: |
| 107 | name: Start self-hosted EC2 runner |
| 108 | runs-on: ubuntu-latest |
| 109 | outputs: |
| 110 | label: ${{ steps.start-ec2-runner.outputs.label }} |
| 111 | ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }} |
| 112 | steps: |
| 113 | - name: Configure AWS credentials |
| 114 | uses: aws-actions/configure-aws-credentials@v4 |
| 115 | with: |
| 116 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 117 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 118 | aws-region: ${{ vars.AWS_REGION }} |
| 119 | - name: Start EC2 runner |
| 120 | id: start-ec2-runner |
| 121 | uses: machulav/ec2-github-runner@v2 |
| 122 | with: |
| 123 | mode: start |
| 124 | github-token: ${{ secrets.GH_TO_AWS_KEY }} |
| 125 | ec2-image-id: ${{ secrets.EC2_IMAGE_ID }} |
| 126 | ec2-instance-type: ${{ inputs.EC2_INSTANCE_TYPE }} |
| 127 | subnet-id: ${{ secrets.EC2_SUBNET_ID }} |
| 128 | security-group-id: ${{ secrets.EC2_SG_ID }} |
| 129 | |
| 130 | sanity-tests: |
| 131 | needs: start-runner |
| 132 | runs-on: ${{ needs.start-runner.outputs.label }} |
| 133 | steps: |
| 134 | - name: Run Sanity Tests |
| 135 | uses: opencord/shared-workflows/.github/actions/bbsim-tests@main |
| 136 | with: |
| 137 | branch: ${{ inputs.GERRIT_BRANCH }} |
| 138 | test-targets: ${{ inputs.TEST_TARGETS }} |
| 139 | gerrit-project: ${{ inputs.GERRIT_PROJECT }} |
| 140 | gerrit-refspec: ${{ inputs.GERRIT_REFSPEC }} |
| 141 | extra-helm-flags: ${{ inputs.EXTRA_HELM_FLAGS }} |
| 142 | log-level: ${{ inputs.LOG_LEVEL }} |
| 143 | timeout: ${{ inputs.TIMEOUT }} |
| 144 | olts: ${{ inputs.OLTS }} |
| 145 | with-monitoring: ${{ inputs.WITH_MONITORING }} |
| 146 | enable-mac-learning: ${{ inputs.ENABLE_MAC_LEARNING }} |
| 147 | extra-robot-args: ${{ inputs.EXTRA_ROBOT_ARGS }} |
| 148 | |
| 149 | stop-runner: |
| 150 | name: Stop self-hosted EC2 runner |
| 151 | needs: |
| 152 | - start-runner # required to get output from the start-runner job |
| 153 | - sanity-tests |
| 154 | runs-on: ubuntu-latest |
| 155 | if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs |
| 156 | steps: |
| 157 | - name: Configure AWS credentials |
| 158 | uses: aws-actions/configure-aws-credentials@v4 |
| 159 | with: |
| 160 | aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 161 | aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 162 | aws-region: ${{ vars.AWS_REGION }} |
| 163 | - name: Stop EC2 runner |
| 164 | uses: machulav/ec2-github-runner@v2 |
| 165 | with: |
| 166 | mode: stop |
| 167 | github-token: ${{ secrets.GH_TO_AWS_KEY }} |
| 168 | label: ${{ needs.start-runner.outputs.label }} |
| 169 | ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }} |