From 342e6d2bec92f132a88d65c0a83d73015b3e6777 Mon Sep 17 00:00:00 2001 From: Alejandro Pena Date: Wed, 23 Jul 2025 13:20:21 +0200 Subject: [PATCH 1/5] Fix action imports --- .github/workflows/consumer.yml | 11 +++++------ .github/workflows/student-provider.yml | 6 +++--- .github/workflows/teacher-provider.yml | 8 ++++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/consumer.yml b/.github/workflows/consumer.yml index ece8f1b..ed878a5 100644 --- a/.github/workflows/consumer.yml +++ b/.github/workflows/consumer.yml @@ -34,15 +34,14 @@ jobs: needs: build runs-on: ubuntu-latest steps: - # Pasos 1: Preparar el entorno una sola vez - name: Checkout repository code uses: actions/checkout@v4 + - name: Setup Pact CLI uses: ./.github/actions/pact-cli-setup - # Paso 2: Ejecutar la secuencia de acciones - name: Publish Contract to Pact Broker - uses: ./.github/actions/publish-contract/action.yml + uses: ./.github/actions/publish-contract with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} consumer_version: ${{ github.sha }} @@ -52,7 +51,7 @@ jobs: - name: Can I Deploy? if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/can-i-deploy/action.yml + uses: ./.github/actions/can-i-deploy with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'consumer' @@ -62,7 +61,7 @@ jobs: - name: Deploy if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/deploy/action.yml + uses: ./.github/actions/deploy with: pacticipant: 'consumer' version: ${{ github.sha }} @@ -70,7 +69,7 @@ jobs: - name: Tag Deployment if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/tagging/action.yml + uses: ./.github/actions/tagging with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'consumer' diff --git a/.github/workflows/student-provider.yml b/.github/workflows/student-provider.yml index 5568c6d..d5c324b 100644 --- a/.github/workflows/student-provider.yml +++ b/.github/workflows/student-provider.yml @@ -45,7 +45,7 @@ jobs: uses: ./.github/actions/pact-cli-setup - name: Can I Deploy? - uses: ./.github/actions/can-i-deploy/action.yml + uses: ./.github/actions/can-i-deploy with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'student-provider' @@ -54,14 +54,14 @@ jobs: pact_broker_token: ${{ secrets.PACTFLOW_TOKEN }} - name: Deploy - uses: ./.github/actions/deploy/action.yml + uses: ./.github/actions/deploy with: pacticipant: 'student-provider' version: ${{ github.sha }} environment: ${{ github.event.inputs.environment }} - name: Tag Deployment - uses: ./.github/actions/tagging/action.yml + uses: ./.github/actions/tagging with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'student-provider' diff --git a/.github/workflows/teacher-provider.yml b/.github/workflows/teacher-provider.yml index 60dbb5c..70d3f19 100644 --- a/.github/workflows/teacher-provider.yml +++ b/.github/workflows/teacher-provider.yml @@ -45,7 +45,7 @@ jobs: uses: ./.github/actions/pact-cli-setup - name: Publish OpenAPI Specification - uses: ./.github/actions/publish-openapi/action.yml + uses: ./.github/actions/publish-openapi with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} provider_name: 'teacher-provider' @@ -59,7 +59,7 @@ jobs: - name: Can I Deploy? if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/can-i-deploy/action.yml + uses: ./.github/actions/can-i-deploy with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'teacher-provider' @@ -69,7 +69,7 @@ jobs: - name: Deploy if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/deploy/action.yml + uses: ./.github/actions/deploy with: pacticipant: 'teacher-provider' version: ${{ github.sha }} @@ -77,7 +77,7 @@ jobs: - name: Tag Deployment if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/tagging/action.yml + uses: ./.github/actions/tagging with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'teacher-provider' From d8666d465429601f5fde596246d050ab4708626c Mon Sep 17 00:00:00 2001 From: Alejandro Pena Date: Wed, 23 Jul 2025 13:24:43 +0200 Subject: [PATCH 2/5] Use environments existent in pactflow --- .github/actions/can-i-deploy/action.yml | 2 +- .github/workflows/consumer.yml | 12 ++++++------ .github/workflows/student-provider.yml | 8 ++++---- .github/workflows/teacher-provider.yml | 12 ++++++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/actions/can-i-deploy/action.yml b/.github/actions/can-i-deploy/action.yml index 444910a..7f1f197 100644 --- a/.github/actions/can-i-deploy/action.yml +++ b/.github/actions/can-i-deploy/action.yml @@ -12,7 +12,7 @@ inputs: description: 'The version of the component to check (e.g., commit SHA).' required: true environment: - description: 'The target environment for the check (e.g., DEV, PROD).' + description: 'The target environment for the check (e.g., test, production).' required: true pact_broker_token: description: 'The authentication token for the Pact Broker.' diff --git a/.github/workflows/consumer.yml b/.github/workflows/consumer.yml index ed878a5..cf99d82 100644 --- a/.github/workflows/consumer.yml +++ b/.github/workflows/consumer.yml @@ -4,11 +4,11 @@ on: workflow_dispatch: inputs: environment: - description: "Environment to deploy to. Select 'NONE' for build only." + description: "Environment to deploy to. Select 'none' for build only." required: true type: choice - default: 'NONE' - options: [ NONE, DEV, PRE, PROD ] + default: 'none' + options: [ none, test, production ] env: MAVEN_CLI_OPTS: > @@ -50,7 +50,7 @@ jobs: pact_broker_token: ${{ secrets.PACTFLOW_TOKEN }} - name: Can I Deploy? - if: github.event.inputs.environment != 'NONE' + if: github.event.inputs.environment != 'none' uses: ./.github/actions/can-i-deploy with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} @@ -60,7 +60,7 @@ jobs: pact_broker_token: ${{ secrets.PACTFLOW_TOKEN }} - name: Deploy - if: github.event.inputs.environment != 'NONE' + if: github.event.inputs.environment != 'none' uses: ./.github/actions/deploy with: pacticipant: 'consumer' @@ -68,7 +68,7 @@ jobs: environment: ${{ github.event.inputs.environment }} - name: Tag Deployment - if: github.event.inputs.environment != 'NONE' + if: github.event.inputs.environment != 'none' uses: ./.github/actions/tagging with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} diff --git a/.github/workflows/student-provider.yml b/.github/workflows/student-provider.yml index d5c324b..9e33a1a 100644 --- a/.github/workflows/student-provider.yml +++ b/.github/workflows/student-provider.yml @@ -4,11 +4,11 @@ on: workflow_dispatch: inputs: environment: - description: "Environment to deploy to. Select 'NONE' for build only." + description: "Environment to deploy to. Select 'none' for build only." required: true type: choice - default: 'NONE' - options: [ NONE, DEV, PRE, PROD ] + default: 'none' + options: [ none, test, production ] env: MAVEN_CLI_OPTS: > @@ -36,7 +36,7 @@ jobs: deploy_sequence: name: Deploy needs: build_and_verify - if: github.event.inputs.environment != 'NONE' + if: github.event.inputs.environment != 'none' runs-on: ubuntu-latest steps: - name: Checkout repository code diff --git a/.github/workflows/teacher-provider.yml b/.github/workflows/teacher-provider.yml index 70d3f19..43b4769 100644 --- a/.github/workflows/teacher-provider.yml +++ b/.github/workflows/teacher-provider.yml @@ -4,11 +4,11 @@ on: workflow_dispatch: inputs: environment: - description: "Environment to deploy to. Select 'NONE' for build only." + description: "Environment to deploy to. Select 'none' for build only." required: true type: choice - default: 'NONE' - options: [ NONE, DEV, PRE, PROD ] + default: 'none' + options: [ none, test, production ] env: MAVEN_CLI_OPTS: > @@ -58,7 +58,7 @@ jobs: pact_broker_token: ${{ secrets.PACTFLOW_TOKEN }} - name: Can I Deploy? - if: github.event.inputs.environment != 'NONE' + if: github.event.inputs.environment != 'none' uses: ./.github/actions/can-i-deploy with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} @@ -68,7 +68,7 @@ jobs: pact_broker_token: ${{ secrets.PACTFLOW_TOKEN }} - name: Deploy - if: github.event.inputs.environment != 'NONE' + if: github.event.inputs.environment != 'none' uses: ./.github/actions/deploy with: pacticipant: 'teacher-provider' @@ -76,7 +76,7 @@ jobs: environment: ${{ github.event.inputs.environment }} - name: Tag Deployment - if: github.event.inputs.environment != 'NONE' + if: github.event.inputs.environment != 'none' uses: ./.github/actions/tagging with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} From c20568761180a9d726862c040b99a4612a1b5fbb Mon Sep 17 00:00:00 2001 From: Alejandro Pena Date: Wed, 23 Jul 2025 13:31:58 +0200 Subject: [PATCH 3/5] add token auth to studen provider build --- .github/workflows/student-provider.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/student-provider.yml b/.github/workflows/student-provider.yml index 9e33a1a..c17865f 100644 --- a/.github/workflows/student-provider.yml +++ b/.github/workflows/student-provider.yml @@ -26,6 +26,7 @@ jobs: - name: Build and Verify with Maven env: PACT_BROKER_BASE_URL: ${{ vars.PACT_BROKER_BASE_URL }} + PACT_BROKER_TOKEN: ${{ secrets.PACTFLOW_TOKEN }} run: > mvn -f student-provider/pom.xml $MAVEN_CLI_OPTS clean install -Dpact.verifier.publishResults=true From 43113a952776b03ce921bf674891e4e9be972601 Mon Sep 17 00:00:00 2001 From: Alejandro Pena Date: Wed, 23 Jul 2025 13:38:25 +0200 Subject: [PATCH 4/5] Update consumerversionselectors --- .github/workflows/student-provider.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/student-provider.yml b/.github/workflows/student-provider.yml index c17865f..95c5676 100644 --- a/.github/workflows/student-provider.yml +++ b/.github/workflows/student-provider.yml @@ -32,7 +32,7 @@ jobs: -Dpact.verifier.publishResults=true -Dpact.provider.version=${{ github.sha }} -Dpact.provider.branch=${{ github.ref_name }} - -Dpactbroker.consumerversionselectors.rawjson='[{"deployedOrReleased":true}, {"matchingBranch": true}]' + -Dpactbroker.consumerversionselectors.rawjson='[{"deployed":true}, {"latest":true}]' deploy_sequence: name: Deploy From c3069a1ab723e3017229457b15dde6589727aab5 Mon Sep 17 00:00:00 2001 From: Alejandro Pena Date: Wed, 23 Jul 2025 13:48:25 +0200 Subject: [PATCH 5/5] Fix openapi route --- .github/workflows/student-provider.yml | 2 +- .github/workflows/teacher-provider.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/student-provider.yml b/.github/workflows/student-provider.yml index 95c5676..fae564d 100644 --- a/.github/workflows/student-provider.yml +++ b/.github/workflows/student-provider.yml @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 - with: { distribution: 'temurin', java-version: '17', cache: 'maven' } + with: { distribution: 'temurin', java-version: '21', cache: 'maven' } - name: Build and Verify with Maven env: PACT_BROKER_BASE_URL: ${{ vars.PACT_BROKER_BASE_URL }} diff --git a/.github/workflows/teacher-provider.yml b/.github/workflows/teacher-provider.yml index 43b4769..9dfc025 100644 --- a/.github/workflows/teacher-provider.yml +++ b/.github/workflows/teacher-provider.yml @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 - with: { distribution: 'temurin', java-version: '17', cache: 'maven' } + with: { distribution: 'temurin', java-version: '21', cache: 'maven' } - run: mvn -f teacher-provider/pom.xml $MAVEN_CLI_OPTS clean install - uses: actions/upload-artifact@v4 with: @@ -52,7 +52,7 @@ jobs: provider_version: ${{ github.sha }} branch_name: ${{ github.ref_name }} openapi_artifact_name: 'openapi-spec' - openapi_file_path: 'teacher-provider/target/openapi.yaml' + openapi_file_path: 'openapi.yaml' verification_artifact_name: 'verification-results' verification_file_path: 'verification-results.txt' pact_broker_token: ${{ secrets.PACTFLOW_TOKEN }}