diff --git a/README.md b/README.md index cb89732f..16c889a7 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,6 @@ Policies are implemented by rendering template bundles, which are usually embedd #### releng This bundle contains all of the code required to build and test all the artefacts that are created when a release is made. Releases are made by pushing a tag to github. -The opt-in [MCP qualification policy](docs/mcp-qualification.md) keeps serial MCP -stack coverage in a shared workflow while generating its required release callers. - #### gpac This bundle implements terraform manifests that model the state of the repos under management in github. This is used to [keep track of release branches](https://tyktech.atlassian.net/wiki/spaces/EN/pages/1907228677/Release+branches) as they are created. diff --git a/config/config.yaml b/config/config.yaml index 0131e932..7dcb388f 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -265,7 +265,6 @@ policy: - resolve-dashboard - plugin-compiler - plugin-compiler-ng - - mcp-qualification - docs-preview release-5.3: buildenv: 1.24-bullseye @@ -470,7 +469,6 @@ policy: features: - nightly-e2e - fips - - mcp-qualification - pr-no-cache-export - docs-preview release-5.3: @@ -672,7 +670,6 @@ policy: branches: master: features: - - mcp-qualification - docs-preview release-1.14: release-1.14.1: @@ -768,7 +765,6 @@ policy: branches: master: features: - - mcp-qualification - fips - release-test - docs-preview diff --git a/docs/mcp-qualification.md b/docs/mcp-qualification.md deleted file mode 100644 index 9484178e..00000000 --- a/docs/mcp-qualification.md +++ /dev/null @@ -1,48 +0,0 @@ -# MCP qualification policy - -The opt-in `mcp-qualification` feature generates a release workflow caller for -the shared workflow in `TykTechnologies/github-actions`. It supports Gateway -(`tyk`), Dashboard (`tyk-analytics`), Pump (`tyk-pump`) and MDCB (`tyk-sink`) -repositories with an `api` test job. Other repositories and branches retain -their existing jobs and test selection. - -Enable the feature in `config/config.yaml` only for branches whose selected -Dashboard revision includes the MCP runner and fixtures. Workflow revisions -are pinned in `mcp-qualification.gotmpl`. - -Every managed release workflow subscribes to `ready_for_review`, independent -of the MCP flag. This lets existing draft-gated build and API jobs start when -a PR becomes ready. - -When enabled, the policy: - -- Calls the shared workflow at an immutable commit with `PROBE_APP_ID`, - `PROBE_APP_PRIVATE_KEY` and `DASH_LICENSE` forwarded. MDCB callers also forward - `MDCB_LICENSE`. -- Includes its result in the required aggregate job dependencies. -- Excludes MCP from the parallel release API suite only when the mandatory - serial qualification job is generated. - -The reusable workflow lives in `github-actions`; tests, requirements, runner -and compose fixtures remain under Dashboard's `tests/api`. The shared job -builds components from coordinated source revisions and runs the four -MessagePack/Protobuf × MongoDB/PostgreSQL combinations. Each caller exercises -its component's own PR head. - -The generated caller, parallel API-suite exclusion and aggregate dependency -must remain together. Removing the qualification job while retaining the -exclusion leaves MCP coverage missing. Drift checks compare generated workflows -against the deployed Gromit policy. - -## MDCB qualification - -The sink caller selects `topology: mdcb`. Gateway, Dashboard and Pump callers -use the direct topology. Both topologies require Dashboard fixtures compatible -with the selected sources and a GitHub App with read access to the component -repositories. MDCB also requires sink access and its licence secret. - -The MDCB profiles verify API, key and policy propagation through RPC, persisted -protocol metadata, exact signed 64-bit error boundaries and one completion -record per request. A data-plane hybrid Pump reads both Redis serializers and -sends raw records over RPC without a local persistence output. MDCB persists -the records with `forward_analytics_to_pump=false`. diff --git a/policy/mcp_qualification_test.go b/policy/mcp_qualification_test.go deleted file mode 100644 index b4200808..00000000 --- a/policy/mcp_qualification_test.go +++ /dev/null @@ -1,183 +0,0 @@ -package policy - -import ( - "slices" - "testing" - - "github.com/TykTechnologies/gromit/config" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" -) - -func TestMCPQualificationRelease(t *testing.T) { - config.LoadConfig("") - var pol Policies - require.NoError(t, LoadRepoPolicies(&pol)) - - for _, repository := range []string{"tyk", "tyk-analytics", "tyk-pump", "tyk-sink"} { - for _, enabled := range []bool{false, true} { - name := repository + "/disabled" - if enabled { - name = repository + "/enabled" - } - t.Run(name, func(t *testing.T) { - repo, err := pol.GetRepoPolicy(repository) - require.NoError(t, err) - require.NoError(t, repo.SetBranch("master")) - // Exercise both states independently of the production rollout. - repo.Branchvals.Features = slices.DeleteFunc(repo.Branchvals.Features, func(feature string) bool { - return feature == "mcp-qualification" - }) - if enabled { - repo.Branchvals.Features = append(repo.Branchvals.Features, "mcp-qualification") - } - bundle, err := NewBundle(repo.Branchvals.Features) - require.NoError(t, err) - outputDir := t.TempDir() - _, err = bundle.Render(repo, outputDir, nil) - require.NoError(t, err) - - var workflow struct { - On struct { - PullRequest struct { - Types []string - } `yaml:"pull_request"` - } - Jobs map[string]struct { - Uses string - Needs any - If string - Secrets any - Permissions map[string]string - With map[string]string - Steps []struct { - Name string - With map[string]string - } - } - } - require.NoError(t, yaml.Unmarshal([]byte(readRenderedFile(t, outputDir, - ".github/workflows/release.yml")), &workflow)) - // Leaving draft must start existing CI even when MCP is disabled. - assert.Equal(t, []string{"opened", "synchronize", "reopened", "ready_for_review", "labeled"}, - workflow.On.PullRequest.Types) - qualification, exists := workflow.Jobs["mcp-qualification"] - assert.Equal(t, enabled, exists) - aggregate, exists := workflow.Jobs["aggregator-ci-test"] - require.True(t, exists) - dependencies, ok := aggregate.Needs.([]any) - require.True(t, ok) - // The serial suite must supplement all existing required jobs. - for _, dependency := range []string{"dep-guard", "goreleaser", "api-tests"} { - assert.Contains(t, dependencies, dependency) - } - if repository == "tyk-analytics" { - assert.Contains(t, dependencies, "ui-tests") - } - if repository == "tyk-sink" { - assert.Contains(t, dependencies, "release-tests") - } - api, exists := workflow.Jobs["api-tests"] - require.True(t, exists) - foundAPI := false - for _, step := range api.Steps { - if step.Name != "Run API tests" { - continue - } - foundAPI = true - markers, filtered := step.With["api_markers"] - assert.Equal(t, enabled, filtered, - "MCP may only leave the parallel suite when serial qualification is required") - if enabled { - assert.Equal(t, "(${{ matrix.envfiles.apimarkers }}) and not mcp", markers) - } - } - require.True(t, foundAPI) - if enabled { - // This revision grants access to the private api-definition module. - wantRevision := "aee08ff727a05046f05ab8236c57b2947a037834" - if repository == "tyk-sink" { - wantRevision = "908962edea3557f278dda483face055b8c0e5516" - assert.Equal(t, map[string]string{"topology": "mdcb"}, qualification.With) - } else { - assert.Empty(t, qualification.With) - } - assert.Equal(t, "TykTechnologies/github-actions/.github/workflows/mcp-qualification.yml@"+wantRevision, qualification.Uses) - assert.Equal(t, "dep-guard", qualification.Needs) - assert.Equal(t, "github.event_name == 'pull_request' && github.event.pull_request.draft == false", qualification.If) - wantSecrets := map[string]any{ - "PROBE_APP_ID": "${{ secrets.PROBE_APP_ID }}", - "PROBE_APP_PRIVATE_KEY": "${{ secrets.PROBE_APP_PRIVATE_KEY }}", - "DASH_LICENSE": "${{ secrets.DASH_LICENSE }}", - } - if repository == "tyk-sink" { - wantSecrets["MDCB_LICENSE"] = "${{ secrets.MDCB_LICENSE }}" - } - assert.Equal(t, wantSecrets, qualification.Secrets) - assert.Equal(t, map[string]string{"contents": "read"}, qualification.Permissions) - assert.Contains(t, dependencies, "mcp-qualification") - } else { - assert.NotContains(t, dependencies, "mcp-qualification") - } - if repository == "tyk-analytics" && enabled { - // Nightly has no serial replacement; its existing MCP selection stays intact. - nightly := readRenderedFile(t, outputDir, ".github/workflows/nightly-e2e-tests.yml") - assert.NotContains(t, nightly, "and not mcp") - } - }) - } - } -} - -func TestMCPQualificationProductionPolicy(t *testing.T) { - config.LoadConfig("") - var pol Policies - require.NoError(t, LoadRepoPolicies(&pol)) - - // Keep activation scoped to master: older release policies must not - // inherit it from their repository or group. - for _, group := range pol.Groups { - for repository := range group.Repos { - repo, err := pol.GetRepoPolicy(repository) - require.NoError(t, err) - for _, branch := range repo.GetAllBranches() { - t.Run(repository+"/"+branch, func(t *testing.T) { - repo, err := pol.GetRepoPolicy(repository) - require.NoError(t, err) - require.NoError(t, repo.SetBranch(branch)) - wantEnabled := branch == "master" && slices.Contains( - []string{"tyk", "tyk-analytics", "tyk-pump", "tyk-sink"}, repository) - assert.Equal(t, wantEnabled, slices.Contains(repo.Branchvals.Features, "mcp-qualification")) - }) - } - } - } -} - -func TestMCPQualificationRejectsUnsupportedPolicy(t *testing.T) { - config.LoadConfig("") - var pol Policies - require.NoError(t, LoadRepoPolicies(&pol)) - for _, test := range []struct { - name string - mutate func(*RepoPolicy) - message string - }{ - {"unsupported-repository", func(repo *RepoPolicy) { repo.Name = "tyk-sync" }, "supports only tyk"}, - {"missing-api-suite", func(repo *RepoPolicy) { repo.Branchvals.Tests = nil }, "requires the api test job"}, - } { - t.Run(test.name, func(t *testing.T) { - repo, err := pol.GetRepoPolicy("tyk-pump") - require.NoError(t, err) - require.NoError(t, repo.SetBranch("master")) - repo.Branchvals.Features = append(repo.Branchvals.Features, "mcp-qualification") - test.mutate(&repo) - bundle, err := NewBundle(repo.Branchvals.Features) - require.NoError(t, err) - _, err = bundle.Render(repo, t.TempDir(), nil) - require.Error(t, err) - assert.Contains(t, err.Error(), test.message) - }) - } -} diff --git a/policy/templates/releng/.github/workflows/release.yml b/policy/templates/releng/.github/workflows/release.yml index c988268a..e6330066 100644 --- a/policy/templates/releng/.github/workflows/release.yml +++ b/policy/templates/releng/.github/workflows/release.yml @@ -58,8 +58,6 @@ jobs: {{ end }} {{- end }} {{/* empty tests */}} -{{- template "mcp-qualification" . }} - {{- template "aggregator" . }} {{- template "smoke-tests" . }} diff --git a/policy/templates/releng/.github/workflows/release.yml.d/aggregator.gotmpl b/policy/templates/releng/.github/workflows/release.yml.d/aggregator.gotmpl index 6ce5b03d..96bb47f9 100644 --- a/policy/templates/releng/.github/workflows/release.yml.d/aggregator.gotmpl +++ b/policy/templates/releng/.github/workflows/release.yml.d/aggregator.gotmpl @@ -19,9 +19,6 @@ {{- if and (eq .Name "tyk-sink") (has "release-test" .Branchvals.Features) -}} , release-tests {{- end -}} - {{- if has "mcp-qualification" .Branchvals.Features -}} - , mcp-qualification - {{- end -}} ] if: {{`${{ always() && github.event_name == 'pull_request' }}`}} steps: diff --git a/policy/templates/releng/.github/workflows/release.yml.d/mcp-qualification.gotmpl b/policy/templates/releng/.github/workflows/release.yml.d/mcp-qualification.gotmpl deleted file mode 100644 index 46b6b292..00000000 --- a/policy/templates/releng/.github/workflows/release.yml.d/mcp-qualification.gotmpl +++ /dev/null @@ -1,30 +0,0 @@ -{{ define "mcp-qualification" }} -{{- if has "mcp-qualification" .Branchvals.Features }} -{{- if not (has .Name (list "tyk" "tyk-analytics" "tyk-pump" "tyk-sink")) }} -{{- fail "mcp-qualification supports only tyk, tyk-analytics, tyk-pump and tyk-sink" }} -{{- end }} -{{- if not (has "api" .Branchvals.Tests) }} -{{- fail "mcp-qualification requires the api test job" }} -{{- end }} - mcp-qualification: - name: Coordinated MCP qualification - needs: dep-guard - if: github.event_name == 'pull_request' && github.event.pull_request.draft == false - {{- if eq .Name "tyk-sink" }} - uses: TykTechnologies/github-actions/.github/workflows/mcp-qualification.yml@908962edea3557f278dda483face055b8c0e5516 - with: - topology: mdcb - {{- else }} - uses: TykTechnologies/github-actions/.github/workflows/mcp-qualification.yml@aee08ff727a05046f05ab8236c57b2947a037834 - {{- end }} - secrets: - PROBE_APP_ID: {{`${{ secrets.PROBE_APP_ID }}`}} - PROBE_APP_PRIVATE_KEY: {{`${{ secrets.PROBE_APP_PRIVATE_KEY }}`}} - DASH_LICENSE: {{`${{ secrets.DASH_LICENSE }}`}} - {{- if eq .Name "tyk-sink" }} - MDCB_LICENSE: {{`${{ secrets.MDCB_LICENSE }}`}} - {{- end }} - permissions: - contents: read -{{- end }} -{{ end }} diff --git a/policy/templates/subtemplates/auto/auto-test.gotmpl b/policy/templates/subtemplates/auto/auto-test.gotmpl index 345b7d6c..e71979df 100644 --- a/policy/templates/subtemplates/auto/auto-test.gotmpl +++ b/policy/templates/subtemplates/auto/auto-test.gotmpl @@ -208,10 +208,6 @@ id: test_execution with: user_api_secret: {{`${{ steps.env_up.outputs.USER_API_SECRET }}`}} - {{- if and (eq .flow "releng") (has "mcp-qualification" .dot.Branchvals.Features) }} - # MCP coverage runs serially against coordinated sources in the mandatory job below. - api_markers: ({{`${{ matrix.envfiles.apimarkers }}`}}) and not mcp - {{- end }} {{ else if eq .test "ui" }} - name: Fix private module deps env: diff --git a/policy/testdata/golden/tyk-analytics/master/.github/workflows/release.yml b/policy/testdata/golden/tyk-analytics/master/.github/workflows/release.yml index 743675db..f4c92a7f 100644 --- a/policy/testdata/golden/tyk-analytics/master/.github/workflows/release.yml +++ b/policy/testdata/golden/tyk-analytics/master/.github/workflows/release.yml @@ -833,8 +833,6 @@ jobs: id: test_execution with: user_api_secret: ${{ steps.env_up.outputs.USER_API_SECRET }} - # MCP coverage runs serially against coordinated sources in the mandatory job below. - api_markers: (${{ matrix.envfiles.apimarkers }}) and not mcp - name: Generate test reports and collect logs uses: TykTechnologies/github-actions/.github/actions/tests/reporting@production if: always() && (steps.test_execution.conclusion != 'skipped') @@ -847,22 +845,11 @@ jobs: with: report_xml: 'true' execution_status: ${{ steps.test_execution.outcome }} - mcp-qualification: - name: Coordinated MCP qualification - needs: dep-guard - if: github.event_name == 'pull_request' && github.event.pull_request.draft == false - uses: TykTechnologies/github-actions/.github/workflows/mcp-qualification.yml@aee08ff727a05046f05ab8236c57b2947a037834 - secrets: - PROBE_APP_ID: ${{ secrets.PROBE_APP_ID }} - PROBE_APP_PRIVATE_KEY: ${{ secrets.PROBE_APP_PRIVATE_KEY }} - DASH_LICENSE: ${{ secrets.DASH_LICENSE }} - permissions: - contents: read aggregator-ci-test: name: Aggregated CI Status runs-on: ${{ vars.DEFAULT_RUNNER }} # Dynamically determine which jobs to depend on based on repository configuration - needs: [dep-guard, goreleaser, ui-tests, api-tests, mcp-qualification] + needs: [dep-guard, goreleaser, ui-tests, api-tests] if: ${{ always() && github.event_name == 'pull_request' }} steps: - name: Aggregate results diff --git a/policy/testdata/golden/tyk-pump/master/.github/workflows/release.yml b/policy/testdata/golden/tyk-pump/master/.github/workflows/release.yml index 8e0f77e9..32d25655 100644 --- a/policy/testdata/golden/tyk-pump/master/.github/workflows/release.yml +++ b/policy/testdata/golden/tyk-pump/master/.github/workflows/release.yml @@ -639,8 +639,6 @@ jobs: id: test_execution with: user_api_secret: ${{ steps.env_up.outputs.USER_API_SECRET }} - # MCP coverage runs serially against coordinated sources in the mandatory job below. - api_markers: (${{ matrix.envfiles.apimarkers }}) and not mcp - name: Generate test reports and collect logs uses: TykTechnologies/github-actions/.github/actions/tests/reporting@production if: always() && (steps.test_execution.conclusion != 'skipped') @@ -653,22 +651,11 @@ jobs: with: report_xml: 'true' execution_status: ${{ steps.test_execution.outcome }} - mcp-qualification: - name: Coordinated MCP qualification - needs: dep-guard - if: github.event_name == 'pull_request' && github.event.pull_request.draft == false - uses: TykTechnologies/github-actions/.github/workflows/mcp-qualification.yml@aee08ff727a05046f05ab8236c57b2947a037834 - secrets: - PROBE_APP_ID: ${{ secrets.PROBE_APP_ID }} - PROBE_APP_PRIVATE_KEY: ${{ secrets.PROBE_APP_PRIVATE_KEY }} - DASH_LICENSE: ${{ secrets.DASH_LICENSE }} - permissions: - contents: read aggregator-ci-test: name: Aggregated CI Status runs-on: ${{ vars.DEFAULT_RUNNER }} # Dynamically determine which jobs to depend on based on repository configuration - needs: [dep-guard, goreleaser, api-tests, mcp-qualification] + needs: [dep-guard, goreleaser, api-tests] if: ${{ always() && github.event_name == 'pull_request' }} steps: - name: Aggregate results diff --git a/policy/testdata/golden/tyk-sink/master/.github/workflows/release.yml b/policy/testdata/golden/tyk-sink/master/.github/workflows/release.yml index 54396cef..4765e6dc 100644 --- a/policy/testdata/golden/tyk-sink/master/.github/workflows/release.yml +++ b/policy/testdata/golden/tyk-sink/master/.github/workflows/release.yml @@ -638,8 +638,6 @@ jobs: id: test_execution with: user_api_secret: ${{ steps.env_up.outputs.USER_API_SECRET }} - # MCP coverage runs serially against coordinated sources in the mandatory job below. - api_markers: (${{ matrix.envfiles.apimarkers }}) and not mcp - name: Generate test reports and collect logs uses: TykTechnologies/github-actions/.github/actions/tests/reporting@production if: always() && (steps.test_execution.conclusion != 'skipped') @@ -652,25 +650,11 @@ jobs: with: report_xml: 'true' execution_status: ${{ steps.test_execution.outcome }} - mcp-qualification: - name: Coordinated MCP qualification - needs: dep-guard - if: github.event_name == 'pull_request' && github.event.pull_request.draft == false - uses: TykTechnologies/github-actions/.github/workflows/mcp-qualification.yml@908962edea3557f278dda483face055b8c0e5516 - with: - topology: mdcb - secrets: - PROBE_APP_ID: ${{ secrets.PROBE_APP_ID }} - PROBE_APP_PRIVATE_KEY: ${{ secrets.PROBE_APP_PRIVATE_KEY }} - DASH_LICENSE: ${{ secrets.DASH_LICENSE }} - MDCB_LICENSE: ${{ secrets.MDCB_LICENSE }} - permissions: - contents: read aggregator-ci-test: name: Aggregated CI Status runs-on: ${{ vars.DEFAULT_RUNNER }} # Dynamically determine which jobs to depend on based on repository configuration - needs: [dep-guard, goreleaser, api-tests, release-tests, mcp-qualification] + needs: [dep-guard, goreleaser, api-tests, release-tests] if: ${{ always() && github.event_name == 'pull_request' }} steps: - name: Aggregate results diff --git a/policy/testdata/golden/tyk/master/.github/workflows/release.yml b/policy/testdata/golden/tyk/master/.github/workflows/release.yml index cc5dfd74..8b83bd0f 100644 --- a/policy/testdata/golden/tyk/master/.github/workflows/release.yml +++ b/policy/testdata/golden/tyk/master/.github/workflows/release.yml @@ -1210,8 +1210,6 @@ jobs: id: test_execution with: user_api_secret: ${{ steps.env_up.outputs.USER_API_SECRET }} - # MCP coverage runs serially against coordinated sources in the mandatory job below. - api_markers: (${{ matrix.envfiles.apimarkers }}) and not mcp - name: Generate test reports and collect logs uses: TykTechnologies/github-actions/.github/actions/tests/reporting@production if: always() && (steps.test_execution.conclusion != 'skipped') @@ -1224,22 +1222,11 @@ jobs: with: report_xml: 'true' execution_status: ${{ steps.test_execution.outcome }} - mcp-qualification: - name: Coordinated MCP qualification - needs: dep-guard - if: github.event_name == 'pull_request' && github.event.pull_request.draft == false - uses: TykTechnologies/github-actions/.github/workflows/mcp-qualification.yml@aee08ff727a05046f05ab8236c57b2947a037834 - secrets: - PROBE_APP_ID: ${{ secrets.PROBE_APP_ID }} - PROBE_APP_PRIVATE_KEY: ${{ secrets.PROBE_APP_PRIVATE_KEY }} - DASH_LICENSE: ${{ secrets.DASH_LICENSE }} - permissions: - contents: read aggregator-ci-test: name: Aggregated CI Status runs-on: ${{ vars.DEFAULT_RUNNER }} # Dynamically determine which jobs to depend on based on repository configuration - needs: [dep-guard, goreleaser, api-tests, mcp-qualification] + needs: [dep-guard, goreleaser, api-tests] if: ${{ always() && github.event_name == 'pull_request' }} steps: - name: Aggregate results