Skip to content

Commit 1d11a2d

Browse files
adding dco to this check
also updating docs Signed-off-by: Sean Simmons <ssimmons@progress.com>
1 parent a007abb commit 1d11a2d

File tree

5 files changed

+129
-7
lines changed

5 files changed

+129
-7
lines changed

.github/workflows/ci-main-pull-request.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ on:
101101
required: false
102102
type: string
103103
default: 'main'
104+
perform-dco-check:
105+
description: 'Perform DCO (Developer Certificate of Origin) check on pull requests'
106+
required: false
107+
type: boolean
108+
default: true
109+
dco-version:
110+
description: 'Version of DCO check workflow to use (e.g., main, v1.0.7)'
111+
required: false
112+
type: string
113+
default: 'main'
104114
perform-language-linting:
105115
description: 'Perform language-specific linting and pre-compilation checks'
106116
required: false

.github/workflows/dco-check.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# DCO (Developer Certificate of Origin) Check
2+
#
3+
# Verifies that all commits in a pull request are signed off with DCO
4+
#
5+
# See https://developercertificate.org/ for more information about DCO
6+
7+
name: DCO Check
8+
9+
on:
10+
workflow_call:
11+
inputs:
12+
github-event-name:
13+
description: 'GitHub event name (pass github.event_name from calling workflow)'
14+
required: false
15+
type: string
16+
default: ''
17+
18+
permissions: {}
19+
20+
jobs:
21+
dco_check_job:
22+
permissions:
23+
contents: read
24+
pull-requests: read
25+
runs-on: ubuntu-latest
26+
name: DCO Check
27+
steps:
28+
- name: Skip if not pull request
29+
if: ${{ inputs.github-event-name != 'pull_request' && inputs.github-event-name != 'pull_request_target' }}
30+
run: |
31+
echo "DCO check only runs on pull_request events. Skipping..."
32+
exit 0
33+
34+
- name: Get PR Commits
35+
if: ${{ inputs.github-event-name == 'pull_request' || inputs.github-event-name == 'pull_request_target' }}
36+
uses: tim-actions/get-pr-commits@master
37+
id: 'get-pr-commits'
38+
with:
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: DCO Check
42+
if: ${{ inputs.github-event-name == 'pull_request' || inputs.github-event-name == 'pull_request_target' }}
43+
uses: tim-actions/dco@master
44+
with:
45+
commits: ${{ steps.get-pr-commits.outputs.commits }}

.github/workflows/stubs/ci-main-pull-request-stub.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,43 @@ jobs:
3636
detect-version-source-parameter: '' # use for file name
3737
language: 'go' # Go, Ruby, Rust, JavaScript, TypeScript, Python, Java, C#, PHP, other - used for build and SonarQube language setting
3838

39+
# ============================================================================
40+
# SUB-WORKFLOW VERSION CONTROL (NEW IN v1.0.7+)
41+
# ============================================================================
42+
# Pin individual scan/workflow versions for stability. Uncomment to use.
43+
# All default to 'main' if not specified. Use 'v1.0.7' format for stable versions.
44+
# See: https://github.com/chef/common-github-actions/blob/main/HOW-TO-USE.md#sub-workflow-versioning-new
45+
# ============================================================================
46+
# scc-version: 'main' # Source code complexity checks
47+
# dco-version: 'main' # Developer Certificate of Origin check
48+
# trufflehog-version: 'main' # Secret scanning (TruffleHog)
49+
# grype-version: 'main' # Grype source/image scanning
50+
# grype-hab-workflow-version: 'main' # Grype Habitat package scanning
51+
# polaris-version: 'main' # BlackDuck Polaris SAST
52+
# sbom-version: 'main' # SBOM generation and BlackDuck SCA
53+
# quality-dashboard-version: 'main' # Quality dashboard reporting
54+
55+
# ============================================================================
56+
# SECURITY SCANS & CODE QUALITY
57+
# ============================================================================
58+
3959
# complexity-checks
4060
perform-complexity-checks: true
41-
# scc-version: 'main' # Version of SCC workflow (main, v1.0.7, etc.)
4261
# scc-output-filename: 'scc-output.txt'
4362
perform-language-linting: false # Perform language-specific linting and pre-compilation checks
4463

64+
# DCO (Developer Certificate of Origin) check
65+
perform-dco-check: true # Validate commit sign-offs on pull requests
66+
4567
# trufflehog secret scanning
4668
perform-trufflehog-scan: true
47-
# trufflehog-version: 'main' # Version of Trufflehog workflow (main, v1.0.7, etc.)
4869

4970
# trivy dependency and container scanning
5071
perform-trivy-scan: true
51-
# grype-version: 'main' # Version of Grype workflow for source/image scans (main, v1.0.7, etc.)
52-
# grype-hab-version: 'main' # Version of Grype Habitat package scan workflow (main, v1.0.7, etc.)
5372

5473
# BlackDuck SAST (Polaris) and SCA scans (requires a build or download to do SAST)
5574
# requires these secrets: POLARIS_SERVER_URL, POLARIS_ACCESS_TOKEN
5675
perform-blackduck-polaris: true
57-
# polaris-version: 'main' # Version of Polaris SAST workflow (main, v1.0.7, etc.)
5876
polaris-application-name: "Chef-Chef360" # one of these: Chef-Agents, Chef-Automate, Chef-Chef360, Chef-Habitat, Chef-Infrastructure-Server, Chef-Shared-Services, Chef-Other, Chef-Non-Product
5977
polaris-project-name: ${{ github.event.repository.name }}
6078
# polaris-blackduck-executable: 'path/to/blackduck/binary'
@@ -87,7 +105,6 @@ jobs:
87105
perform-docker-scan: false # scan Dockerfile and built images with Docker Scout or Trivy; see repo custom properties matching "container"
88106

89107
# report to central developer dashboard
90-
# quality-dashboard-version: 'main' # Version of quality dashboard workflow (main, v1.0.7, etc.)
91108
report-to-atlassian-dashboard: false
92109
quality-product-name: 'Chef-360' # product name for quality reporting, like Chef360, Courier, Inspec
93110
# quality-product-name: ${{ github.event.repository.name }} # like 'Chef-360' - the product name for quality reporting, like Chef360, Courier, Inspec
@@ -111,7 +128,6 @@ jobs:
111128
publish-packages: false # Publish packages (e.g., container from Dockerfile to ECR, go-releaser binary to releases page, omnibus to artifactory, gems, choco, homebrew, other app stores)
112129

113130
# generate and export Software Bill of Materials (SBOM) in various formats
114-
# sbom-version: 'main' # Version of SBOM workflow (main, v1.0.7, etc.)
115131
generate-sbom: true
116132
export-github-sbom: true # SPDX JSON artifact on job instance
117133
perform-blackduck-sca-scan: true # combined with generate sbom & generate github-sbom, also needs version above

HOW-TO-USE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ jobs:
119119
with:
120120
# Pin individual scan versions
121121
scc-version: 'v1.0.7' # Use stable SCC
122+
dco-version: 'v1.0.7' # Use stable DCO check
122123
trufflehog-version: 'v1.0.7' # Use stable TruffleHog
123124
grype-version: 'main' # Use latest Grype
124125
grype-hab-workflow-version: 'v1.0.6' # Use older Habitat scan
@@ -136,6 +137,7 @@ jobs:
136137

137138
**Available Version Inputs:**
138139
- `scc-version` - Source code complexity checks
140+
- `dco-version` - Developer Certificate of Origin check
139141
- `trufflehog-version` - Secret scanning
140142
- `grype-version` - Grype image/source scanning
141143
- `grype-hab-workflow-version` - Grype Habitat package scanning
@@ -344,6 +346,7 @@ jobs:
344346
| Input | Type | Default | Description |
345347
|-------|------|---------|-------------|
346348
| `perform-complexity-checks` | boolean | `true` | Run SCC complexity checks |
349+
| `perform-dco-check` | boolean | `true` | Run DCO (Developer Certificate of Origin) check on pull requests |
347350
| `perform-language-linting` | boolean | `true` | Run language-specific linting |
348351
| `perform-trufflehog-scan` | boolean | `true` | Run TruffleHog secret scan |
349352
| `perform-trivy-scan` | boolean | `true` | Run Trivy vulnerability scan |

PIPELINE-REFERENCE.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
| Input | Workflow | Default | Description |
4444
|-------|----------|---------|-------------|
4545
| `scc-version` | scc.yml | `main` | Source code complexity |
46+
| `dco-version` | dco-check.yml | `main` | Developer Certificate of Origin check |
4647
| `trufflehog-version` | trufflehog.yml | `main` | Secret scanning |
4748
| `grype-version` | grype.yml | `main` | Image/source scanning |
4849
| `grype-hab-workflow-version` | grype-hab-package-scan.yml | `main` | Habitat package scanning |
@@ -142,6 +143,52 @@ graph LR
142143

143144
---
144145

146+
### **DCO (Developer Certificate of Origin) Check**
147+
148+
**Purpose:** Validates that all commits in a pull request are signed with a Developer Certificate of Origin (DCO), ensuring contributors certify their right to submit the code.
149+
150+
**What it checks:**
151+
- Presence of "Signed-off-by" line in commit messages
152+
- Proper DCO signature format
153+
- All commits in the pull request have valid DCO sign-offs
154+
155+
**Reporting:**
156+
- Job status (pass/fail) in GitHub Actions
157+
- Comments on pull requests indicating which commits are missing DCO signatures
158+
- Detailed logs available in workflow output
159+
160+
#### Job Mapping
161+
162+
```mermaid
163+
graph LR
164+
A[run-dco-check Job] -->|calls| B[dco-check.yml]
165+
B -->|requires| C[Variables]
166+
167+
C -->|input| D[github-event-name: string]
168+
C -->|version| E[dco-version: string]
169+
170+
style A fill:#ffe1e1
171+
style B fill:#ffd4d4
172+
```
173+
174+
**Workflow File:** `chef/common-github-actions/.github/workflows/dco-check.yml@{version}`
175+
176+
**Version Input:**
177+
- `dco-version` (string) - Version of DCO check workflow to use (e.g., 'main', 'v1.0.7'), default: 'main'
178+
179+
**Required Variables:**
180+
- `github-event-name` (string) - GitHub event name to determine if this is a pull request event
181+
182+
**Condition:** `inputs.perform-dco-check == true`
183+
184+
**Notes:**
185+
- Only executes on pull_request events
186+
- Automatically skipped for push events and other triggers
187+
- Uses tim-actions/get-pr-commits and tim-actions/dco for validation
188+
- Contributors can add DCO sign-off using: `git commit -s` or `git commit --signoff`
189+
190+
---
191+
145192
## Language-Specific Analysis
146193

147194
### **Linting Tools**
@@ -764,6 +811,7 @@ sequenceDiagram
764811
| Tool | Type | Primary Use | Workflow File | Output Location |
765812
|------|------|-------------|---------------|-----------------|
766813
| SCC | Complexity | Code metrics | scc.yml | GitHub Artifacts |
814+
| DCO Check | Compliance | Commit sign-off validation | dco-check.yml | Actions Logs/PR Comments |
767815
| TruffleHog | Secret Scan | Credential detection | trufflehog.yml | Actions Logs |
768816
| Trivy | Vulnerability | Dependencies & containers | trivy.yml | GitHub Artifacts/Security |
769817
| BlackDuck Polaris | SAST | Security vulnerabilities | Inline | polaris.blackduck.com |

0 commit comments

Comments
 (0)