Skip to content

Commit 6c1155c

Browse files
publish-openapi job needs project checkout with submodules; (#11)
1 parent d345523 commit 6c1155c

File tree

4 files changed

+70
-9
lines changed

4 files changed

+70
-9
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This job was taken from https://github.com/hmcts/workflow-publish-openapi-spec/blob/v1/.github/workflows/publish-openapi.yml
2+
name: Publish OpenAPI Spec
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
test_to_run:
8+
required: true
9+
type: string
10+
description: The full path to the test to run, e.g. uk.gov.hmcts.reform.myapp.openapi.OpenAPIPublisherTest
11+
java_version:
12+
required: true
13+
type: string
14+
secrets:
15+
SWAGGER_PUBLISHER_API_TOKEN:
16+
required: true
17+
description: GitHub API token that can publish to the cnp-api-docs repository
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
submodules: recursive
26+
- name: Set up JDK ${{ inputs.java_version }}
27+
uses: actions/setup-java@v3
28+
with:
29+
java-version: ${{ inputs.java_version }}
30+
distribution: 'temurin'
31+
cache: 'gradle'
32+
- name: Run OpenAPI Publisher
33+
run: ./gradlew integration --tests ${{ inputs.test_to_run }}
34+
- name: Commit to repository
35+
run: |
36+
mkdir openapi-staging
37+
cd openapi-staging
38+
git init
39+
git config user.email "github-platform-operations@HMCTS.NET"
40+
git config user.name "HMCTS Platform Operations"
41+
git remote add upstream https://apitoken:${{ secrets.SWAGGER_PUBLISHER_API_TOKEN }}@github.com/hmcts/cnp-api-docs.git
42+
git pull upstream master
43+
repo=`echo "$GITHUB_REPOSITORY" | cut -f2- -d/`
44+
echo "$(cat /tmp/openapi-specs.json)" > "docs/specs/$repo.json"
45+
git add "docs/specs/$repo.json"
46+
# Only commit and push if we have changes
47+
git diff --quiet && git diff --staged --quiet || (git commit -m "Update spec for $repo#${GITHUB_SHA:7}"; git push --set-upstream upstream master)
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,8 @@ on:
88
- "master"
99

1010
jobs:
11-
checkout-submodules:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v4
15-
with:
16-
submodules: recursive
17-
1811
publish-openapi:
19-
needs: checkout-submodules
20-
uses: hmcts/workflow-publish-openapi-spec/.github/workflows/publish-openapi.yml@v1
12+
uses: ./hmcts-publish-openapi.yml
2113
secrets:
2214
SWAGGER_PUBLISHER_API_TOKEN: ${{ secrets.SWAGGER_PUBLISHER_API_TOKEN }}
2315
with:

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ARG APP_INSIGHTS_AGENT_VERSION=3.7.1
33
FROM hmctspublic.azurecr.io/base/java:21-distroless
44

55
COPY build/libs/api-cp-springboot-template.jar /opt/app/
6+
COPY lib/applicationinsights.json /opt/app/
67

78
EXPOSE 4550
89
CMD [ "api-cp-springboot-template.jar" ]

lib/applicationinsights.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"connectionString": "${file:/mnt/secrets/PathFinder/app-insights-connection-string}",
3+
"role": {
4+
"name": "PathFinder-api-service"
5+
},
6+
"sampling": {
7+
"overrides": [
8+
{
9+
"telemetryType": "request",
10+
"attributes": [
11+
{
12+
"key": "http.url",
13+
"value": "https?://[^/]+/health.*",
14+
"matchType": "regexp"
15+
}
16+
],
17+
"percentage": 1
18+
}
19+
]
20+
}
21+
}

0 commit comments

Comments
 (0)