|
| 1 | +name: "Pipeline - AutoGluon" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + config-file: |
| 7 | + description: "Path to image config YAML" |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + tag-suffix: |
| 11 | + description: "CI tag suffix (run_id or pr-NUMBER)" |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + build: |
| 15 | + description: "Whether to build the image (false = skip build, test against prod)" |
| 16 | + required: false |
| 17 | + type: boolean |
| 18 | + default: true |
| 19 | + run-sanity-test: |
| 20 | + description: "Run sanity tests" |
| 21 | + required: false |
| 22 | + type: boolean |
| 23 | + default: true |
| 24 | + run-unit-test: |
| 25 | + description: "Run serving adapter unit tests" |
| 26 | + required: false |
| 27 | + type: boolean |
| 28 | + default: true |
| 29 | + run-security-test: |
| 30 | + description: "Run security tests" |
| 31 | + required: false |
| 32 | + type: boolean |
| 33 | + default: true |
| 34 | + run-telemetry-test: |
| 35 | + description: "Run telemetry tests" |
| 36 | + required: false |
| 37 | + type: boolean |
| 38 | + default: true |
| 39 | + run-sagemaker-test: |
| 40 | + description: "Run SageMaker training and endpoint tests" |
| 41 | + required: false |
| 42 | + type: boolean |
| 43 | + default: true |
| 44 | + release: |
| 45 | + description: "Run release job after tests pass" |
| 46 | + required: false |
| 47 | + type: boolean |
| 48 | + default: false |
| 49 | + outputs: |
| 50 | + image-uri: |
| 51 | + description: "Built image URI (empty if build was skipped)" |
| 52 | + value: ${{ jobs.build.outputs.image-uri }} |
| 53 | + |
| 54 | +jobs: |
| 55 | + build: |
| 56 | + if: ${{ inputs.build }} |
| 57 | + concurrency: |
| 58 | + group: ${{ github.workflow }}-build-${{ inputs.config-file }}-${{ github.ref }} |
| 59 | + cancel-in-progress: true |
| 60 | + runs-on: |
| 61 | + - codebuild-runner-${{ github.run_id }}-${{ github.run_attempt }} |
| 62 | + fleet:x86-build-runner |
| 63 | + buildspec-override:true |
| 64 | + timeout-minutes: 120 |
| 65 | + outputs: |
| 66 | + image-uri: ${{ steps.build.outputs.image-uri }} |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v6 |
| 69 | + - id: build |
| 70 | + uses: ./.github/actions/build-image |
| 71 | + with: |
| 72 | + config-file: ${{ inputs.config-file }} |
| 73 | + aws-account-id: ${{ vars.CI_AWS_ACCOUNT_ID }} |
| 74 | + aws-region: ${{ vars.AWS_REGION }} |
| 75 | + tag-suffix: ${{ inputs.tag-suffix }} |
| 76 | + |
| 77 | + check: |
| 78 | + if: ${{ always() && !failure() && !cancelled() }} |
| 79 | + needs: [build] |
| 80 | + concurrency: |
| 81 | + group: ${{ github.workflow }}-check-${{ inputs.config-file }}-${{ github.ref }} |
| 82 | + cancel-in-progress: true |
| 83 | + uses: ./.github/workflows/_reusable.check-test-pass.yml |
| 84 | + with: |
| 85 | + config-file: ${{ inputs.config-file }} |
| 86 | + image-uri: ${{ needs.build.outputs.image-uri || '' }} |
| 87 | + suites: '["sanity", "telemetry", "autogluon/sagemaker"]' |
| 88 | + |
| 89 | + unit-tests: |
| 90 | + if: ${{ inputs.run-unit-test }} |
| 91 | + uses: ./.github/workflows/autogluon.tests-unit.yml |
| 92 | + |
| 93 | + sanity-test: |
| 94 | + if: ${{ always() && !cancelled() && inputs.run-sanity-test && needs.build.result != 'failure' && fromJSON(needs.check.outputs.skips || '{}')['sanity'] != true }} |
| 95 | + needs: [build, check] |
| 96 | + concurrency: |
| 97 | + group: ${{ github.workflow }}-sanity-test-${{ inputs.config-file }}-${{ github.ref }} |
| 98 | + cancel-in-progress: true |
| 99 | + uses: ./.github/workflows/_reusable.sanity-tests.yml |
| 100 | + with: |
| 101 | + config-file: ${{ inputs.config-file }} |
| 102 | + image-uri: ${{ needs.build.outputs.image-uri || '' }} |
| 103 | + image-content-hash: ${{ needs.check.outputs.image-content-hash }} |
| 104 | + suite-code-hash: ${{ fromJSON(needs.check.outputs.suite-code-hashes || '{}')['sanity'] || '' }} |
| 105 | + |
| 106 | + security-test: |
| 107 | + if: ${{ always() && !failure() && !cancelled() && inputs.run-security-test }} |
| 108 | + needs: [build] |
| 109 | + concurrency: |
| 110 | + group: ${{ github.workflow }}-security-test-${{ inputs.config-file }}-${{ github.ref }} |
| 111 | + cancel-in-progress: true |
| 112 | + uses: ./.github/workflows/_reusable.security-tests.yml |
| 113 | + with: |
| 114 | + config-file: ${{ inputs.config-file }} |
| 115 | + image-uri: ${{ needs.build.outputs.image-uri || '' }} |
| 116 | + |
| 117 | + telemetry-test: |
| 118 | + if: ${{ always() && !cancelled() && inputs.run-telemetry-test && needs.build.result != 'failure' && fromJSON(needs.check.outputs.skips || '{}')['telemetry'] != true }} |
| 119 | + needs: [build, check] |
| 120 | + concurrency: |
| 121 | + group: ${{ github.workflow }}-telemetry-test-${{ inputs.config-file }}-${{ github.ref }} |
| 122 | + cancel-in-progress: false |
| 123 | + uses: ./.github/workflows/_reusable.telemetry-tests.yml |
| 124 | + with: |
| 125 | + config-file: ${{ inputs.config-file }} |
| 126 | + image-uri: ${{ needs.build.outputs.image-uri || '' }} |
| 127 | + image-content-hash: ${{ needs.check.outputs.image-content-hash }} |
| 128 | + suite-code-hash: ${{ fromJSON(needs.check.outputs.suite-code-hashes || '{}')['telemetry'] || '' }} |
| 129 | + |
| 130 | + sagemaker-tests: |
| 131 | + if: >- |
| 132 | + ${{ always() && !cancelled() && inputs.run-sagemaker-test && |
| 133 | + needs.build.result != 'failure' && |
| 134 | + fromJSON(needs.check.outputs.skips || '{}')['autogluon/sagemaker'] != true }} |
| 135 | + needs: [build, check] |
| 136 | + concurrency: |
| 137 | + group: ${{ github.workflow }}-sagemaker-tests-${{ inputs.config-file }}-${{ github.ref }} |
| 138 | + cancel-in-progress: false |
| 139 | + uses: ./.github/workflows/autogluon.tests-sagemaker.yml |
| 140 | + with: |
| 141 | + config-file: ${{ inputs.config-file }} |
| 142 | + image-uri: ${{ needs.build.outputs.image-uri || '' }} |
| 143 | + image-content-hash: ${{ needs.check.outputs.image-content-hash }} |
| 144 | + suite-code-hash: ${{ fromJSON(needs.check.outputs.suite-code-hashes || '{}')['autogluon/sagemaker'] || '' }} |
| 145 | + |
| 146 | + release-gate: |
| 147 | + if: >- |
| 148 | + github.ref == 'refs/heads/main' && |
| 149 | + (contains(github.workflow_ref, '.autorelease') || contains(github.workflow_ref, '.dispatch-release')) && |
| 150 | + !contains(github.workflow_ref, '.pr') && |
| 151 | + inputs.release && |
| 152 | + !failure() && !cancelled() && |
| 153 | + needs.build.result == 'success' |
| 154 | + needs: [build, unit-tests, sanity-test, security-test, telemetry-test, sagemaker-tests] |
| 155 | + runs-on: ubuntu-latest |
| 156 | + outputs: |
| 157 | + should-release: ${{ steps.check.outputs.should-release }} |
| 158 | + release-spec: ${{ steps.spec.outputs.release-spec }} |
| 159 | + environment: ${{ steps.check.outputs.environment }} |
| 160 | + steps: |
| 161 | + - uses: actions/checkout@v6 |
| 162 | + - id: check |
| 163 | + run: | |
| 164 | + SHOULD_RELEASE=$(yq '.release.release' "${{ inputs.config-file }}") |
| 165 | + ENVIRONMENT=$(yq '.release.environment' "${{ inputs.config-file }}") |
| 166 | + echo "should-release=${SHOULD_RELEASE}" >> $GITHUB_OUTPUT |
| 167 | + echo "environment=${ENVIRONMENT}" >> $GITHUB_OUTPUT |
| 168 | + - id: spec |
| 169 | + if: steps.check.outputs.should-release == 'true' |
| 170 | + uses: ./.github/actions/generate-release-spec |
| 171 | + with: |
| 172 | + config-file: ${{ inputs.config-file }} |
| 173 | + |
| 174 | + release: |
| 175 | + if: ${{ !failure() && !cancelled() && needs.release-gate.outputs.should-release == 'true' }} |
| 176 | + needs: [build, release-gate] |
| 177 | + uses: ./.github/workflows/_reusable.release-image.yml |
| 178 | + with: |
| 179 | + source-image-uri: ${{ needs.build.outputs.image-uri }} |
| 180 | + release-spec: ${{ needs.release-gate.outputs.release-spec }} |
| 181 | + environment: ${{ needs.release-gate.outputs.environment }} |
| 182 | + aws-region: ${{ vars.AWS_REGION }} |
| 183 | + secrets: inherit |
| 184 | + |
| 185 | + notify-failure: |
| 186 | + if: >- |
| 187 | + failure() && |
| 188 | + github.ref == 'refs/heads/main' && |
| 189 | + (contains(github.workflow_ref, '.autorelease') || contains(github.workflow_ref, '.dispatch-release')) && |
| 190 | + !contains(github.workflow_ref, '.pr') && |
| 191 | + inputs.release |
| 192 | + needs: [build, unit-tests, sanity-test, security-test, telemetry-test, sagemaker-tests, release-gate, release] |
| 193 | + runs-on: ubuntu-latest |
| 194 | + steps: |
| 195 | + - uses: actions/checkout@v6 |
| 196 | + - uses: ./.github/actions/notify-slack-failure |
| 197 | + with: |
| 198 | + webhook-url: ${{ secrets.SLACK_RELEASE_FAILURE_WEBHOOK_URL }} |
| 199 | + workflow-name: ${{ github.workflow }} |
| 200 | + config-file: ${{ inputs.config-file }} |
| 201 | + run-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
0 commit comments