Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CircleCI Pipeline Configuration Guide
Overview
This CircleCI pipeline ensures secure and automated building, testing, and publishing of the Okta Python SDK.
Pipeline Structure
1. Security Scanning Jobs (Run First in Parallel)
Snyk Scan (
snyk-scan)static-analysiscontextReversing Labs (
reversing-labs)okta-dcpcontext2. Build Job (
build)requirements.txt3. Unit Tests Job (
unit_tests)tests/unitdirectory4. Integration Tests Job (
integration_tests)tests/integrationdirectory5. Publishing Job (
publish_to_pypi)twine checkWorkflows
non-prod(Runs on PRs and non-master branches - internal contributors)contributors(Runs on PRs from forked repositories - external contributors)prod(Runs only on master branch)masterbranchv*patternRequired CircleCI Project Settings
Forked Pull Request Settings
To properly handle forked PRs, configure these settings in CircleCI:
This configuration ensures:
Required CircleCI Contexts
You need to configure the following contexts in CircleCI:
1.
static-analysis2.
okta-dcpRESOURCE_TOKEN- Token for downloading RL scannerAWS_ARN- AWS role ARN for authentication3.
pypi-publishPYPI_TOKEN- PyPI API token (use__token__as username)Setting Up PyPI Token
oktapackage)pypi-publishcontextPYPI_TOKEN=<your-token>Security Features
Testing the Pipeline
On Forked Repository PRs
When an external contributor submits a PR from a forked repository:
# External contributor forks and creates PRExpected:
To manually approve and run with secrets:
On Feature Branches (Internal Repository)
Expected: Build, test, and security scans run automatically. No publishing.
On Master Branch
Expected: Build, test, security scans run, and then publishes to PyPI.
Using Version Tags
Expected: Triggers the publish workflow with full pipeline.
Troubleshooting
How to Find Coverage Reports
Coverage reports are generated for both unit and integration tests and stored as CircleCI artifacts.
To access coverage reports:
unit_testsorintegration_testscoverage-unit/foldercoverage-integration/folderCoverage report formats available:
coverage.xml- Machine-readable XML format (for CI/CD tools)html/index.html- Human-readable HTML report with detailed line-by-line coverageTo view the HTML coverage report:
coverage-unit/html/index.htmlorcoverage-integration/html/index.htmlCoverage Metrics Explained:
Example Coverage Summary in Logs:
Forked PRs Not Building
Security Scans Failing on Forked PRs
Publishing Fails
PYPI_TOKENis set correctly in thepypi-publishcontextsetup.pyhasn't been published beforeSecurity Scans Fail
static-analysis,okta-dcp)Build Fails
requirements.txtare availableBest Practices
vprefix (e.g.,v3.0.1)Pipeline Diagram
Non-Prod (Internal PRs and Feature Branches)
┌─────────────────────────────────────────────────────────────┐⚠️ Security scans skipped (no context access) │⚠️ Maintainer should review code before merging │
│ Contributors: External Contributors │
├─────────────────────────────────────────────────────────────┤
│
│ │
│ Step 1: Build │
│ ┌────────────────────────────────────────┐ │
│ │ build │ │
│ │ • Install dependencies │ │
│ │ • Build distribution packages │ │
│ └────────────────────────────────────────┘ │
│ ↓ │
│ Step 2: Unit Tests (Only if build succeeds) │
│ ┌────────────────────────────────────────┐ │
│ │ unit_tests │ │
│ │ • Run tests/unit │ │
│ └────────────────────────────────────────┘ │
│ ↓ │
│ Step 3: Integration Tests (Only if unit tests pass) │
│ ┌────────────────────────────────────────┐ │
│ │ integration_tests │ │
│ │ • Run tests/integration │ │
│ └────────────────────────────────────────┘ │
│ │
│
└─────────────────────────────────────────────────────────────┘
Prod (Master Branch Only + Version Tags)
Notes