Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 2 additions & 32 deletions .github/actions/make/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@ inputs:
description: "[Optional] Cache suffix (e.g. 'base')"
required: false
default: ""
coverage-cache-suffix:
description: "[Optional] Coverage cache suffix (e.g. 'coverage')"
required: false
default: ""
restore-coverage:
description: "[Optional] Coverage restore? if true please provide coverage-cache-suffix"
required: false
default: "false"
cache-coverage:
description: "[Optional] Coverage caching? if true please provide coverage-cache-suffix and paths-to-cache as the coverage file"
required: false
default: "false"
restore-from-cache:
description: "[Optional] restore from cache?"
required: false
Expand All @@ -32,9 +20,6 @@ inputs:
description: "[Optional] save to cache?"
required: false
default: "false"
paths-to-cache:
description: "[Optional] paths to cache?"
required: false
runs:
using: "composite"
steps:
Expand All @@ -43,19 +28,12 @@ runs:
shell: bash

- name: Restore from the cache
if: ${{ inputs.restore-from-cache == 'true' && inputs.restore-coverage != 'true'}}
if: ${{ inputs.restore-from-cache == 'true' }}
uses: ./.github/actions/components/caching/
with:
save-or-restore: "restore"
cache-suffix: ${{ inputs.cache-suffix }}

- name: Restore coverage from the cache
if: ${{ inputs.restore-from-cache == 'true' && inputs.restore-coverage == 'true'}}
uses: ./.github/actions/components/caching/
with:
save-or-restore: "restore"
cache-suffix: ${{ inputs.coverage-cache-suffix }}

- name: Configure AWS Credentials
id: configure-aws-credentials
if: inputs.requires-aws
Expand Down Expand Up @@ -88,16 +66,8 @@ runs:
AWS_SECRET_ACCESS_KEY: ${{ steps.configure-aws-credentials.outputs.aws-secret-access-key }}
AWS_SESSION_TOKEN: ${{ steps.configure-aws-credentials.outputs.aws-session-token }}

- name: Save to the cache with path (for coverage)
if: ${{ inputs.save-to-cache == 'true' && inputs.cache-coverage == 'true'}}
uses: ./.github/actions/components/caching/
with:
save-or-restore: "save"
cache-suffix: ${{ inputs.coverage-cache-suffix }}
paths-to-cache: ${{ inputs.paths-to-cache }}

- name: Save to the cache default paths
if: ${{ inputs.save-to-cache == 'true' && inputs.cache-coverage != 'true'}}
if: ${{ inputs.save-to-cache == 'true' }}
uses: ./.github/actions/components/caching/
with:
save-or-restore: "save"
Expand Down
68 changes: 34 additions & 34 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,6 @@ permissions:
actions: write

jobs:
get-branch-from-workflow-file:
runs-on: [self-hosted, ci]
outputs:
branch_name: ${{ steps.get_branch.outputs.branch_name }}
steps:
- id: get_branch
run: |
workflow_ref=${{ github.workflow_ref }}
branch_name=${workflow_ref#*refs/heads/}
branch_name=${branch_name#*refs/tags/}
echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT

test--coverage-sonar:
runs-on: [self-hosted, ci]
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Restore coverage from the cache
uses: ./.github/actions/components/caching/
with:
save-or-restore: "restore"
cache-suffix: "coverage"
paths-to-cache: "sonarcloud-coverage.xml"

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io

make-tag:
runs-on: [self-hosted, ci]
permissions: write-all
Expand All @@ -67,9 +36,40 @@ jobs:
outputs:
tag: ${{ env.tag }}

create-coverage-name:
runs-on: [self-hosted, ci]
needs: [make-tag]
outputs:
coverage-name: ${{ steps.create_coverage_name.outputs.coverage-name }}
steps:
- id: create_coverage_name
run: |
coverage_artifact_branch_name=$(echo ${{ needs.make-tag.outputs.tag }} | cut -c 9-)
echo "coverage-name=${coverage_artifact_branch_name}" >> $GITHUB_OUTPUT

test--coverage-sonar:
runs-on: [self-hosted, ci]
needs: [create-coverage-name, make-tag]
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Download artifact
uses: dawidd6/action-download-artifact@v9
with:
name: "${{ needs.create-coverage-name.outputs.coverage-name }}-coverage"
branch: "${{ needs.make-tag.outputs.tag }}"
workflow: pull-requests.yml
workflow_conclusion: success
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io

set-success:
name: Set Success
needs: [make-tag, get-branch-from-workflow-file]
needs: [make-tag]
runs-on: [self-hosted, ci]
steps:
- name: Set success env var
Expand All @@ -79,7 +79,7 @@ jobs:

message-slack:
name: Notify slack of merge to main
needs: [make-tag, get-branch-from-workflow-file, set-success]
needs: [make-tag, set-success]
runs-on: [self-hosted, ci]
steps:
- name: Catch failed steps
Expand All @@ -93,7 +93,7 @@ jobs:
payload: |
{
"tag": "${{ needs.make-tag.outputs.tag}}",
"branch": "${{ needs.get-branch-from-workflow-file.outputs.branch_name }}",
"branch": "main",
"caller": "${{ github.triggering_actor }}",
"result": "${{ needs.set-success.outputs.success && needs.set-success.outputs.success || 'failed' }}",
"result_detail": "${{ needs.set-success.outputs.success && 'None' || steps.catch-failed-step.outputs.failed-step-name }}",
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
CI_ROLE_NAME: ${{ secrets.CI_ROLE_NAME }}
BRANCH_GITHUB_SHA_SHORT: $(echo ${{ github.event.pull_request.head.sha }} | cut -c 1-7)
COVERAGE_ARTIFACT_BRANCH_NAME: $(echo ${{ github.event.pull_request.head.ref }} | cut -c 9-)
TF_CLI_ARGS: -no-color

jobs:
Expand Down Expand Up @@ -61,7 +62,7 @@ jobs:
workspace: ${{ steps.create_workspace_name.outputs.workspace }}
steps:
- id: create_workspace_name
# will create a workspace in the format ci-PI-70-b25lkjd or for release branches rel-2023-10-30-lskjdld
# will create a workspace in the format ci-PI-70-b25lkjd or for release branches rel-2023-10-30-lskjdl
run: |
if [[ ${{ env.BRANCH_NAME }} == *"release/"* ]]; then
echo "workspace=rel-$(echo ${{ env.BRANCH_NAME }} | sed 's/release\///')-${{ env.BRANCH_GITHUB_SHA_SHORT }}" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -275,6 +276,16 @@ jobs:
command: test--smoke
requires-aws: true

create-coverage-name:
runs-on: [self-hosted, ci]
needs: [workflow--check--branch-name]
outputs:
coverage-name: ${{ steps.create_coverage_name.outputs.coverage-name }}
steps:
- id: create_coverage_name
run: |
echo "coverage-name=${{ env.COVERAGE_ARTIFACT_BRANCH_NAME }}" >> $GITHUB_OUTPUT

test--coverage-sonar:
needs:
[
Expand All @@ -288,6 +299,7 @@ jobs:
apigee--deploy,
apigee--attach-product,
test--smoke,
create-coverage-name,
]
runs-on: [self-hosted, ci]
steps:
Expand All @@ -299,9 +311,11 @@ jobs:
command: test--coverage
requires-aws: true
save-to-cache: "true"
cache-coverage: "true"
coverage-cache-suffix: "coverage"
paths-to-cache: "sonarcloud-coverage.xml"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: "${{ needs.create-coverage-name.outputs.coverage-name }}-coverage"
path: "sonarcloud-coverage.xml"
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2025-03-25
- [PI-857] Sonar Merge Commit
- [PI-865] Swagger refinement 2

## 2025-03-20
- [PI-815] Allow a Product Team to be recreated
- [PI-859] Swagger refinement
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025.03.20
2025.03.25
2 changes: 2 additions & 0 deletions changelog/2025-03-25.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [PI-857] Sonar Merge Commit
- [PI-865] Swagger refinement 2
24 changes: 16 additions & 8 deletions infrastructure/swagger/02_info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,27 +89,35 @@ info:
| Integration | `https://int.api.service.nhs.uk/connecting-party-manager/` |
| Production | `https://api.service.nhs.uk/connecting-party-manager/` |

### Sandbox and Integration environments
### Sandbox and integration environments

Our [sandbox environment](https://digital.nhs.uk/developer/guides-and-documentation/testing#sandbox-testing):

* is for early developer testing,
* is open access, so does not allow you to test authorisation,
* includes ready-to-use test data - for details [contact us](https://digital.nhs.uk/developer/help-and-support),
* underpins our `Try this API` feature; see the documentation for each endpoint for more details.
* is for early developer testing
* is open access, so does not allow you to test authorisation
* includes ready-to-use test data - for details [contact us](https://digital.nhs.uk/developer/help-and-support)
* underpins our `Try this API` feature; see the documentation for each endpoint for more details

Our [integration test environment](https://digital.nhs.uk/developer/guides-and-documentation/testing#integration-testing):

* is for formal integration testing,
* includes authorisation,
* includes ready-to-use test data - for details [contact us](https://digital.nhs.uk/developer/help-and-support).
* is for formal integration testing
* includes authorisation
* includes ready-to-use test data - for details [contact us](https://digital.nhs.uk/developer/help-and-support)

For more details see [integration testing with our RESTful APIs](https://digital.nhs.uk/developer/guides-and-documentation/testing#integration-testing-with-our-restful-apis).

## Onboarding

This API is not yet available for onboarding.

## Related APIs

The following APIs are related to this API:

### Organisation Data Service FHIR API
Use [Organisation Data Service FHIR API](https://developer.nhs.uk/apis/ods/) to get organisation codes related to the product team.

This API is not yet available for onboarding.
## Change log

For details of how this API has changed over time, see the [change log](https://github.com/NHSDigital/connecting-party-manager/blob/main/CHANGELOG.md).
8 changes: 4 additions & 4 deletions infrastructure/swagger/05_paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ paths:
operationId: readproductteam
summary: Get a product team
description: |
- Get the details of a product team based on it's product team ID.
Get the details of a product team based on it's product team ID.
tags:
- Core product operations
parameters:
Expand All @@ -141,7 +141,7 @@ paths:
operationId: deleteproductteam
summary: Delete a product team
description: |
- Delete a product team based on it's product team ID.
Delete a product team based on it's product team ID.
tags:
- Core product operations
parameters:
Expand Down Expand Up @@ -348,7 +348,7 @@ paths:
operationId: readproductendpoint
summary: Get a product
description: |
- Get a product using a product ID.
Get a product using a product ID.
tags:
- Core product operations
parameters:
Expand Down Expand Up @@ -417,7 +417,7 @@ paths:
operationId: deleteproductendpoint
summary: Delete a product
description: |
- Delete a product using a product team ID and product ID.
Delete a product using a product team ID and product ID.
tags:
- Core product operations
parameters:
Expand Down
2 changes: 0 additions & 2 deletions infrastructure/swagger/09_components--headers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ components:
HeaderRequestId:
in: header
name: x-request-id
required: true
schema:
$ref: "#/components/schemas/HeaderRequestId"
HeaderCorrelationId:
in: header
name: x-correlation-id
required: true
schema:
$ref: "#/components/schemas/HeaderCorrelationId"
HeaderAuthorization:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "connecting-party-manager"
version = "2025.03.20"
version = "2025.03.25"
description = "Repository for the Connecting Party Manager API and related services"
authors = ["NHS England"]
license = "LICENSE.md"
Expand Down
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sonar.organization=nhsdigital
sonar.projectVersion=1.0
sonar.sources=src/,infrastructure/
sonar.exclusions=src/**/test_*.py,test_ui/,changelog/,archived_epr/
sonar.coverage.exclusions=src/api/tests/**
sonar.test.inclusions=**/test_*.py

sonar.python.coverage.reportPaths=sonarcloud-coverage.xml
Expand Down
Loading