Environment Variables#
This document describes the environment variables required for running release management and CI/CD scripts in the Bifrost SDK project.
Overview#
For security reasons, credentials and tokens are not stored in version control. Instead, they must be provided via environment variables. This document lists all required environment variables and provides setup instructions.
Required Environment Variables#
Bitbucket API Access#
ATLASSIAN_USERNAME#
Used by:
scripts/mcux_pr/*(allwest pr*commands)Purpose: Shared Atlassian account username for Bitbucket (and potentially other Atlassian services)
Note: Preferred over
USERNAMEin CI becauseUSERNAMEis commonly pre-set by the OS on Windows.
ATLASSIAN_PASSWORD#
Used by:
scripts/mcux_pr/*(allwest pr*commands)Purpose: Shared Atlassian account password for Bitbucket (and potentially other Atlassian services)
Note: Prefer token-based auth (
BITBUCKET_TOKEN) when possible.
ATLASSIAN_DISPLAYNAME#
Used by:
scripts/mcux_pr/*(allwest pr*commands)Purpose: Git committer display name used by CI/service-account workflows (when CLI
--gituseris not provided)
ATLASSIAN_EMAIL#
Used by:
scripts/mcux_pr/*(allwest pr*commands)Purpose: Git committer email used by CI/service-account workflows (when CLI
--gitemailis not provided)
BITBUCKET_TOKEN#
Used by:
scripts/mcux_pr/*(allwest pr*commands)
Purpose: Authentication token for creating release branches via Bitbucket API
How to obtain: Generate a personal access token from Bitbucket settings with repository write permissions
Required permissions: Repository write, pull request read/write
BITBUCKET_USERNAME#
Used by:
Purpose: Username for Bitbucket API authentication when parsing PR changes
How to obtain: Your Bitbucket account username
BITBUCKET_PASSWORD#
Used by:
Purpose: Password for Bitbucket API authentication when parsing PR changes
How to obtain: Your Bitbucket account password or app-specific password
Note: Consider using app-specific passwords instead of your main account password
GitHub API Access#
GITHUB_TOKEN#
Purpose: Personal access token for synchronizing releases to GitHub
How to obtain: Generate a personal access token from GitHub settings → Developer settings → Personal access tokens
Required permissions:
repo(full control of private repositories)
GITHUB_BOT_ACCOUNT (Optional)#
Purpose: GitHub bot account username for automated releases
Default value:
McuxCIBot(if not specified)How to set: Use your organization’s bot account name
MCUX Business Intelligence#
MCUX_BI_USERNAME#
Purpose: Username for MCUX business intelligence data collection
How to obtain: Contact your MCUX BI administrator
MCUX_BI_PASSWORD#
Purpose: Password for MCUX business intelligence data collection
How to obtain: Contact your MCUX BI administrator
MCUX_BI_EMAIL (Optional)#
Purpose: Email address for MCUX BI operations
Default value:
mcu_sdk.ci@nxp.com(if not specified)
Setup Instructions#
Using .env File (Recommended for Local Development)#
Many scripts automatically load environment variables from a .env file in the project root directory using python-dotenv. This is the easiest method for local development.
Install python-dotenv (if not already installed):
pip install python-dotenv
Copy the example file:
# Windows cmd copy .env.example .env # PowerShell Copy-Item .env.example .env # Unix/Linux/macOS cp .env.example .env
Edit the
.envfile with your credentials:# Open in your preferred text editor notepad .env # Windows code .env # VS Code nano .env # Unix/Linux/macOS
Ensure
.envis in.gitignore(already configured in this project)
Scripts that support .env files:
Windows Command Prompt (cmd.exe)#
Set environment variables for the current session:
set BITBUCKET_TOKEN=your_token_here
set BITBUCKET_USERNAME=your_username
set BITBUCKET_PASSWORD=your_password
set GITHUB_TOKEN=your_github_token
set GITHUB_BOT_ACCOUNT=McuxCIBot
set MCUX_BI_USERNAME=your_bi_username
set MCUX_BI_PASSWORD=your_bi_password
set MCUX_BI_EMAIL=your_email@example.com
To set permanently (system-wide):
setx BITBUCKET_TOKEN "your_token_here"
setx GITHUB_TOKEN "your_github_token"
Note: setx requires reopening the terminal to take effect.
Windows PowerShell#
Set environment variables for the current session:
$env:BITBUCKET_TOKEN = 'your_token_here'
$env:BITBUCKET_USERNAME = 'your_username'
$env:BITBUCKET_PASSWORD = 'your_password'
$env:GITHUB_TOKEN = 'your_github_token'
$env:GITHUB_BOT_ACCOUNT = 'McuxCIBot'
$env:MCUX_BI_USERNAME = 'your_bi_username'
$env:MCUX_BI_PASSWORD = 'your_bi_password'
$env:MCUX_BI_EMAIL = 'your_email@example.com'
To set permanently (user profile):
[System.Environment]::SetEnvironmentVariable('BITBUCKET_TOKEN', 'your_token_here', 'User')
[System.Environment]::SetEnvironmentVariable('GITHUB_TOKEN', 'your_github_token', 'User')
Unix/Linux/macOS (bash/zsh)#
Set environment variables for the current session:
export BITBUCKET_TOKEN=your_token_here
export BITBUCKET_USERNAME=your_username
export BITBUCKET_PASSWORD=your_password
export GITHUB_TOKEN=your_github_token
export GITHUB_BOT_ACCOUNT=McuxCIBot
export MCUX_BI_USERNAME=your_bi_username
export MCUX_BI_PASSWORD=your_bi_password
export MCUX_BI_EMAIL=your_email@example.com
To set permanently, add the above lines to your shell profile:
# For bash
echo 'export BITBUCKET_TOKEN=your_token_here' >> ~/.bashrc
echo 'export GITHUB_TOKEN=your_github_token' >> ~/.bashrc
# For zsh
echo 'export BITBUCKET_TOKEN=your_token_here' >> ~/.zshrc
echo 'export GITHUB_TOKEN=your_github_token' >> ~/.zshrc
Then reload your profile:
source ~/.bashrc # or ~/.zshrc
CI/CD Environment Setup#
GitHub Actions#
Add secrets to your repository (Settings → Secrets and variables → Actions):
- name: Run release script
env:
BITBUCKET_TOKEN: ${{ secrets.BITBUCKET_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MCUX_BI_USERNAME: ${{ secrets.MCUX_BI_USERNAME }}
MCUX_BI_PASSWORD: ${{ secrets.MCUX_BI_PASSWORD }}
run: west release-createbranch
Jenkins#
Configure credentials in Jenkins (Manage Jenkins → Credentials) and use them in your pipeline:
withCredentials([
string(credentialsId: 'bitbucket-token', variable: 'BITBUCKET_TOKEN'),
string(credentialsId: 'github-token', variable: 'GITHUB_TOKEN'),
usernamePassword(credentialsId: 'mcux-bi-creds',
usernameVariable: 'MCUX_BI_USERNAME',
passwordVariable: 'MCUX_BI_PASSWORD')
]) {
sh 'west release-createbranch'
}
GitLab CI/CD#
Add variables to your project (Settings → CI/CD → Variables):
release:
script:
- west release-createbranch
variables:
BITBUCKET_TOKEN: $BITBUCKET_TOKEN
GITHUB_TOKEN: $GITHUB_TOKEN
MCUX_BI_USERNAME: $MCUX_BI_USERNAME
MCUX_BI_PASSWORD: $MCUX_BI_PASSWORD
Security Best Practices#
Never commit credentials to version control
Always use environment variables or secure credential storage
Review commits before pushing to ensure no credentials are included
Use app-specific passwords when possible
Generate dedicated tokens/passwords for CI/CD instead of using main account credentials
This limits the impact if credentials are compromised
Rotate credentials regularly
Update tokens and passwords on a regular schedule
Immediately rotate if you suspect credentials have been compromised
Use minimal required permissions
Grant only the permissions needed for the specific task
For example, use read-only tokens where write access is not needed
Secure credential storage in CI/CD
Use your CI/CD platform’s secure secret storage features
Never expose secrets in logs or output
Use
.gitignorefor local credential filesThe
.envfile is already in.gitignoreto prevent accidental commitsNever commit your
.envfile to version controlSee
.env.examplefor a template
Install python-dotenv dependency
Required for automatic
.envfile loading:pip install python-dotenvWithout this package, you must set environment variables manually
Troubleshooting#
Error: “Bitbucket token not found”#
Cause: The BITBUCKET_TOKEN environment variable is not set.
Solution:
# Windows cmd
set BITBUCKET_TOKEN=your_token_here
# Windows PowerShell
$env:BITBUCKET_TOKEN = 'your_token_here'
# Unix/Linux/macOS
export BITBUCKET_TOKEN=your_token_here
Error: “GitHub token not found”#
Cause: The GITHUB_TOKEN environment variable is not set.
Solution:
# Windows cmd
set GITHUB_TOKEN=your_github_token
# Windows PowerShell
$env:GITHUB_TOKEN = 'your_github_token'
# Unix/Linux/macOS
export GITHUB_TOKEN=your_github_token
Error: “MCUX BI credentials not found”#
Cause: Either MCUX_BI_USERNAME or MCUX_BI_PASSWORD (or both) are not set.
Solution:
# Windows cmd
set MCUX_BI_USERNAME=your_username
set MCUX_BI_PASSWORD=your_password
# Windows PowerShell
$env:MCUX_BI_USERNAME = 'your_username'
$env:MCUX_BI_PASSWORD = 'your_password'
# Unix/Linux/macOS
export MCUX_BI_USERNAME=your_username
export MCUX_BI_PASSWORD=your_password
Environment variables not persisting#
Windows: Use setx instead of set, or set them in System Properties → Environment Variables.
Unix/Linux/macOS: Add the export commands to your shell profile (~/.bashrc, ~/.zshrc, etc.) and reload it.
CI/CD pipeline fails with authentication errors#
Solution:
Verify that secrets are correctly configured in your CI/CD platform
Check that variable names match exactly (case-sensitive)
Ensure tokens have the required permissions
Check token expiration dates and rotate if needed
Additional Resources#
Support#
For issues or questions about environment variables and credentials:
Check this documentation first
Review the error messages for specific guidance
Contact your team’s DevOps or security administrator
Refer to the project’s main
readme.mdfor general setup instructions