Skip to content

Commit 62119e6

Browse files
update deploy config
1 parent 023acea commit 62119e6

File tree

4 files changed

+71
-39
lines changed

4 files changed

+71
-39
lines changed

.github/workflows/ci-draft.yml

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ jobs:
8686
echo "Skipping publish because this is a pull_request"
8787
fi
8888
89-
9089
- name: Extract repo name
9190
if: github.event_name == 'push'
9291
id: repo_vars
@@ -139,22 +138,39 @@ jobs:
139138
BASE_IMAGE=openjdk:21-jdk-slim
140139
JAR_FILENAME=${{ needs.Build.outputs.artefact_name }}.jar
141140
142-
# # https://github.com/marketplace/actions/azure-pipelines-action
143-
# Deploy:
144-
# needs: [ Build, Artefact-Version ]
145-
# runs-on: ubuntu-latest
146-
# if: github.event_name == 'push'
147-
#
148-
# steps:
149-
# - name: Trigger ADO pipeline
150-
# uses: Azure/pipelines@v1.2
151-
# with:
152-
# azure-devops-project-url: 'https://dev.azure.com/hmcts-cpp/cpp-apps'
153-
# azure-pipeline-name: 'cp-gh-artifact-to-acr'
154-
# azure-devops-token: ${{ secrets.HMCTS_ADO_PAT }}
155-
# azure-pipeline-variables: >-
156-
# {
157-
# "GROUP_ID" : "uk.gov.hmcts.cp",
158-
# "ARTIFACT_ID" : "${{ github.repository }}",
159-
# "ARTIFACT_VERSION" : "${{ needs.Artefact-Version.outputs.draft_version}}"
160-
# }
141+
Deploy:
142+
needs: [ Build, Artefact-Version ]
143+
runs-on: ubuntu-latest
144+
if: github.event_name == 'push'
145+
146+
steps:
147+
- name: Trigger ADO pipeline
148+
env:
149+
ADO_ORG: 'hmcts-cpp'
150+
ADO_PROJECT: 'cpp-apps'
151+
PIPELINE_ID: 460 #cp-gh-artifact-to-acr
152+
ADO_PAT: ${{ secrets.HMCTS_ADO_PAT }}
153+
run: |
154+
ARTEFACT_VERSION="${{ needs.Artefact-Version.outputs.draft_version }}"
155+
REPO_NAME="${GITHUB_REPOSITORY##*/}"
156+
TARGET_REPOSITORY="${GITHUB_REPOSITORY}"
157+
158+
curl -X POST \
159+
-u ":${ADO_PAT}" \
160+
-H "Content-Type: application/json" \
161+
https://dev.azure.com/${ADO_ORG}/${ADO_PROJECT}/_apis/pipelines/${PIPELINE_ID}/runs?api-version=7.0 \
162+
-d "{
163+
\"resources\": {
164+
\"repositories\": {
165+
\"self\": {
166+
\"refName\": \"refs/heads/main\"
167+
}
168+
}
169+
},
170+
\"templateParameters\": {
171+
\"GROUP_ID\": \"uk.gov.hmcts.cp\",
172+
\"ARTIFACT_ID\": \"${REPO_NAME}\",
173+
\"ARTIFACT_VERSION\": \"${ARTEFACT_VERSION}\",
174+
\"TARGET_REPOSITORY\": \"${TARGET_REPOSITORY}\"
175+
}
176+
}"

.github/workflows/ci-released.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,38 @@ jobs:
109109
BASE_IMAGE=openjdk:21-jdk-slim
110110
JAR_FILENAME=${{ needs.Build.outputs.artefact_name }}.jar
111111
112-
# https://github.com/marketplace/actions/azure-pipelines-action
113112
Deploy:
114113
needs: [ Build, Artefact-Version ]
115114
runs-on: ubuntu-latest
116-
if: github.event_name == 'push'
117115

118116
steps:
119117
- name: Trigger ADO pipeline
120-
uses: Azure/pipelines@v1
121-
with:
122-
azure-devops-project-url: 'https://dev.azure.com/hmcts-cpp/cpp-apps'
123-
azure-pipeline-name: 'hmcts.service-cp-refdata-courthearing-judges'
124-
azure-devops-token: ${{ secrets.HMCTS_ADO_PAT }}
125-
azure-pipeline-variables: |
126-
{
127-
"GROUP_ID" : "uk.gov.hmcts.cp",
128-
"ARTIFACT_ID" : "${{ github.repository }}",
129-
"ARTIFACT_VERSION" : "${{ needs.Artefact-Version.outputs.draft_version}}"
130-
}
118+
env:
119+
ADO_ORG: 'hmcts-cpp'
120+
ADO_PROJECT: 'cpp-apps'
121+
PIPELINE_ID: 460 #cp-gh-artifact-to-acr
122+
ADO_PAT: ${{ secrets.HMCTS_ADO_PAT }}
123+
run: |
124+
ARTEFACT_VERSION="${{ needs.Artefact-Version.outputs.RELEASED_VERSION }}"
125+
REPO_NAME="${GITHUB_REPOSITORY##*/}"
126+
TARGET_REPOSITORY="${GITHUB_REPOSITORY}"
127+
128+
curl -X POST \
129+
-u ":${ADO_PAT}" \
130+
-H "Content-Type: application/json" \
131+
https://dev.azure.com/${ADO_ORG}/${ADO_PROJECT}/_apis/pipelines/${PIPELINE_ID}/runs?api-version=7.0 \
132+
-d "{
133+
\"resources\": {
134+
\"repositories\": {
135+
\"self\": {
136+
\"refName\": \"refs/heads/main\"
137+
}
138+
}
139+
},
140+
\"templateParameters\": {
141+
\"GROUP_ID\": \"uk.gov.hmcts.cp\",
142+
\"ARTIFACT_ID\": \"${REPO_NAME}\",
143+
\"ARTIFACT_VERSION\": \"${ARTEFACT_VERSION}\",
144+
\"TARGET_REPOSITORY\": \"${TARGET_REPOSITORY}\"
145+
}
146+
}"

Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,14 @@ FROM ${BASE_IMAGE:-openjdk:21-jdk-slim}
44

55
# ---- Runtime arguments ----
66
ARG JAR_FILENAME=app.jar
7-
ARG JAR_FILE_PATH=build/libs
8-
ENV JAR_FILENAME=$JAR_FILENAME
9-
ENV JAR_FILE_PATH=$JAR_FILE_PATH
10-
ENV JAR_FULL_PATH=$JAR_FILE_PATH/$JAR_FILENAME
117

128
# ---- Dependencies ----
139
RUN apt-get update \
1410
&& apt-get install -y curl \
1511
&& rm -rf /var/lib/apt/lists/*
1612

1713
# ---- Application files ----
18-
COPY $JAR_FULL_PATH /opt/app/$JAR_FILENAME
14+
COPY build/libs/${JAR_FILENAME} /opt/app/${JAR_FILENAME}
1915
COPY lib/applicationinsights.json /opt/app/
2016

2117
# ---- Permissions ----

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Service: Common Platform (CP) Crime Scheduling and Listing Court Schedule
22

3+
## Documentation
4+
5+
Further documentation see the [HMCTS Marketplace Springboot template readme](https://github.com/hmcts/service-hmcts-marketplace-springboot-template/blob/main/README.md).
6+
37
## License
48

5-
This project is licensed under the [MIT License](LICENSE).
9+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details

0 commit comments

Comments
 (0)