Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b809db4
CCD-7714 Remove shaded App Insights imports and verify telemetry
patelila May 22, 2026
b8fae19
Update AppInsightsConfiguration.java
patelila May 22, 2026
ee8b522
• CCD-7714 Remove shaded App Insights imports and enable telemetry sm…
patelila May 22, 2026
8a830b0
Merge remote-tracking branch 'origin/CCD-7714_remove_shady_import_app…
patelila May 22, 2026
6348991
• CCD-7714 Remove shaded App Insights imports and enable telemetry sm…
patelila May 26, 2026
17eff44
• CCD-7714 Remove shaded App Insights imports and enable telemetry sm…
patelila May 26, 2026
f955dcc
• CCD-7714 Default App Insights smoke check resource selectors
patelila May 26, 2026
925c87e
CCD-7714 Use Jenkins Azure CLI profile for telemetry smoke check
patelila May 26, 2026
b0bc793
CCD-7714 Align App Insights telemetry smoke check with CDAM
patelila May 26, 2026
b8d4c7c
CCD-7714 Query AAT App Insights for preview telemetry smoke check
patelila May 26, 2026
69d21cd
Merge branch 'master' into CCD-7765_remove_shady_import_appinsights
patelila Jun 1, 2026
d37c5ec
CCD-7765 Make preview App Insights telemetry check non-blocking
patelila Jun 1, 2026
d12b31a
Merge branch 'master' into CCD-7765_remove_shady_import_appinsights
patelila Jun 3, 2026
686be24
Merge branch 'master' into CCD-7765_remove_shady_import_appinsights
patelila Jun 25, 2026
3294fbf
Scope App Insights telemetry checks to pipeline instance
patelila Jun 25, 2026
1687843
Merge remote-tracking branch 'origin/CCD-7765_remove_shady_import_app…
patelila Jun 25, 2026
0dc5faa
Add scoped App Insights telemetry check after functional tests
patelila Jun 26, 2026
4e51e32
Add scoped App Insights telemetry check after functional tests
patelila Jun 26, 2026
7680d1f
Scope App Insights telemetry by preview role instance
patelila Jun 26, 2026
5e60b0a
Add telemetry diagnostics for App Insights scoping
patelila Jun 26, 2026
74d73aa
Keep App Insights role diagnostics unscoped
patelila Jun 29, 2026
5ddebae
Keep App Insights role diagnostics unscoped
patelila Jun 29, 2026
cfbc8ab
Keep App Insights role diagnostics unscoped
patelila Jun 29, 2026
fbfd03e
Align preview telemetry check with preview App Insights
patelila Jun 29, 2026
6c3dc5a
Use preview App Insights resource group for telemetry check
patelila Jun 29, 2026
15e62d7
Align preview App Insights config with AAT telemetry
patelila Jun 29, 2026
8861cfc
Update PostgreSQL module and Jenkins agent library refs
patelila Jun 29, 2026
7c4efe1
Reverted PostgreSQL module ref update
patelila Jun 29, 2026
074e8ed
Reverted Jenkinsfile changes
patelila Jun 29, 2026
d38715c
Merge branch 'master' into CCD-7765_remove_shady_import_appinsights
patelila Jul 7, 2026
773c3dd
Merge branch 'master' into CCD-7765_remove_shady_import_appinsights
patelila Jul 8, 2026
b12df60
Merge branch 'master' into CCD-7765_remove_shady_import_appinsights
patelila Jul 9, 2026
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
65 changes: 64 additions & 1 deletion Jenkinsfile_CNP
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!groovy
import uk.gov.hmcts.contino.AppPipelineDsl
import uk.gov.hmcts.contino.GithubAPI
import groovy.transform.Field
properties(
[
[
Expand Down Expand Up @@ -84,10 +85,11 @@ static LinkedHashMap<String, Object> secret(String secretName, String envVar) {
]
}

def vaultOverrides = [
@Field Map<String, String> vaultOverrides = [
'preview' : 'aat',
'spreview': 'saat'
]

// vars needed for functional tests
// Other env variables needed for BEFTA.
env.DM_STORE_BASE_URL = "http://dm-store-aat.service.core-compute-aat.internal"
Expand All @@ -100,6 +102,9 @@ env.PACT_BROKER_FULL_URL = "https://pact-broker.platform.hmcts.net"
env.PACT_BROKER_URL = "pact-broker.platform.hmcts.net"
env.PACT_BROKER_PORT = "443"
env.PACT_BROKER_SCHEME = "https"
env.APP_INSIGHTS_TELEMETRY_SMOKE_ENABLED = "true"
env.APP_INSIGHTS_TELEMETRY_REQUIRED = "true"
env.APP_INSIGHTS_TRACE_MARKER = "CLA-CCD"
env.DEFAULT_COLLECTION_ASSERTION_MODE="UNORDERED"
env.MAX_NUM_PARALLEL_THREADS=6
env.BEFTA_S2S_CLIENT_ID = "ccd_gw"
Expand Down Expand Up @@ -221,6 +226,10 @@ withPipeline(type, product, component) {
]
}

afterSuccess('functionalTest:preview') {
runTelemetrySmokeCheckAfterFunctional('preview')
}

afterAlways('functionalTest:aat') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/BEFTA Report for Functional Tests/**/*'
publishHTML target: [
Expand All @@ -233,6 +242,10 @@ withPipeline(type, product, component) {
]
}

afterSuccess('functionalTest:aat') {
runTelemetrySmokeCheckAfterFunctional('aat')
}

afterAlways('pact-provider-verification') {
steps.archiveArtifacts allowEmptyArchive: true, artifacts: 'build/reports/tests/**/*'
publishHTML target: [
Expand All @@ -252,3 +265,53 @@ withPipeline(type, product, component) {
def copyIgnore(filePath, destinationDir) {
steps.sh("cp -R '${filePath}' '${destinationDir}' || :")
}

def runTelemetrySmokeCheckAfterFunctional(environment) {
steps.stage("Application Insights telemetry - ${environment}") {
steps.catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
runTelemetrySmokeCheck(environment)
}
}
}

def runTelemetrySmokeCheck(environment) {
if (!env.APP_INSIGHTS_TELEMETRY_SMOKE_ENABLED?.toBoolean()) {
echo "Skipping App Insights telemetry smoke check for ${environment}; set APP_INSIGHTS_TELEMETRY_SMOKE_ENABLED=true to enable."
return
}

def azureConfigDir = env.AZURE_CONFIG_DIR?.trim() ?: '/opt/jenkins/.azure-nonprod'
def appInsightsEnvironment = vaultOverrides[environment] ?: environment

steps.echo("Running Application Insights telemetry smoke check for ${environment}")
steps.echo("Using Azure CLI config ${azureConfigDir} for Application Insights telemetry check")
steps.echo("Using ${appInsightsEnvironment} Application Insights for ${environment} telemetry check")
steps.echo("Functional TEST_URL for ${environment}: ${env.TEST_URL ?: '<not set>'}")
def requestUrlContains = environment == 'preview' ? (env.TEST_URL?.trim() ?: '') : ''
if (!requestUrlContains && environment == 'aat') {
requestUrlContains = "http://ccd-data-store-api-aat.service.core-compute-aat.internal"
}
requestUrlContains = requestUrlContains.replaceFirst('^https?://', '').replaceFirst('/.*$', '').toLowerCase()
def status = steps.sh(
script: """
AZURE_CONFIG_DIR='${azureConfigDir}' \\
APP_INSIGHTS_SOURCE_ENV='${environment}' \\
APP_INSIGHTS_ENV='${appInsightsEnvironment}' \\
APP_INSIGHTS_REQUEST_URL_CONTAINS='${requestUrlContains}' \\
APP_INSIGHTS_TRACE_MARKER='${env.APP_INSIGHTS_TRACE_MARKER}' \\
./scripts/check-app-insights-telemetry.sh
""",
returnStatus: true
)

if (status == 0) {
return
}

def message = "Application Insights telemetry check did not pass for ${environment} (exit code ${status})."
def telemetryRequired = env.APP_INSIGHTS_TELEMETRY_REQUIRED?.toBoolean() && environment != 'preview'
if (telemetryRequired) {
steps.error(message)
}
steps.echo("${message} Continuing because telemetry smoke check is non-blocking for ${environment}.")
}
19 changes: 16 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ext {
junit = '5.14.4'
junitPlatform = '1.14.4'
jjwt = '0.13.0'
appInsightsVersion = '2.6.4'
appInsightsVersion = '3.7.8'
pactProviderVersion = '4.7.1'
lombokVersion = '1.18.46'
lombokBindingVersion = '0.2.0'
Expand Down Expand Up @@ -307,8 +307,7 @@ dependencies {
implementation group: 'com.auth0', name: 'java-jwt', version: '4.5.2'
implementation group: 'com.google.guava', name: 'guava', version: '33.6.0-jre'
implementation group: 'com.github.ben-manes.caffeine', name: 'caffeine', version: '3.2.4'
implementation group: 'com.microsoft.azure', name: 'applicationinsights-logging-logback', version: appInsightsVersion
implementation group: 'com.microsoft.azure', name: 'applicationinsights-spring-boot-starter', version: appInsightsVersion
implementation group: 'com.microsoft.azure', name: 'applicationinsights-core', version: appInsightsVersion
implementation group: 'com.sun.mail', name: 'mailapi', version: '2.0.2'
implementation group: 'com.vladmihalcea', name: 'hibernate-types-60', version: '2.21.1'
implementation group: 'commons-validator', name: 'commons-validator', version: '1.10.1'
Expand Down Expand Up @@ -477,6 +476,20 @@ task projectVersion {
}
}

task printAuditLogFormatterTag {
dependsOn classes

doLast {
def urls = sourceSets.main.runtimeClasspath.files.collect { it.toURI().toURL() } as URL[]
def loader = new URLClassLoader(urls, Thread.currentThread().contextClassLoader)
try {
println loader.loadClass('uk.gov.hmcts.ccd.auditlog.AuditLogFormatter').getField('TAG').get(null)
} finally {
loader.close()
}
}
}

// copied from https://github.com/joelittlejohn/jsonschema2pojo/tree/master/jsonschema2pojo-gradle-plugin
// Note A problem was found with the configuration of task ':generateJsonSchema2Pojo'.
// Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated
Expand Down
3 changes: 2 additions & 1 deletion charts/ccd-data-store-api/values.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ java:
alias: IDAM_DATA_STORE_SYSTEM_USER_PASSWORD
- name: data-store-api-TOKEN-SECRET
alias: DATA_STORE_TOKEN_SECRET
- name: app-insights-connection-string
alias: app-insights-connection-string
environment:
AZURE_APPLICATIONINSIGHTS_INSTRUMENTATIONKEY: "2dcb834e-768e-4429-9050-ab15af959995"
DATA_STORE_DB_HOST: "{{ .Release.Name }}-postgresql"
DATA_STORE_DB_NAME: data-store
DATA_STORE_DB_USERNAME: "{{ .Values.postgresql.auth.username}}"
Expand Down
Loading