Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Contributing to Two-Node Toolbox

Two-Node Toolbox (TNT) is a deployment automation framework for two-node
OpenShift clusters in development and testing environments. It supports
arbiter and fencing topologies via dev-scripts, kcli, and assisted installer
deployment methods. Contributions from across Red Hat engineering are welcome.

## Getting Started

1. Fork `openshift-eng/two-node-toolbox` on GitHub.
2. Clone your fork:

```bash
git clone git@github.com:<your-username>/two-node-toolbox.git
cd two-node-toolbox
```

3. Set up commit signing (GPG or SSH). The repo enforces signature
verification — unsigned commits are rejected. See [GitHub's signing
docs](https://docs.github.com/en/authentication/managing-commit-signature-verification)
for setup instructions.
Comment on lines +18 to +21

@coderabbitai coderabbitai Bot Jul 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

gh api repos/openshift-eng/two-node-toolbox/branches/main/protection/required_signatures \
  --jq '.enabled'

Repository: openshift-eng/two-node-toolbox

Length of output: 399


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- CONTRIBUTING.md ---'
sed -n '1,60p' CONTRIBUTING.md

printf '%s\n' '--- repository policy references ---'
rg -n -i 'signed commit|commit signing|signature|unsigned|ruleset|branch protection|protected branch' \
  -g '!CONTRIBUTING.md' -g '!*.lock' . || true

printf '%s\n' '--- public GitHub branch and ruleset metadata ---'
curl -fsSL -H 'Accept: application/vnd.github+json' \
  https://api.github.com/repos/openshift-eng/two-node-toolbox/branches/main \
  | jq '{name, protected, protection_url, required_signatures_url: ._links.self.href}'

curl -sS -D /tmp/tnt-ruleset-headers \
  -o /tmp/tnt-rulesets.json \
  -H 'Accept: application/vnd.github+json' \
  https://api.github.com/repos/openshift-eng/two-node-toolbox/rulesets
printf '%s\n' '--- rulesets response status ---'
head -n 1 /tmp/tnt-ruleset-headers
cat /tmp/tnt-rulesets.json

Repository: openshift-eng/two-node-toolbox

Length of output: 2489


🏁 Script executed:

#!/bin/bash
set -euo pipefail

curl -fsSL -H 'Accept: application/vnd.github+json' \
  https://api.github.com/repos/openshift-eng/two-node-toolbox/branches/main/protection/required_signatures \
  | jq .

Repository: openshift-eng/two-node-toolbox

Length of output: 219


🌐 Web query:

openshift-eng/two-node-toolbox main branch signed commits required signatures ruleset

💡 Result:

As of July 31, 2026, the openshift-eng/two-node-toolbox repository does not have a publicly visible GitHub ruleset enforced that mandates signed commits [1]. While commit signature verification is a common practice for security in OpenShift-related repositories, commit history in this repository shows that both signed and unsigned commits have been accepted [2][3][4][5][6]. Specifically, while many recent commits are marked as "Verified" (often associated with automated processes or contributors with configured GPG/SSH signing keys) [2][3][5][6], there is no indication from the repository's configuration that signed commits are a mandatory requirement enforced via a GitHub ruleset. You can verify the active rulesets for any public GitHub repository by navigating to the "Rulesets" tab in the repository settings (if you have appropriate permissions) or by appending /rules to the repository URL (e.g., https://github.com/openshift-eng/two-node-toolbox/rules) [7]. GitHub rulesets, when configured, can mandate signed commits for all pushes to target branches [8][9][10].

Citations:


Correct the commit-signing guidance.

The repository does not publicly enforce signed commits on main, so unsigned commits are not guaranteed to be rejected. Recommend GPG or SSH signing without claiming repository enforcement.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CONTRIBUTING.md` around lines 18 - 21, Update the commit-signing guidance in
the contributor setup steps to recommend GPG or SSH signing without stating that
the repository enforces signatures or rejects unsigned commits. Retain the link
to GitHub’s signing documentation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't fix — commit signature verification was recently enabled on this repo. The enforcement claim is accurate.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

gh api \
  repos/openshift-eng/two-node-toolbox/branches/main/protection/required_signatures \
  --jq '{enabled: .enabled}'

Length of output: 693


@fonta-rh, verification failed because the GitHub integration cannot read the branch-protection endpoint. It returned HTTP 403: Resource not accessible by integration.

Please retry with credentials that can read main branch protection, or provide the enabled setting from the repository configuration. I will leave the finding unresolved until the setting is verifiable.


✏️ Learnings added
Learnt from: fonta-rh
Repo: openshift-eng/two-node-toolbox PR: 100
File: CONTRIBUTING.md:18-21
Timestamp: 2026-07-31T16:20:25.876Z
Learning: For `openshift-eng/two-node-toolbox`, maintainer `fonta-rh` states that GitHub commit signature verification was recently enabled. Guidance in `CONTRIBUTING.md` may accurately state that unsigned commits are rejected, but reviewers must verify the current `main` branch protection setting because the policy can change.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

4. Ensure a container engine is available. All linters run in containers,
so no local tool installation is needed beyond the engine itself.
`CONTAINER_ENGINE` defaults to `podman`; override with
`CONTAINER_ENGINE=docker` if needed.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
5. Install the pre-commit hook:

```bash
make install-pre-commit
```

The hook runs `make verify` automatically on every commit, catching
lint issues before they reach CI.

## What You Can Contribute

| Type | Location | Guidance |
|------|----------|---------|
| New deployment method | `deploy/openshift-clusters/roles/` | Add an Ansible role, wire into the Makefile |
| New topology | `deploy/openshift-clusters/` | Add config template and playbook support |
| Bug fix / enhancement | Relevant component directory | Follow existing patterns in that area |
| Helper script | `helpers/` | Standalone utility for cluster operations |
| Documentation | `docs/`, component READMEs | See the [Documentation](#documentation) section |
| CI / Prow job | External: `openshift/release` repo | CI configuration lives outside this repo |

## Development Workflow

Create a branch from `main` using the appropriate naming convention:

- Features: `OCPEDGE-XXXX-short-slug`
- Bug fixes: `fix/OCPBUGS-XXXX-slug`

Run all checks before committing:

```bash
make verify
```

For targeted checks, run individual linters:

```bash
make shellcheck # Shell script linting
make yamlfmt # YAML formatting (auto-formats by default)
make ansible-lint # Ansible linting + playbook syntax check
```

`make yamlfmt` auto-formats files by default. `make verify` runs it in
validate-only mode (no modifications). `make shellcheck` is read-only.

## Code Standards

All linters run inside containers via `hack/` scripts — no local tool
installation is required beyond a container engine.

### Shell Scripts

- `#!/usr/bin/bash` shebang
- `set -euo pipefail` at the top
- Quote all variables to prevent word splitting
- UPPER_CASE for variable names
- Must pass shellcheck

### YAML

- 2-space indentation
- Quote strings containing special characters
- Must pass yamlfmt

### Ansible

- Follow existing role patterns in `deploy/openshift-clusters/roles/`
- Must pass ansible-lint (`.ansible-lint` defines the baseline)
- Do not add new entries to the `.ansible-lint` skip list — fix violations
instead
- Playbooks must pass `ansible-playbook --syntax-check` (run automatically
by `make ansible-lint`)

### Python (when applicable)

- PEP 8 compliance, must pass ruff (checked by CodeRabbit on PRs)
- Use f-strings for formatting

## Testing

- **Local:** `make verify` runs all linters (shellcheck, yamlfmt,
ansible-lint).
- **Pre-commit:** The hook runs `make verify` automatically on every commit.
- **End-to-end:** Deployment changes require testing on an actual cluster
(AWS hypervisor or Bring Your Own Server). Not everything in deployment
automation is unit-testable — integration testing against real
infrastructure is expected.
- **CI:** Prow jobs and CodeRabbit run on PRs. Both must pass before
requesting human review.

## Security

- Never hardcode credentials, tokens, or secrets in code or commits.
- Use environment variables for sensitive data (`CI_TOKEN`, pull secrets).
- Pull secrets belong in `config/pull-secret.json` (gitignored).
- Verify that logs and command output do not leak credentials before
committing.
- `.gitignore` already excludes sensitive config files — do not circumvent
it.

## Documentation

- Update relevant READMEs when changing behavior.
- Professional, terse, customer-centric style — no emojis or marketing
language.
- When adding new Make targets, update the Makefile help text.
- **CLAUDE.md maintenance:** If a change adds new paths, commands, roles,
or configuration options, update `CLAUDE.md` at the repo root.
AI-assisted contributors rely on it for accurate context. Treat it like
any other documentation — it must reflect the current state of the repo.

## Commit Conventions

- **With Jira ticket:** `OCPEDGE-XXXX: description` (primary format)
- **Without ticket:** `type: description` where type is one of: feat, fix,
docs, chore
- All commits **must be signed** (GPG or SSH). The repo has signature
verification enabled — unsigned commits are rejected.
- Keep commits focused and atomic.

## Pull Requests

- Open PRs from your fork against `main`.
- PR title follows the same convention as commit messages.
- **CodeRabbit** runs automated review on all PRs.
- **Prow** jobs run additional CI checks.
- Review is handled by teams in OWNERS: **edge-enablement** and
**team-dragonfly**.
- Address CodeRabbit feedback before requesting human review.
- Run `make verify` locally before pushing.