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
56 changes: 36 additions & 20 deletions .github/workflows/ci-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ jobs:
echo "Skipping publish because this is a pull_request"
fi


- name: Extract repo name
if: github.event_name == 'push'
id: repo_vars
Expand Down Expand Up @@ -139,22 +138,39 @@ jobs:
BASE_IMAGE=openjdk:21-jdk-slim
JAR_FILENAME=${{ needs.Build.outputs.artefact_name }}.jar

# # https://github.com/marketplace/actions/azure-pipelines-action
# Deploy:
# needs: [ Build, Artefact-Version ]
# runs-on: ubuntu-latest
# if: github.event_name == 'push'
#
# steps:
# - name: Trigger ADO pipeline
# uses: Azure/pipelines@v1.2
# with:
# azure-devops-project-url: 'https://dev.azure.com/hmcts-cpp/cpp-apps'
# azure-pipeline-name: 'cp-gh-artifact-to-acr'
# azure-devops-token: ${{ secrets.HMCTS_ADO_PAT }}
# azure-pipeline-variables: >-
# {
# "GROUP_ID" : "uk.gov.hmcts.cp",
# "ARTIFACT_ID" : "${{ github.repository }}",
# "ARTIFACT_VERSION" : "${{ needs.Artefact-Version.outputs.draft_version}}"
# }
Deploy:
needs: [ Build, Artefact-Version ]
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- name: Trigger ADO pipeline
env:
ADO_ORG: 'hmcts-cpp'
ADO_PROJECT: 'cpp-apps'
PIPELINE_ID: 460 #cp-gh-artifact-to-acr
ADO_PAT: ${{ secrets.HMCTS_ADO_PAT }}
run: |
ARTEFACT_VERSION="${{ needs.Artefact-Version.outputs.draft_version }}"
REPO_NAME="${GITHUB_REPOSITORY##*/}"
TARGET_REPOSITORY="${GITHUB_REPOSITORY}"

curl -X POST \
-u ":${ADO_PAT}" \
-H "Content-Type: application/json" \
https://dev.azure.com/${ADO_ORG}/${ADO_PROJECT}/_apis/pipelines/${PIPELINE_ID}/runs?api-version=7.0 \
-d "{
\"resources\": {
\"repositories\": {
\"self\": {
\"refName\": \"refs/heads/main\"
}
}
},
\"templateParameters\": {
\"GROUP_ID\": \"uk.gov.hmcts.cp\",
\"ARTIFACT_ID\": \"${REPO_NAME}\",
\"ARTIFACT_VERSION\": \"${ARTEFACT_VERSION}\",
\"TARGET_REPOSITORY\": \"${TARGET_REPOSITORY}\"
}
}"
42 changes: 29 additions & 13 deletions .github/workflows/ci-released.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,38 @@ jobs:
BASE_IMAGE=openjdk:21-jdk-slim
JAR_FILENAME=${{ needs.Build.outputs.artefact_name }}.jar

# https://github.com/marketplace/actions/azure-pipelines-action
Deploy:
needs: [ Build, Artefact-Version ]
runs-on: ubuntu-latest
if: github.event_name == 'push'

steps:
- name: Trigger ADO pipeline
uses: Azure/pipelines@v1
with:
azure-devops-project-url: 'https://dev.azure.com/hmcts-cpp/cpp-apps'
azure-pipeline-name: 'hmcts.service-cp-refdata-courthearing-judges'
azure-devops-token: ${{ secrets.HMCTS_ADO_PAT }}
azure-pipeline-variables: |
{
"GROUP_ID" : "uk.gov.hmcts.cp",
"ARTIFACT_ID" : "${{ github.repository }}",
"ARTIFACT_VERSION" : "${{ needs.Artefact-Version.outputs.draft_version}}"
}
env:
ADO_ORG: 'hmcts-cpp'
ADO_PROJECT: 'cpp-apps'
PIPELINE_ID: 460 #cp-gh-artifact-to-acr
ADO_PAT: ${{ secrets.HMCTS_ADO_PAT }}
run: |
ARTEFACT_VERSION="${{ needs.Artefact-Version.outputs.RELEASED_VERSION }}"
REPO_NAME="${GITHUB_REPOSITORY##*/}"
TARGET_REPOSITORY="${GITHUB_REPOSITORY}"

curl -X POST \
-u ":${ADO_PAT}" \
-H "Content-Type: application/json" \
https://dev.azure.com/${ADO_ORG}/${ADO_PROJECT}/_apis/pipelines/${PIPELINE_ID}/runs?api-version=7.0 \
-d "{
\"resources\": {
\"repositories\": {
\"self\": {
\"refName\": \"refs/heads/main\"
}
}
},
\"templateParameters\": {
\"GROUP_ID\": \"uk.gov.hmcts.cp\",
\"ARTIFACT_ID\": \"${REPO_NAME}\",
\"ARTIFACT_VERSION\": \"${ARTEFACT_VERSION}\",
\"TARGET_REPOSITORY\": \"${TARGET_REPOSITORY}\"
}
}"
6 changes: 1 addition & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@ FROM ${BASE_IMAGE:-openjdk:21-jdk-slim}

# ---- Runtime arguments ----
ARG JAR_FILENAME=app.jar
ARG JAR_FILE_PATH=build/libs
ENV JAR_FILENAME=$JAR_FILENAME
ENV JAR_FILE_PATH=$JAR_FILE_PATH
ENV JAR_FULL_PATH=$JAR_FILE_PATH/$JAR_FILENAME

# ---- Dependencies ----
RUN apt-get update \
&& apt-get install -y curl \
&& rm -rf /var/lib/apt/lists/*

# ---- Application files ----
COPY $JAR_FULL_PATH /opt/app/$JAR_FILENAME
COPY build/libs/${JAR_FILENAME} /opt/app/${JAR_FILENAME}
COPY lib/applicationinsights.json /opt/app/

# ---- Permissions ----
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Service: Common Platform (CP) Crime Scheduling and Listing Court Schedule

## Documentation

Further documentation see the [HMCTS Marketplace Springboot template readme](https://github.com/hmcts/service-hmcts-marketplace-springboot-template/blob/main/README.md).

## License

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