Environment Variables & Credentials Reference

JSL-based projects rely on environment variables configured in Jenkins and used throughout the pipeline. This reference covers what variables JSL expects, how they’re used, and how project types differ.

Jenkins-Required Environment Variables

These variables must be defined at the Jenkins instance level and are used by JSL for infrastructure, credentials, and tooling.

Container & Image Management

Variable Type Required Example Description

DTR_URL

string

registry.mobilehealth.va.gov

Docker/container registry URL

DTR_DIR

string

/ckm

Base directory path in the registry

IMAGE_PULL_SECRET

string

registry-credentials-secret

Kubernetes secret name for image pull auth

DIND_IMAGE

string

ckm/map-dind-image:2.0.10

Docker-in-Docker image for build containers

Kubernetes & Infrastructure

Variable Type Required Example Description

K8_API

string

https://k8s-api.mobilehealth.va.gov

Kubernetes API endpoint

K8_DEPLOY_IMAGE

string

ckm/map-maven-base-image:2.0.9-JDK21-…​

Image with kubectl/deployment tools for prod/staging

K8_DEPLOY_IMAGE_TEST

string

ckm/map-maven-base-image:2.0.9-JDK21-…​

Image with kubectl for sandbox/dev environments

MAP_ENVIRONMENT

string

sandbox, sqa, staging, prod

Maps Jenkins environment to application environment

Secrets & Configuration Management

Variable Type Required Example Description

VAULT_ADDR

string

https://vault.mobilehealth.va.gov

HashiCorp Vault server address

CONSUL_ADDR

string

https://consul.mobilehealth.va.gov

HashiCorp Consul server address

VA_NEXUS_USER

string

✓ (Maven)

Username for internal Maven artifact repository (Nexus)

VA_NEXUS_PWD

string

✓ (Maven)

Password for internal Maven artifact repository

Scanning & Quality Tools

Variable Type Required Example Description

FLEXLINE_IMAGE

string

flexline/agent:latest

Flexline security scanning container image

FLEXLINE_HOST

string

https://flexline.mobilehealth.va.gov

Flexline server address

FLEXLINE_API_KEY

string

API key for Flexline authentication

CNESREPORT_JAR

string

✓ (Maven)

Path to CNES report generation JAR

CNES_JAR_LOCATION

string

✓ (Maven)

Location where CNES JAR is installed

Build Tool Images

Variable Type Required Example Description

VV_AUTOMATION_VERSION

string

5.0.2

V&V (Validation & Verification) automation test image version

Project-Provided Environment Variables

These variables are set by your project (in jenkins.yaml or scripts) and passed to JSL for customization.

Version Handling

Java Projects (Maven):

  • Version is auto-detected from pom.xml

  • Passed to JSL as version, majorVersion

  • Override with deployVersion in jenkins.yaml if needed

JavaScript Projects:

  • Version must be extracted from package.json

  • Requires a scripts/version.sh script (see ISS example)

  • Script output becomes available to pipeline as VERSION env var

Go/Other:

  • Version should be extracted via project-specific script

  • Store result in VERSION env var for consumption by JSL

Deployment Environment Mapping

Variable Source Java JavaScript Docker Skaffold/Kustomize

NAMESPACE

jenkins.yaml (deployNamespace)

VAMF_ENVIRONMENT

Derived from MAP_ENVIRONMENT

VERSION

pom.xml or scripts/version.sh

SLACK_NOTIFICATION

jenkins.yaml (enableSlackNotifications)

SLACK_CHANNEL

jenkins.yaml (slackChannel)

Build-Specific Variables

Skaffold/Kustomize Projects:

  • SKAFFOLD_PROFILE — Kustomize overlay selection (e.g., beta, standard)

  • K8_DOCKER_REGISTRY — Image registry for Skaffold deploys

  • MANIFEST_CHANGED — Boolean flag; controls auto-deploy triggering

Docker-only Projects:

  • DOCKERFILE_PATH — Path to Dockerfile (default: ./Dockerfile)

  • DOCKER_BUILD_ARGS — Additional docker build arguments

  • REGISTRY_PATH — Path in registry for image push (e.g., /myservice:${VERSION})

Language-Specific Differences

Java/Maven Projects

Version source: pom.xml

<version>1.2.3-SNAPSHOT</version>

Required env vars for build:

  • VA_NEXUS_USER, VA_NEXUS_PWD — for Maven artifact resolution

  • CNESREPORT_JAR, CNES_JAR_LOCATION — for CNES scanning (if enabled)

Scanning: SonarQube via Maven plugin (sonar:sonar goal)

JavaScript Projects

Version source: package.json (requires scripts/version.sh)

{
  "version": "2.0.1"
}

Required env vars for build:

  • Node.js version — typically via .nvmrc or docker build args

Scanning: SonarQube via sonar-scanner CLI (JavaScript-specific paths needed)

Note: JSL’s Sonar support assumes Maven plugin paths; JavaScript projects need custom sonar-scanner setup or JSL enhancement.

Go Projects

Version source: Custom script (e.g., scripts/version.sh or git tag parsing)

Required env vars: Project-specific; no standard Go build version source

Setting Environment Variables in Jenkins

Instance-Level Variables

Go to Manage Jenkins > System > Global properties to add:

DTR_URL=registry.mobilehealth.va.gov
MAP_ENVIRONMENT=sandbox
VAULT_ADDR=https://vault.mobilehealth.va.gov
...

Credential Binding

Use Jenkins Credentials plugin to manage sensitive variables:

  1. Create credential (username/password or secret text)

  2. Reference in Jenkinsfile via withCredentials() block

  3. JSL’s getCredentials() function handles this automatically

Job-Level Parameters

Some variables can be overridden as job parameters at build time:

  • DEPLOY_NAMESPACE — override target namespace

  • DEPLOY_VERSION — override version to deploy

  • RUN_SONAR_ONLY — skip build, run Sonar only

Docker vs Skaffold/Kustomize Differences

Docker-Only Approach

# Minimal env vars needed
DOCKERFILE_PATH=./Dockerfile
REGISTRY_PATH=/myapp:${VERSION}
  • Build context is straightforward (just Docker)

  • Version extracted from project-specific script

  • Deploy via simple image push + manifest update

Skaffold/Kustomize Approach

# More env vars for orchestration
SKAFFOLD_PROFILE=beta  # or 'standard'
MANIFEST_CHANGED=true  # triggers auto-deploy
K8_DOCKER_REGISTRY=...
VAMF_ENVIRONMENT=...   # drives Kustomize overlay selection
  • Version extracted from pom.xml (Maven integration)

  • Skaffold profiles drive build behavior

  • Kustomize overlays per environment

  • Auto-deploy can be triggered based on manifest changes

Best Practices

  1. Keep sensitive variables in Jenkins Credentials, not in jenkins.yaml

  2. Use MAP_ENVIRONMENT consistently — it’s the single source of truth for env mapping

  3. Document custom env vars if your project adds any beyond this reference

  4. Test version extraction before deploying — use VERSION env var in a test stage

  5. Use runtime parameter overrides (e.g., DEPLOY_NAMESPACE) sparingly; jenkins.yaml should be your source of truth

  6. For new languages, ensure version extraction is documented and tested before JSL integration