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 |
|---|---|---|---|---|
|
string |
✓ |
|
Docker/container registry URL |
|
string |
✓ |
|
Base directory path in the registry |
|
string |
✓ |
|
Kubernetes secret name for image pull auth |
|
string |
✓ |
|
Docker-in-Docker image for build containers |
Kubernetes & Infrastructure
| Variable | Type | Required | Example | Description |
|---|---|---|---|---|
|
string |
✓ |
Kubernetes API endpoint |
|
|
string |
✓ |
|
Image with kubectl/deployment tools for prod/staging |
|
string |
✓ |
|
Image with kubectl for sandbox/dev environments |
|
string |
✓ |
|
Maps Jenkins environment to application environment |
Secrets & Configuration Management
| Variable | Type | Required | Example | Description |
|---|---|---|---|---|
|
string |
✓ |
HashiCorp Vault server address |
|
|
string |
✓ |
HashiCorp Consul server address |
|
|
string |
✓ (Maven) |
Username for internal Maven artifact repository (Nexus) |
|
|
string |
✓ (Maven) |
Password for internal Maven artifact repository |
Scanning & Quality Tools
| Variable | Type | Required | Example | Description |
|---|---|---|---|---|
|
string |
✓ |
|
Flexline security scanning container image |
|
string |
✓ |
Flexline server address |
|
|
string |
✓ |
API key for Flexline authentication |
|
|
string |
✓ (Maven) |
Path to CNES report generation JAR |
|
|
string |
✓ (Maven) |
Location where CNES JAR is installed |
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
deployVersionin jenkins.yaml if needed
JavaScript Projects:
-
Version must be extracted from
package.json -
Requires a
scripts/version.shscript (see ISS example) -
Script output becomes available to pipeline as
VERSIONenv var
Go/Other:
-
Version should be extracted via project-specific script
-
Store result in
VERSIONenv var for consumption by JSL
Deployment Environment Mapping
| Variable | Source | Java | JavaScript | Docker | Skaffold/Kustomize |
|---|---|---|---|---|---|
|
jenkins.yaml ( |
✓ |
✓ |
✓ |
✓ |
|
Derived from |
✓ |
✓ |
✓ |
✓ |
|
pom.xml or scripts/version.sh |
✓ |
✓ |
✓ |
✓ |
|
jenkins.yaml ( |
✓ |
✓ |
✓ |
✓ |
|
jenkins.yaml ( |
✓ |
✓ |
✓ |
✓ |
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.nvmrcor 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.
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
...
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
-
Keep sensitive variables in Jenkins Credentials, not in jenkins.yaml
-
Use
MAP_ENVIRONMENTconsistently — it’s the single source of truth for env mapping -
Document custom env vars if your project adds any beyond this reference
-
Test version extraction before deploying — use
VERSIONenv var in a test stage -
Use runtime parameter overrides (e.g.,
DEPLOY_NAMESPACE) sparingly; jenkins.yaml should be your source of truth -
For new languages, ensure version extraction is documented and tested before JSL integration