Skip to content

Commit

Permalink
Improvements to optional DARTS portal instance on dev env (#2220)
Browse files Browse the repository at this point in the history
Co-authored-by: hmcts-jenkins-cnp <60659747+hmcts-jenkins-cnp[bot]@users.noreply.github.com>
  • Loading branch information
davet1985 and hmcts-jenkins-cnp[bot] authored Oct 31, 2024
1 parent 181ca64 commit c5c4ad8
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 237 deletions.
28 changes: 24 additions & 4 deletions Jenkinsfile_CNP
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@Library("Infrastructure")

import uk.gov.hmcts.contino.GradleBuilder
import uk.gov.hmcts.contino.GithubAPI

def type = "java"
def product = "darts"
Expand Down Expand Up @@ -55,8 +56,6 @@ def secrets = [
secret('api-POSTGRES-PORT', 'STAGING_DB_PORT'),
secret('api-POSTGRES-SCHEMA', 'STAGING_DB_SCHEMA'),
secret('api-POSTGRES-DATABASE', 'STAGING_DB_DATABASE'),
// secret for GitHub API
secret('GithubApiToken', 'GITHUB_API_TOKEN')
],
]

Expand All @@ -69,6 +68,28 @@ static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
]
}

def determineDevEnvironmentDeployment() {
env.DEV_ENABLE_DARTS_PORTAL = false
env.DEV_DARTS_PORTAL_URL = "https://darts.staging.apps.hmcts.net"

echo "1 - env.DEV_ENABLE_DARTS_PORTAL: ${env.DEV_ENABLE_DARTS_PORTAL}"
echo "1 - env.DEV_DARTS_PORTAL_URL: ${env.DEV_DARTS_PORTAL_URL}"

def githubApi = new GithubAPI(this)
if (githubApi.checkForLabel(env.BRANCH_NAME, "enable_keep_helm")) {
for (label in githubApi.getLabelsbyPattern(env.BRANCH_NAME, "enable_darts_") ) {
if (label == "enable_darts_portal") {
env.DEV_ENABLE_DARTS_PORTAL = true
env.DEV_DARTS_PORTAL_URL = "https://darts-portal-pr-${env.CHANGE_ID}.dev.platform.hmcts.net"
echo "Deploying DARTS portal instance in PR environment"
}
}
}

echo "2 - env.DEV_ENABLE_DARTS_PORTAL: ${env.DEV_ENABLE_DARTS_PORTAL}"
echo "2 - env.DEV_DARTS_PORTAL_URL: ${env.DEV_DARTS_PORTAL_URL}"
}

GradleBuilder builder = new GradleBuilder(this, product)

withPipeline(type, product, component) {
Expand Down Expand Up @@ -154,8 +175,7 @@ withPipeline(type, product, component) {

before('akschartsinstall') {
onPR {
// determine what to deploy on the dev env
sh("./bin/ci/process-pr-labels.sh")
determineDevEnvironmentDeployment()
}
}

Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,14 @@ _Disclaimer: The script has been written to work using `bash`._
Please see the separate [Dev environment](https://tools.hmcts.net/confluence/display/DMP/Dev+environment) page on confluence for details.
This repo contains overrides for the default dev environment configuration. For more details see the [Dev chart overrides README](charts-dev-overrides/README.md), within the `charts-dev-overrides` directory.
This repo contains overrides for the default dev environment configuration, controlled by PR labels.
### Supported labels
| Label | Usages |
|------------------------|--------------------------------------------------------------------------------------------------|
| enable_darts_portal | Deploys a DARTS portal instance alongside the API in the dev environment |
| enable_darts_fullstack | Not yet supported, but will deploy the full DARTS stack alongside the API in the dev environment |
## License
Expand Down
38 changes: 0 additions & 38 deletions bin/ci/process-pr-labels.sh

This file was deleted.

26 changes: 0 additions & 26 deletions charts-dev-overrides/README.md

This file was deleted.

23 changes: 0 additions & 23 deletions charts-dev-overrides/enable_darts_portal/Chart.yaml

This file was deleted.

143 changes: 0 additions & 143 deletions charts-dev-overrides/enable_darts_portal/values.dev.template.yaml

This file was deleted.

6 changes: 5 additions & 1 deletion charts/darts-api/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ appVersion: "1.0"
description: A Helm chart for darts-api App
name: darts-api
home: https://github.com/hmcts/darts-api
version: 0.0.92
version: 0.0.93
maintainers:
- name: HMCTS darts team
dependencies:
Expand All @@ -18,4 +18,8 @@ dependencies:
version: 1.0.2
repository: 'https://hmctspublic.azurecr.io/helm/v1/repo/'
condition: postgresql.enabled
- name: darts-portal
version: ~0.0.27
repository: 'https://sdshmctspublic.azurecr.io/helm/v1/repo/'
condition: darts-portal.enabled

21 changes: 20 additions & 1 deletion charts/darts-api/values.dev.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ java:
spring.profiles.active: dev
TESTING_SUPPORT_ENDPOINTS_ENABLED: true
DARTS_GATEWAY_URL: "http://darts-gateway.staging.platform.hmcts.net"
DARTS_PORTAL_URL: "https://darts.staging.apps.hmcts.net"
DARTS_PORTAL_URL: ${DEV_DARTS_PORTAL_URL}
AUTOMATED_TASK_MODE: true
API_MODE: true

Expand All @@ -125,6 +125,25 @@ postgresql:
databases:
- name: "pr-${CHANGE_ID}-darts"

darts-portal:
enabled: ${DEV_ENABLE_DARTS_PORTAL}
nodejs:
applicationPort: 3000
image: 'sdshmctspublic.azurecr.io/darts/portal:latest'
ingressHost: "darts-portal-pr-${CHANGE_ID}.dev.platform.hmcts.net"
aadIdentityName: darts
keyVaults:
darts:
secrets:
- redis-connection-string
- darts-portal-session-secret
environment:
ALLOW_CONFIG_MUTATIONS: true
DARTS_PORTAL_URL: "https://darts-portal-pr-${CHANGE_ID}.dev.platform.hmcts.net"
DARTS_API_URL: "https://darts-api-pr-${CHANGE_ID}.dev.platform.hmcts.net"
DARTS_AZUREAD_B2C_ORIGIN_HOST: https://hmctsstgextid.b2clogin.com
DARTS_AZUREAD_B2C_HOSTNAME: https://darts.staging.apps.hmcts.net

# function:
# scaleType: Job
# image: ${IMAGE_NAME}
Expand Down

0 comments on commit c5c4ad8

Please sign in to comment.