Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
342646a856 | ||
|
|
c43666fb4c | ||
|
|
eff82e0ffd | ||
|
|
a1c797d897 | ||
|
|
76f37ad23a | ||
|
|
b1523223d0 | ||
|
|
09db303b9b | ||
|
|
eedc21aeff | ||
|
|
f23015ff1e | ||
|
|
b4a6aa0d4c | ||
|
|
a347ddd68b | ||
|
|
f6e04f7a58 | ||
|
|
5580d51cf7 | ||
|
|
eb9de5db69 | ||
|
|
3f5dd9a746 | ||
|
|
65787b7dd2 | ||
|
|
4f07167e26 | ||
|
|
84a0e345b9 | ||
|
|
a1ef2a419f | ||
|
|
99a776ee2a | ||
|
|
5b167ca8f8 | ||
|
|
43247349d7 | ||
|
|
4486188522 | ||
|
|
1232a17f36 | ||
|
|
1f2e730512 | ||
|
|
2b59dac369 | ||
|
|
22fa420c52 | ||
|
|
f337e2ff51 | ||
|
|
9d1a70e433 | ||
|
|
145c99e2f8 | ||
|
|
8792d74fb0 | ||
|
|
5b5df41faa | ||
|
|
59c80f756a | ||
|
|
187d0df5c7 | ||
|
|
aa5cab7390 | ||
|
|
f2d8a9927a | ||
|
|
8820a7af82 | ||
|
|
8adb9e65f7 | ||
|
|
492af48c0d | ||
|
|
ae26b2288a | ||
|
|
f122b4a470 | ||
|
|
ea30ebdb2f | ||
|
|
06a3d113bd | ||
|
|
b0dc7e1eea | ||
|
|
0bbd09cdca | ||
|
|
9af91511aa | ||
|
|
7e3b967bb2 | ||
|
|
629ec15a2e | ||
|
|
f10f63fe27 | ||
|
|
c0365111f5 | ||
|
|
002b82d1f1 | ||
|
|
9751567138 |
No files matched your search
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"mcp__github__get_pull_request",
|
||||
"Bash(gh release view:*)",
|
||||
"Bash(gh release list:*)",
|
||||
"Bash(gh api:*)",
|
||||
"Bash(gh release:*)",
|
||||
"mcp__github__get_file_contents",
|
||||
"Bash(git add:*)",
|
||||
"Bash(git commit:*)",
|
||||
"Bash(git checkout:*)",
|
||||
"Bash(git merge:*)",
|
||||
"Bash(git push:*)",
|
||||
"mcp__circleci-mcp-server__get_build_failure_logs",
|
||||
"mcp__circleci-mcp-server__get_latest_pipeline_status",
|
||||
"WebFetch(domain:app.circleci.com)",
|
||||
"mcp__circleci-mcp-server__get_job_test_results",
|
||||
"Bash(curl:*)",
|
||||
"Bash(make validate:*)",
|
||||
"Bash(circleci orb publish:*)",
|
||||
"Bash(git reset:*)",
|
||||
"Bash(git pull:*)",
|
||||
"Bash(git fetch:*)"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
# GitHub Release Configuration
|
||||
# Auto-generates release notes from PR labels
|
||||
|
||||
changelog:
|
||||
exclude:
|
||||
labels:
|
||||
- ignore-for-release
|
||||
- duplicate
|
||||
- invalid
|
||||
authors:
|
||||
- dependabot
|
||||
- dependabot[bot]
|
||||
categories:
|
||||
- title: Breaking Changes
|
||||
labels:
|
||||
- breaking-change
|
||||
- breaking
|
||||
- title: New Features
|
||||
labels:
|
||||
- enhancement
|
||||
- feature
|
||||
- title: Bug Fixes
|
||||
labels:
|
||||
- bug
|
||||
- fix
|
||||
- title: Dependencies
|
||||
labels:
|
||||
- dependencies
|
||||
- title: Other Changes
|
||||
labels:
|
||||
- "*"
|
||||
@@ -2,3 +2,9 @@
|
||||
orb.yml
|
||||
.DS_Store
|
||||
target
|
||||
|
||||
# Test data directory (created dynamically during tests)
|
||||
tests/test_data
|
||||
|
||||
# IDE
|
||||
.idea
|
||||
Generated
-120
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="39f8d35a-1bb7-489b-b59c-b0ba3ffefe23" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/calculate-version.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/calculate-version.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/check_middleware_api_versions.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/check_middleware_api_versions.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/create_github_release.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/create_github_release.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/manage_version_calculate.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/manage_version_calculate.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/manage_version_commit.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/manage_version_commit.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/manage_version_git_config.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/manage_version_git_config.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/mvn_build_compile.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/mvn_build_compile.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/mvn_jar_deploy_deploy.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/mvn_jar_deploy_deploy.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/mvn_jar_deploy_gpg_setup.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/mvn_jar_deploy_gpg_setup.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/mvn_verify_save_test_results.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/mvn_verify_save_test_results.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/mvn_verify_verify.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/mvn_verify_verify.sh" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="GitHubPullRequestSearchHistory">{
|
||||
"lastFilter": {
|
||||
"state": "OPEN",
|
||||
"assignee": "KofTwentyTwo"
|
||||
}
|
||||
}</component>
|
||||
<component name="GithubPullRequestsUISettings">{
|
||||
"selectedUrlAndAccountId": {
|
||||
"url": "git@github.com:Kingsrook/qqq-orb.git",
|
||||
"accountId": "7a0b7646-5b0c-4647-976d-932a62661dd2"
|
||||
}
|
||||
}</component>
|
||||
<component name="MacroExpansionManager">
|
||||
<option name="directoryName" value="Qi1Hqxgr" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 5
|
||||
}</component>
|
||||
<component name="ProjectId" id="32YtZdjn4FeSrJsD5VMG3tLBHKD" />
|
||||
<component name="ProjectLevelVcsManager">
|
||||
<ConfirmationsSetting value="2" id="Add" />
|
||||
</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="autoscrollFromSource" value="true" />
|
||||
<option name="showExcludedFiles" value="false" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.go.formatter.settings.were.checked": "true",
|
||||
"RunOnceActivity.go.migrated.go.modules.settings": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"git-widget-placeholder": "develop",
|
||||
"go.import.settings.migrated": "true",
|
||||
"io.aesy.yamllint.do.not.ask.to.enable": "true",
|
||||
"last_opened_file_path": "/Users/james.maes/Git.Local/Kingsrook/qqq-orb/src/jobs",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon": "",
|
||||
"org.rust.first.attach.projects": "true",
|
||||
"settings.editor.selected.configurable": "preferences.sourceCode.yaml"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"stardust.markdown.MarkdownSplitEditorSuppressor:keyList": []
|
||||
}
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src/jobs" />
|
||||
<recent name="$PROJECT_DIR$/src/commands" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RustProjectSettings">
|
||||
<option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" />
|
||||
</component>
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
<option value="bundled-jdk-9823dce3aa75-bf35d07a577b-intellij.indexing.shared.core-IU-252.25557.131" />
|
||||
<option value="bundled-js-predefined-d6986cc7102b-b598e85cdad2-JavaScript-IU-252.25557.131" />
|
||||
</set>
|
||||
</attachedChunks>
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="39f8d35a-1bb7-489b-b59c-b0ba3ffefe23" name="Changes" comment="" />
|
||||
<created>1757609391348</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1757609391348</updated>
|
||||
<workItem from="1757609392578" duration="5983000" />
|
||||
<workItem from="1757633227531" duration="300000" />
|
||||
<workItem from="1757633543711" duration="945000" />
|
||||
<workItem from="1757634532876" duration="26000" />
|
||||
<workItem from="1757634568948" duration="111000" />
|
||||
<workItem from="1757634683262" duration="86000" />
|
||||
<workItem from="1757634778652" duration="275000" />
|
||||
<workItem from="1757635061044" duration="63000" />
|
||||
<workItem from="1757721395861" duration="3728000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="VgoProject">
|
||||
<settings-migrated>true</settings-migrated>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,8 @@
|
||||
repos:
|
||||
- hooks:
|
||||
- id: commitizen
|
||||
- id: commitizen-branch
|
||||
stages:
|
||||
- pre-push
|
||||
repo: https://github.com/commitizen-tools/commitizen
|
||||
rev: v4.9.1
|
||||
+89
-19
@@ -5,9 +5,30 @@ All notable changes to QQQ Orb will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
## [0.4.0] - 2025-12-28
|
||||
|
||||
### Added
|
||||
- Java 21 support with configurable executor - New `java` executor using `cimg/openjdk` with version parameter (default: 21.0)
|
||||
- Automatic GitHub release creation for releases and release candidates
|
||||
- RC support for GitHub releases (published as pre-releases)
|
||||
|
||||
### Changed
|
||||
- License changed to AGPL-3.0 with QRun-IO copyright
|
||||
- Maven jobs now use the new `java` executor (resource_class: large)
|
||||
- Node jobs use `default` executor with configurable version
|
||||
|
||||
### Fixed
|
||||
- Version calculation now uses `CIRCLE_BRANCH` environment variable before falling back to git ref parsing
|
||||
- Frontend build cache steps separated by key for proper cache isolation
|
||||
- npm module cache now properly saved in frontend builds
|
||||
|
||||
### Migration
|
||||
Projects needing Java 17 can explicitly set `java_version: "17.0"` in their workflow config.
|
||||
|
||||
## [0.3.8] - 2025-09-29
|
||||
|
||||
### Added
|
||||
- Support for publishing snapshots for feature branches
|
||||
- Comprehensive README with detailed usage examples
|
||||
- CONTRIBUTING.md with development guidelines
|
||||
- SECURITY.md with security policy and reporting procedures
|
||||
@@ -17,40 +38,89 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Updated README to follow QQQ framework standards
|
||||
- Enhanced documentation structure and organization
|
||||
|
||||
## [2.1] - 2024-01-XX
|
||||
## [0.3.7] - 2025-09-18
|
||||
|
||||
### Added
|
||||
- Multi-platform support for Maven and Node.js projects
|
||||
- GitFlow integration with automated version management
|
||||
- Comprehensive testing framework with coverage reporting
|
||||
- Automated publishing to Maven Central and npm registries
|
||||
- Shell script automation and utilities
|
||||
- Documentation generation and publishing
|
||||
- Comprehensive README with current functionality and testing framework documentation
|
||||
|
||||
### Changed
|
||||
- Improved orb structure and organization
|
||||
- Enhanced error handling and validation
|
||||
- Updated dependencies and security patches
|
||||
- Enhanced documentation structure and organization
|
||||
|
||||
## [0.3.6] - 2025-09-16
|
||||
|
||||
### Fixed
|
||||
- Various bug fixes and stability improvements
|
||||
- Updated handling for tagged releases in main branch to properly promote to latest tag
|
||||
- Fixed git commit operations on main branch for production releases
|
||||
|
||||
## [2.0] - 2023-XX-XX
|
||||
## [0.3.5] - 2025-09-16
|
||||
|
||||
### Fixed
|
||||
- Updated git commit on main branch to work correctly for tag releases in production releases
|
||||
|
||||
## [0.3.4] - 2025-09-15
|
||||
|
||||
### Fixed
|
||||
- Removed conditionals around git operations after version checks for main and hotfix branches
|
||||
- Updated standard GitHub documentation to point to top-level project documentation
|
||||
|
||||
## [0.3.3] - 2025-09-15
|
||||
|
||||
### Added
|
||||
- Made publish_asciidoc a parameterized run option
|
||||
|
||||
### Changed
|
||||
- Enhanced parameterization for better flexibility
|
||||
|
||||
## [0.3.2] - 2025-09-15
|
||||
|
||||
### Added
|
||||
- Base level repository files and updated README
|
||||
|
||||
### Changed
|
||||
- Updated check_middleware_api_versions to run based on parameter configuration
|
||||
|
||||
## [0.3.1] - 2025-09-15
|
||||
|
||||
### Fixed
|
||||
- Version bump corrections
|
||||
- Fixed bad sync RC update
|
||||
- Updated example version references
|
||||
|
||||
## [0.3.0] - 2025-09-15
|
||||
|
||||
### Added
|
||||
- Support for pure Node.js projects
|
||||
- Support for building integrated frontend (npm) within Maven projects
|
||||
- Support for publishing snapshots and tags
|
||||
- Enhanced feature branch versioning with dynamic commit hash updates
|
||||
- Comprehensive test suite and improved linting for calculate_version.sh
|
||||
|
||||
### Changed
|
||||
- Reverted to only handle POM files (npm handled within its own job)
|
||||
- Adjusted default execution state for scripts
|
||||
- Converted longer commands to scripts per organization linting standards
|
||||
- Refactored calculate_version.sh for cleaner branch level code
|
||||
|
||||
### Fixed
|
||||
- Multiple linting fixes from CircleCI integration
|
||||
- Improved error handling and validation
|
||||
|
||||
## [0.2.0] - 2025-09-15
|
||||
|
||||
### Added
|
||||
- Initial CircleCI orb implementation
|
||||
- Basic Maven project support
|
||||
- Core CI/CD workflows
|
||||
- Initial documentation for orb
|
||||
|
||||
### Changed
|
||||
- Migrated from custom CI/CD to CircleCI orbs
|
||||
- Updated CircleCI to use new QQQ orb for workflows
|
||||
|
||||
## [1.x] - 2022-XX-XX
|
||||
|
||||
### Added
|
||||
- Legacy CI/CD implementation
|
||||
- Basic automation scripts
|
||||
### Fixed
|
||||
- Implemented initial linting fixes from CircleCI
|
||||
- Initial import of scripts and jobs from QQQ base repository
|
||||
|
||||
---
|
||||
|
||||
**Note**: For detailed release information and breaking changes, see the [QQQ Wiki](https://github.com/Kingsrook/qqq/wiki).
|
||||
**Note**: For detailed release information and breaking changes, see the [QQQ Wiki](https://github.com/Kingsrook/qqq/wiki).
|
||||
@@ -0,0 +1,82 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
CircleCI orb for QQQ framework projects. Provides pre-built jobs for building, testing, and publishing Maven and Node.js projects using GitFlow branching strategy.
|
||||
|
||||
## Build Commands
|
||||
|
||||
```bash
|
||||
make pack # Pack orb to target/qqq-orb-packed.yml
|
||||
make validate # Pack and validate orb
|
||||
make test # Pack and validate (alias for validate)
|
||||
make test-scripts # Run calculate_version.sh test suite
|
||||
make test-all # Run all tests (orb + scripts)
|
||||
make lint # Run yamllint, shellcheck, and CircleCI validation
|
||||
make dev # Development workflow: pack, validate, show status
|
||||
make clean # Remove target/ and tests/test_data/
|
||||
make publish-snapshot # Publish to kingsrook/qqq-orb@dev:snapshot
|
||||
make publish-release # Interactive production release with git tagging
|
||||
```
|
||||
|
||||
## Running Individual Tests
|
||||
|
||||
```bash
|
||||
./tests/run_tests.sh # Standard test run
|
||||
./tests/run_tests.sh --verbose # Verbose output
|
||||
./tests/run_tests.sh --ci # CI mode (minimal output)
|
||||
./tests/test_calculate_version.sh # Direct test suite execution
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
### Directory Structure
|
||||
|
||||
- `src/@orb.yml` - Main orb definition entry point
|
||||
- `src/commands/` - Reusable orb commands (YAML files that include scripts)
|
||||
- `src/jobs/` - Complete job definitions combining commands
|
||||
- `src/executors/` - Docker executor definitions (java.yml, default.yml)
|
||||
- `src/scripts/` - Bash scripts included in commands
|
||||
- `tests/` - Test suite for calculate_version.sh
|
||||
|
||||
### Key Components
|
||||
|
||||
**Executors:**
|
||||
- `java` - cimg/openjdk image with configurable version (17.0, 21.0), resource_class: large
|
||||
- `default` - cimg/node image for Node.js projects
|
||||
|
||||
**Jobs:**
|
||||
- `mvn_publish` - Full publish workflow (build, version, test, deploy, git ops, GitHub release)
|
||||
- `mvn_test_only` - Build and test for feature branches
|
||||
- `mvn_frontend_publish` / `mvn_frontend_test_only` - Same with frontend support
|
||||
- `node_publish` / `node_test_only` - Pure Node.js workflows
|
||||
|
||||
**Version Calculation:**
|
||||
The core logic is in `src/scripts/calculate_version.sh`. It determines version based on branch type:
|
||||
- `develop` -> `X.Y.Z-SNAPSHOT`
|
||||
- `release/*` -> `X.Y.Z-RC.N`
|
||||
- `main` (tagged) -> `X.Y.Z`
|
||||
- `hotfix/*` -> Patch version bump
|
||||
- `feature/*` -> `X.Y.Z-feature-{name}-{hash}-SNAPSHOT`
|
||||
|
||||
### Orb Packing
|
||||
|
||||
The orb uses CircleCI's "unpacked" format. YAML files in `src/` are packed into a single `target/qqq-orb-packed.yml`. Commands reference scripts via `<<include(scripts/scriptname.sh)>>` syntax.
|
||||
|
||||
### CI Pipeline
|
||||
|
||||
`.circleci/config.yml` runs lint/pack/review/shellcheck, then continues to `.circleci/test-deploy.yml` which runs command tests and publishes on release tags (`v*.*.*`).
|
||||
|
||||
## Linting Requirements
|
||||
|
||||
- YAML: yamllint for commands/jobs/examples
|
||||
- Shell: shellcheck for all .sh files in src/scripts/ and tests/
|
||||
- Orb: `circleci orb validate` for orb syntax
|
||||
|
||||
## Required Context Variables for Publishing
|
||||
|
||||
- `MAVEN_USERNAME`, `MAVEN_PASSWORD` - Sonatype credentials
|
||||
- `GPG_PRIVATE_KEY_B64`, `GPG_KEYNAME`, `GPG_PASSPHRASE` - GPG signing
|
||||
- `GITHUB_TOKEN` - GitHub API access
|
||||
+2
-84
@@ -1,86 +1,4 @@
|
||||
# Code of Conduct
|
||||
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our community include:
|
||||
|
||||
- **Being respectful and inclusive** of differing viewpoints and experiences
|
||||
- **Accepting constructive criticism** gracefully
|
||||
- **Focusing on what is best** for the community
|
||||
- **Showing empathy** towards other community members
|
||||
- **Being collaborative** and helping others learn and grow
|
||||
- **Using welcoming and inclusive language** in all interactions
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
- **Harassment** in any form, including sexual harassment
|
||||
- **Trolling, insulting, or derogatory comments** and personal or political attacks
|
||||
- **Public or private harassment** of any kind
|
||||
- **Publishing others' private information** without explicit permission
|
||||
- **Conduct that could reasonably be considered inappropriate** in a professional setting
|
||||
- **Dismissing or attacking inclusion-oriented requests** or concerns
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at **conduct@kingsrook.com**. All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
**Community Impact**: A violation through a single incident or series of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are available at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).
|
||||
|
||||
## Contact Information
|
||||
|
||||
- **Code of Conduct Issues**: conduct@kingsrook.com
|
||||
- **General Contact**: contact@kingsrook.com
|
||||
- **Company**: Kingsrook, LLC
|
||||
- **Website**: https://qrun.io
|
||||
|
||||
---
|
||||
|
||||
**Thank you for helping create a welcoming and inclusive community!** 🌟
|
||||
See Project level [Code of Conduct](https://github.com/Kingsrook/qqq/blob/develop/CODE_OF_CONDUCT.md)
|
||||
+2
-306
@@ -1,307 +1,3 @@
|
||||
# Code Style Guide
|
||||
|
||||
This document outlines the coding standards and style guidelines for QQQ Orb development.
|
||||
|
||||
## 🎯 Overview
|
||||
|
||||
QQQ Orb follows consistent coding standards to ensure maintainability, readability, and reliability across all components.
|
||||
|
||||
## 📁 File Organization
|
||||
|
||||
### Directory Structure
|
||||
|
||||
```
|
||||
src/
|
||||
├── @orb.yml # Main orb definition
|
||||
├── commands/ # Reusable commands
|
||||
├── jobs/ # Complete workflow jobs
|
||||
├── scripts/ # Shell scripts
|
||||
├── executors/ # Execution environments
|
||||
└── examples/ # Usage examples
|
||||
```
|
||||
|
||||
### Naming Conventions
|
||||
|
||||
- **Files**: Use lowercase with underscores (`mvn_build.yml`)
|
||||
- **Directories**: Use lowercase with underscores (`commands/`)
|
||||
- **Variables**: Use uppercase with underscores (`MAVEN_USERNAME`)
|
||||
- **Functions**: Use lowercase with underscores (`calculate_version`)
|
||||
|
||||
## 🔧 YAML Configuration
|
||||
|
||||
### General Guidelines
|
||||
|
||||
- **Indentation**: Use 2 spaces (no tabs)
|
||||
- **Line Length**: Maximum 120 characters
|
||||
- **Quotes**: Use single quotes for strings when possible
|
||||
- **Comments**: Use `#` for comments, explain complex logic
|
||||
|
||||
### Orb Definition Structure
|
||||
|
||||
```yaml
|
||||
# @orb.yml
|
||||
version: 2.1
|
||||
|
||||
description: >
|
||||
Brief description of the orb's purpose.
|
||||
|
||||
display:
|
||||
home_url: "https://www.qrun.io"
|
||||
source_url: "https://github.com/Kingsrook/qqq-orb"
|
||||
|
||||
orbs:
|
||||
dependency-orb: circleci/dependency@1.0.0
|
||||
```
|
||||
|
||||
### Command Structure
|
||||
|
||||
```yaml
|
||||
# commands/example_command.yml
|
||||
description: "Brief description of what this command does"
|
||||
|
||||
parameters:
|
||||
param1:
|
||||
type: string
|
||||
default: "default_value"
|
||||
description: "Parameter description"
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: "Step Name"
|
||||
command: |
|
||||
echo "Command content"
|
||||
# Additional commands
|
||||
```
|
||||
|
||||
### Job Structure
|
||||
|
||||
```yaml
|
||||
# jobs/example_job.yml
|
||||
description: "Brief description of what this job does"
|
||||
|
||||
executor: default
|
||||
|
||||
parameters:
|
||||
param1:
|
||||
type: string
|
||||
default: "default_value"
|
||||
description: "Parameter description"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- qqq-orb/example-command:
|
||||
param1: << parameters.param1 >>
|
||||
```
|
||||
|
||||
## 🐚 Shell Scripts
|
||||
|
||||
### General Guidelines
|
||||
|
||||
- **Shebang**: Always use `#!/bin/bash`
|
||||
- **Error Handling**: Use `set -euo pipefail`
|
||||
- **Variables**: Use `readonly` for constants
|
||||
- **Functions**: Use descriptive names and document parameters
|
||||
|
||||
### Script Template
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Script description
|
||||
# Usage: script_name [options] [arguments]
|
||||
|
||||
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly SCRIPT_NAME="$(basename "$0")"
|
||||
|
||||
# Function documentation
|
||||
# Parameters: $1 - description, $2 - description
|
||||
function example_function() {
|
||||
local param1="$1"
|
||||
local param2="$2"
|
||||
|
||||
# Function implementation
|
||||
echo "Processing: $param1, $param2"
|
||||
}
|
||||
|
||||
# Main execution
|
||||
main() {
|
||||
# Main logic here
|
||||
example_function "value1" "value2"
|
||||
}
|
||||
|
||||
# Run main function if script is executed directly
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
main "$@"
|
||||
fi
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
|
||||
```bash
|
||||
# Check if command exists
|
||||
if ! command -v mvn &> /dev/null; then
|
||||
echo "Error: Maven is not installed" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if file exists
|
||||
if [[ ! -f "pom.xml" ]]; then
|
||||
echo "Error: pom.xml not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Handle command failures
|
||||
if ! mvn clean compile; then
|
||||
echo "Error: Maven compilation failed" >&2
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
## 📝 Documentation
|
||||
|
||||
### README Structure
|
||||
|
||||
- **Title**: Clear, descriptive title
|
||||
- **Badges**: Status badges for version, license, etc.
|
||||
- **Overview**: Brief description of purpose
|
||||
- **Quick Start**: Getting started instructions
|
||||
- **Usage**: Detailed usage examples
|
||||
- **Development**: Development setup and guidelines
|
||||
- **Contributing**: Contribution guidelines
|
||||
- **License**: License information
|
||||
|
||||
### Inline Documentation
|
||||
|
||||
```yaml
|
||||
# commands/mvn_build.yml
|
||||
description: >
|
||||
Builds a Maven project with specified goals.
|
||||
Supports multi-module projects and custom settings.
|
||||
|
||||
parameters:
|
||||
goals:
|
||||
type: string
|
||||
default: "clean compile"
|
||||
description: >
|
||||
Maven goals to execute.
|
||||
Common values: clean, compile, test, package, install
|
||||
```
|
||||
|
||||
### Shell Script Documentation
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# Script: calculate_version.sh
|
||||
# Description: Calculates semantic version based on GitFlow branch
|
||||
# Usage: calculate_version.sh [branch_name]
|
||||
# Parameters:
|
||||
# branch_name - Git branch name (optional, defaults to current branch)
|
||||
# Returns: Semantic version string
|
||||
```
|
||||
|
||||
## 🧪 Testing Standards
|
||||
|
||||
### Test Structure
|
||||
|
||||
- **Unit Tests**: Test individual functions and commands
|
||||
- **Integration Tests**: Test complete workflows
|
||||
- **Validation Tests**: Test orb configuration and packing
|
||||
|
||||
### Test Naming
|
||||
|
||||
- **Test Files**: `test_<component>.yml`
|
||||
- **Test Functions**: `test_<function_name>`
|
||||
- **Test Descriptions**: Clear, descriptive test names
|
||||
|
||||
### Coverage Requirements
|
||||
|
||||
- **Commands**: All parameters and error conditions
|
||||
- **Jobs**: All workflow paths and error handling
|
||||
- **Scripts**: All functions and error conditions
|
||||
|
||||
## 🔍 Code Review Standards
|
||||
|
||||
### Review Checklist
|
||||
|
||||
- [ ] **Functionality**: Code works as intended
|
||||
- [ ] **Style**: Follows project style guidelines
|
||||
- [ ] **Documentation**: Adequate documentation and comments
|
||||
- [ ] **Testing**: Appropriate test coverage
|
||||
- [ ] **Security**: No security vulnerabilities
|
||||
- [ ] **Performance**: Efficient implementation
|
||||
- [ ] **Maintainability**: Code is maintainable and readable
|
||||
|
||||
### Review Process
|
||||
|
||||
1. **Self Review**: Author reviews their own code first
|
||||
2. **Peer Review**: At least one peer review required
|
||||
3. **Testing**: All tests must pass
|
||||
4. **Documentation**: Documentation updated as needed
|
||||
5. **Approval**: Required approvals before merge
|
||||
|
||||
## 🛠️ Development Tools
|
||||
|
||||
### Required Tools
|
||||
|
||||
- **CircleCI CLI**: For orb development and validation
|
||||
- **ShellCheck**: For shell script linting
|
||||
- **yamllint**: For YAML linting
|
||||
- **Git**: For version control
|
||||
|
||||
### IDE Configuration
|
||||
|
||||
#### VS Code
|
||||
|
||||
```json
|
||||
{
|
||||
"editor.tabSize": 2,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.rulers": [120],
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"files.insertFinalNewline": true,
|
||||
"yaml.schemas": {
|
||||
"https://json.schemastore.org/circle-ci-config.json": ".circleci/config.yml"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### IntelliJ IDEA
|
||||
|
||||
- **Code Style**: Use project code style settings
|
||||
- **File Templates**: Use project file templates
|
||||
- **Inspections**: Enable all relevant inspections
|
||||
|
||||
## 📋 Best Practices
|
||||
|
||||
### General Principles
|
||||
|
||||
- **DRY**: Don't Repeat Yourself
|
||||
- **KISS**: Keep It Simple, Stupid
|
||||
- **YAGNI**: You Aren't Gonna Need It
|
||||
- **SOLID**: Follow SOLID principles where applicable
|
||||
|
||||
### Security Considerations
|
||||
|
||||
- **Secrets**: Never commit secrets or credentials
|
||||
- **Input Validation**: Validate all inputs
|
||||
- **Error Handling**: Don't expose sensitive information in errors
|
||||
- **Dependencies**: Keep dependencies up to date
|
||||
|
||||
### Performance Considerations
|
||||
|
||||
- **Efficiency**: Use efficient algorithms and data structures
|
||||
- **Caching**: Cache expensive operations when appropriate
|
||||
- **Parallelization**: Use parallel execution where beneficial
|
||||
- **Resource Usage**: Minimize resource consumption
|
||||
|
||||
## 🔗 Resources
|
||||
|
||||
- **CircleCI Orb Development**: https://circleci.com/docs/2.0/orb-author-intro/
|
||||
- **Shell Script Best Practices**: https://google.github.io/styleguide/shellguide.html
|
||||
- **YAML Best Practices**: https://yaml.org/spec/1.2/spec.html
|
||||
- **GitFlow Workflow**: https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow
|
||||
|
||||
---
|
||||
|
||||
**Remember**: Consistent code style improves maintainability and reduces bugs. When in doubt, follow existing patterns in the codebase.
|
||||
|
||||
* See Project [Code Style Guide](https://github.com/Kingsrook/qqq/blob/develop/CODE_STYLE.md)
|
||||
+2
-134
@@ -1,136 +1,4 @@
|
||||
# Contributing to QQQ Orb
|
||||
# Contributing to QBit User Role Permissions
|
||||
|
||||
First off, thanks for taking the time to contribute! ❤️
|
||||
* See Project [Contributing](https://github.com/Kingsrook/qqq/blob/develop/CONTRIBUTING.md)
|
||||
|
||||
QQQ Orb is **open source** and welcomes contributions from the community. This document provides a quick overview - for detailed guides, see our [Complete Documentation Wiki](https://github.com/Kingsrook/qqq/wiki).
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
**New to QQQ?** Start with our [Developer Onboarding Guide](https://github.com/Kingsrook/qqq/wiki/Developer-Onboarding) to get your environment set up.
|
||||
|
||||
## 📚 Documentation & Guides
|
||||
|
||||
All detailed information is in our [Wiki](https://github.com/Kingsrook/qqq/wiki):
|
||||
|
||||
- **[🏠 Home](https://github.com/Kingsrook/qqq/wiki/Home)** - Project overview
|
||||
- **[🔧 Development](https://github.com/Kingsrook/qqq/wiki/Developer-Onboarding)** - Complete setup guide
|
||||
- **[📝 Contribution Process](https://github.com/Kingsrook/qqq/wiki/Contribution-Guidelines)** - Detailed contribution workflow
|
||||
- **[🔍 Code Standards](https://github.com/Kingsrook/qqq/wiki/Code-Review-Standards)** - Coding standards and review process
|
||||
- **[🧪 Testing](https://github.com/Kingsrook/qqq/wiki/Testing)** - Testing strategy and requirements
|
||||
- **[🏗️ Architecture](https://github.com/Kingsrook/qqq/wiki/High-Level-Architecture)** - System design and principles
|
||||
|
||||
## 🤝 How to Contribute
|
||||
|
||||
### **1. Report Issues**
|
||||
Found a bug or have a feature request? [Create an issue](https://github.com/Kingsrook/qqq/issues).
|
||||
|
||||
### **2. Code Contributions**
|
||||
Want to contribute code? Follow our [Contribution Guidelines](https://github.com/Kingsrook/qqq/wiki/Contribution-Guidelines).
|
||||
|
||||
**Key Requirements:**
|
||||
- CircleCI CLI and orb development tools
|
||||
- Follow QQQ's [Code Review Standards](https://github.com/Kingsrook/qqq/wiki/Code-Review-Standards)
|
||||
- Meet testing coverage requirements
|
||||
- Use conventional commit messages
|
||||
- Validate orb configuration with `make lint`
|
||||
|
||||
### **3. Documentation**
|
||||
Improve our docs by updating the [Wiki](https://github.com/Kingsrook/qqq/wiki) or suggesting improvements via issues.
|
||||
|
||||
## 🔧 Development Setup
|
||||
|
||||
**Prerequisites:**
|
||||
- **macOS** (QQQ dev tools are macOS-optimized)
|
||||
- **CircleCI CLI** for orb development
|
||||
- **ShellCheck** and **yamllint** for linting
|
||||
- **Git** with SSH access
|
||||
|
||||
**Quick Setup:**
|
||||
```bash
|
||||
# Install CircleCI CLI
|
||||
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | sudo bash
|
||||
|
||||
# Install linting tools (macOS)
|
||||
brew install shellcheck yamllint
|
||||
|
||||
# Clone the repository
|
||||
git clone git@github.com:Kingsrook/qqq.git
|
||||
cd qqq/qqq-orb
|
||||
|
||||
# Run development workflow
|
||||
make dev
|
||||
```
|
||||
|
||||
For complete setup instructions, see [Developer Onboarding](https://github.com/Kingsrook/qqq/wiki/Developer-Onboarding).
|
||||
|
||||
## 📋 Contribution Checklist
|
||||
|
||||
Before submitting your contribution:
|
||||
|
||||
- [ ] **Environment**: Development environment properly set up
|
||||
- [ ] **Code Style**: Follows QQQ's [Code Review Standards](https://github.com/Kingsrook/qqq/wiki/Code-Review-Standards)
|
||||
- [ ] **Testing**: All tests pass with `make test`
|
||||
- [ ] **Linting**: All linting checks pass with `make lint`
|
||||
- [ ] **Documentation**: Updated relevant wiki pages
|
||||
- [ ] **Commit Messages**: Follow conventional commit format
|
||||
- [ ] **Orb Validation**: Orb packs and validates successfully
|
||||
|
||||
## 🧪 Testing
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
make test
|
||||
|
||||
# Run linting checks
|
||||
make lint
|
||||
|
||||
# Validate orb configuration
|
||||
make validate
|
||||
|
||||
# Development workflow
|
||||
make dev
|
||||
```
|
||||
|
||||
### Test Coverage
|
||||
|
||||
The orb includes comprehensive testing:
|
||||
- **YAML Validation**: CircleCI orb configuration validation
|
||||
- **Shell Script Testing**: ShellCheck for shell script validation
|
||||
- **Orb Packing**: Tests orb packing and resolution
|
||||
- **Integration Testing**: End-to-end workflow testing
|
||||
|
||||
## 📦 Publishing
|
||||
|
||||
### Development Publishing
|
||||
|
||||
```bash
|
||||
# Publish snapshot for testing
|
||||
make publish-snapshot
|
||||
```
|
||||
|
||||
### Production Publishing
|
||||
|
||||
```bash
|
||||
# Publish production release
|
||||
make publish-release
|
||||
```
|
||||
|
||||
## 🆘 Getting Help
|
||||
|
||||
- **📖 [Wiki](https://github.com/Kingsrook/qqq/wiki)**: Start here for comprehensive guides
|
||||
- **🐛 [Issues](https://github.com/Kingsrook/qqq/issues)**: Search existing issues or create new ones
|
||||
- **💬 [Discussions](https://github.com/Kingsrook/qqq/discussions)**: Ask questions and get help
|
||||
|
||||
## 📄 Legal Notice
|
||||
|
||||
When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content, and that the content you contribute may be provided under the project license.
|
||||
|
||||
## 🏢 About Kingsrook
|
||||
|
||||
QQQ Orb is built by **[Kingsrook](https://qrun.io)** - making engineers more productive through intelligent automation and developer tools.
|
||||
|
||||
---
|
||||
|
||||
**Ready to contribute?** [Start with our Developer Onboarding Guide](https://github.com/Kingsrook/qqq/wiki/Developer-Onboarding)!
|
||||
@@ -1,21 +1,680 @@
|
||||
MIT License
|
||||
QQQ - Low-code Application Framework for Engineers
|
||||
Copyright (C) 2021-2025 QRun-IO, LLC
|
||||
https://www.qrun.io | https://github.com/QRun-IO
|
||||
|
||||
Copyright (c) 2021-2024 Kingsrook, LLC
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
@@ -1,7 +1,7 @@
|
||||
# QQQ Orb Development Makefile
|
||||
# Provides convenient commands for orb development, validation, and publishing
|
||||
|
||||
.PHONY: help pack validate clean test publish-snapshot publish-release dev check-clean check-branch
|
||||
.PHONY: help pack validate clean test test-scripts test-all publish-snapshot publish-release dev check-clean check-branch
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@@ -10,6 +10,8 @@ help:
|
||||
@echo " make pack - Pack the orb using 'orb pack' (recommended for orb development)"
|
||||
@echo " make validate - Validate the packed orb"
|
||||
@echo " make test - Pack and validate the orb"
|
||||
@echo " make test-scripts - Run comprehensive tests for calculate_version.sh"
|
||||
@echo " make test-all - Run all tests (orb + scripts)"
|
||||
@echo " make clean - Remove packed orb files"
|
||||
@echo " make dev - Development workflow: pack, validate, and show status"
|
||||
@echo " make lint - Run all CircleCI-style linting checks"
|
||||
@@ -17,7 +19,7 @@ help:
|
||||
@echo " make publish-release - Interactive production release (tagged version)"
|
||||
@echo ""
|
||||
@echo "Key Files:"
|
||||
@echo " src/@orb.yml - Main orb definition"
|
||||
@echo " src/@orb.yml - Main orb definition"
|
||||
@echo " target/qqq-orb-packed.yml - Packed orb (generated)"
|
||||
|
||||
# Pack the orb using the correct command for orb development
|
||||
@@ -37,10 +39,22 @@ validate: pack
|
||||
test: validate
|
||||
@echo "✅ All tests passed!"
|
||||
|
||||
# Test scripts: run comprehensive tests for calculate_version.sh
|
||||
test-scripts:
|
||||
@echo "🧪 Running calculate_version.sh test suite..."
|
||||
@./tests/run_tests.sh --ci
|
||||
@echo "✅ Script tests passed!"
|
||||
|
||||
# Test all: run both orb tests and script tests
|
||||
test-all: test test-scripts
|
||||
@echo "🎉 All tests completed successfully!"
|
||||
|
||||
# Clean up generated files
|
||||
clean:
|
||||
@echo "Cleaning up packed orb files..."
|
||||
@rm -rf target
|
||||
@echo "Cleaning up test data..."
|
||||
@rm -rf tests/test_data
|
||||
@echo "✅ Cleanup complete"
|
||||
|
||||
# Lint source files (same checks as CircleCI)
|
||||
@@ -53,13 +67,17 @@ lint:
|
||||
@echo ""
|
||||
@echo "2. Shell Script Linting (ShellCheck)..."
|
||||
@shellcheck src/scripts/*.sh
|
||||
@echo "✅ ShellCheck passed"
|
||||
@echo "✅ Source script ShellCheck passed"
|
||||
@echo ""
|
||||
@echo "3. CircleCI Orb Linting..."
|
||||
@echo "3. Test Script Linting (ShellCheck)..."
|
||||
@shellcheck tests/*.sh
|
||||
@echo "✅ Test script ShellCheck passed"
|
||||
@echo ""
|
||||
@echo "4. CircleCI Orb Linting..."
|
||||
@circleci orb validate src/@orb.yml
|
||||
@echo "✅ CircleCI orb validation passed"
|
||||
@echo ""
|
||||
@echo "4. Orb Packing Test..."
|
||||
@echo "5. Orb Packing Test..."
|
||||
@circleci orb pack src > /tmp/test-packed.yml
|
||||
@circleci orb validate /tmp/test-packed.yml
|
||||
@rm -f /tmp/test-packed.yml
|
||||
@@ -105,7 +123,7 @@ check-branch:
|
||||
fi
|
||||
|
||||
# Interactive snapshot release (dev:snapshot)
|
||||
publish-snapshot: check-clean lint validate
|
||||
publish-snapshot: check-clean lint clean dev test-all
|
||||
@echo "🚀 Publishing Snapshot Release"
|
||||
@echo ""
|
||||
@echo "This will publish to: kingsrook/qqq-orb@dev:snapshot"
|
||||
@@ -121,7 +139,7 @@ publish-snapshot: check-clean lint validate
|
||||
echo "✅ Snapshot published successfully!"
|
||||
|
||||
# Interactive production release (tagged version)
|
||||
publish-release: check-clean check-branch lint validate
|
||||
publish-release: check-clean check-branch lint clean dev test-all
|
||||
@echo "🚀 Publishing Production Release"
|
||||
@echo ""
|
||||
@echo "This will create a git tag and publish a production version."
|
||||
|
||||
@@ -1,339 +1,118 @@
|
||||
# QQQ Orb
|
||||
# qqq-orb
|
||||
|
||||
[](https://circleci.com/developer/orbs/orb/kingsrook/qqq-orb)
|
||||
[](https://circleci.com/developer/orbs/orb/kingsrook/qqq-orb)
|
||||
[](LICENSE)
|
||||
CircleCI orb for QQQ framework projects.
|
||||
|
||||
> **CircleCI Orb for QQQ Framework Projects**
|
||||
**For:** Teams using CircleCI to build, test, and publish QQQ applications
|
||||
**Status:** Stable (v0.4.0)
|
||||
|
||||
CircleCI orb for Maven and Node.js projects using GitFlow. Provides automated building, testing, version management, and publishing to Maven Central and npm registries.
|
||||
## Why This Exists
|
||||
|
||||
## 🚀 Overview
|
||||
QQQ projects share common CI/CD patterns: build with Maven, run tests, publish to Maven Central or npm. Setting this up from scratch means duplicating workflow configuration across every repository.
|
||||
|
||||
QQQ Orb is a **CircleCI orb** that provides standardized CI/CD workflows for projects in the QQQ ecosystem. It handles the complete development lifecycle from building and testing to publishing releases.
|
||||
This orb provides pre-built jobs for the complete QQQ development lifecycle. Add a few lines of YAML and your project has automated testing, version management, and publishing.
|
||||
|
||||
### What This Repository Contains
|
||||
## Features
|
||||
|
||||
- **CircleCI Orb**: Reusable CI/CD workflows and commands
|
||||
- **GitFlow Integration**: Automated branching and version management
|
||||
- **Multi-Platform Support**: Maven (Java) and npm (Node.js) project support
|
||||
- **Publishing Automation**: Automated publishing to Maven Central and npm
|
||||
- **Testing Framework**: Comprehensive testing with coverage reporting
|
||||
- **Maven and npm support** - Builds Java and Node.js projects
|
||||
- **Docker-native execution** - Machine executor with Docker pre-installed for Testcontainers/LocalStack
|
||||
- **GitFlow integration** - Automated versioning based on branch type
|
||||
- **Publishing automation** - Maven Central and npm registry publishing
|
||||
- **Test coverage** - JaCoCo integration with coverage reporting
|
||||
- **Version calculation** - Semantic versioning with SNAPSHOT, RC, and release support
|
||||
- **Java 21 default** - Temurin JDK with configurable version (17, 21)
|
||||
|
||||
### What This Repository Does NOT Contain
|
||||
## Quick Start
|
||||
|
||||
- **QQQ Framework**: The actual low-code engine and backend
|
||||
- **Application Code**: Business logic or application-specific code
|
||||
- **Runtime Dependencies**: Libraries or frameworks used by applications
|
||||
|
||||
## 🏗️ Architecture
|
||||
|
||||
### Technology Stack
|
||||
|
||||
- **CircleCI Orbs**: Reusable configuration components
|
||||
- **GitFlow**: Branching strategy for release management
|
||||
- **Maven**: Java project build and dependency management
|
||||
- **npm**: Node.js package management
|
||||
- **Shell Scripts**: Automation and utility scripts
|
||||
- **YAML**: Configuration and workflow definitions
|
||||
|
||||
### Core Capabilities
|
||||
|
||||
- **Automated Building**: Maven and npm project compilation
|
||||
- **Testing**: Unit tests, integration tests, and coverage reporting
|
||||
- **Version Management**: Automated semantic versioning based on GitFlow
|
||||
- **Publishing**: Maven Central and npm registry publishing
|
||||
- **Documentation**: Automated documentation generation and publishing
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Using the Orb
|
||||
**Prerequisites:** CircleCI account, repository connected to CircleCI
|
||||
|
||||
```yaml
|
||||
# .circleci/config.yml
|
||||
version: 2.1
|
||||
orbs:
|
||||
qqq-orb: kingsrook/qqq-orb@2.1
|
||||
qqq-orb: qrun-io/qqq-orb@0.4
|
||||
|
||||
workflows:
|
||||
test_only:
|
||||
filters:
|
||||
branches:
|
||||
ignore: [develop, main, /release\/.*/, /hotfix\/.*/]
|
||||
build_and_test:
|
||||
jobs:
|
||||
- qqq-orb/build
|
||||
- qqq-orb/test:
|
||||
requires: [qqq-orb/build]
|
||||
- qqq-orb/mvn_test_only
|
||||
|
||||
publish_snapshot:
|
||||
filters: { branches: { only: develop } }
|
||||
when:
|
||||
equal: [develop, << pipeline.git.branch >>]
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: snapshot
|
||||
|
||||
publish_release_candidate:
|
||||
filters: { branches: { only: /release\/.*/ } }
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: release_candidate
|
||||
|
||||
production_release:
|
||||
filters: { branches: { only: main } }
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: release
|
||||
|
||||
hotfix_release:
|
||||
filters: { branches: { only: /hotfix\/.*/ } }
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: hotfix
|
||||
```
|
||||
|
||||
### Required Context
|
||||
## Usage
|
||||
|
||||
Set up `qqq-maven-registry-credentials` context in CircleCI:
|
||||
### Available Jobs
|
||||
|
||||
| Variable | Description | Required For |
|
||||
|----------|-------------|--------------|
|
||||
| `MAVEN_USERNAME` | Sonatype username | Maven publishing |
|
||||
| `MAVEN_PASSWORD` | Sonatype password | Maven publishing |
|
||||
| `GPG_PRIVATE_KEY_B64` | Base64 encoded GPG private key | Maven signing |
|
||||
| `GPG_KEYNAME` | GPG key identifier | Maven signing |
|
||||
| `GPG_PASSPHRASE` | GPG passphrase | Maven signing |
|
||||
| `GITHUB_TOKEN` | GitHub API token | GitHub releases |
|
||||
| `RDBMS_PASSWORD` | Database password | Integration testing |
|
||||
| Job | Purpose |
|
||||
|-----|---------|
|
||||
| `mvn_test_only` | Build and test Maven projects |
|
||||
| `mvn_publish` | Build, test, and publish Maven artifacts |
|
||||
| `mvn_frontend_test_only` | Build and test Maven projects with npm frontend |
|
||||
| `mvn_frontend_publish` | Build, test, and publish Maven projects with npm frontend |
|
||||
| `node_test_only` | Build and test Node.js projects |
|
||||
| `node_publish` | Build, test, and publish Node.js packages |
|
||||
|
||||
### Project Requirements
|
||||
### Branch Types
|
||||
|
||||
- **Maven Projects**: `pom.xml` with `<revision>` property
|
||||
- **Node.js Projects**: `package.json` with version field
|
||||
- **Settings**: `/tmp/circleci/mvn-settings.xml` (auto-generated if missing)
|
||||
- **Documentation**: `docs/index.adoc` (optional, for documentation)
|
||||
| Branch | Version Format |
|
||||
|--------|----------------|
|
||||
| `develop` | `1.5.0-SNAPSHOT` |
|
||||
| `release/1.5` | `1.5.0-RC.1` |
|
||||
| `main` | `1.5.0` (requires tag) |
|
||||
| `hotfix/1.5.1` | `1.5.1` |
|
||||
| `feature/*` | `1.5.0-feature-abc1234-SNAPSHOT` |
|
||||
|
||||
## 📁 Repository Structure
|
||||
### Java Version
|
||||
|
||||
```
|
||||
src/
|
||||
├── @orb.yml # Main orb definition
|
||||
├── commands/ # Reusable commands
|
||||
│ ├── mvn_build.yml # Maven build command
|
||||
│ ├── mvn_verify.yml # Maven test and verify
|
||||
│ ├── mvn_jar_deploy.yml # Maven deployment
|
||||
│ ├── node_build_package.yml # Node.js build and package
|
||||
│ ├── node_publish.yml # npm publishing
|
||||
│ └── ... # Additional commands
|
||||
├── jobs/ # Complete workflow jobs
|
||||
│ ├── mvn_publish.yml # Maven publishing workflow
|
||||
│ ├── mvn_test_only.yml # Maven testing workflow
|
||||
│ ├── node_publish.yml # npm publishing workflow
|
||||
│ └── node_test_only.yml # npm testing workflow
|
||||
├── scripts/ # Shell scripts
|
||||
│ ├── calculate_version.sh # Version calculation
|
||||
│ ├── mvn_build_compile.sh # Maven compilation
|
||||
│ ├── node_npm_auth.sh # npm authentication
|
||||
│ └── ... # Additional scripts
|
||||
├── executors/ # Execution environments
|
||||
│ └── default.yml # Default executor configuration
|
||||
└── examples/ # Usage examples
|
||||
└── build.yml # Example configuration
|
||||
```
|
||||
|
||||
## 🎯 Available Jobs
|
||||
|
||||
| Job | Branch | Output | Description |
|
||||
|-----|--------|--------|-------------|
|
||||
| `build` | Any | Compiled artifacts | Build project without testing |
|
||||
| `test` | Any | Test results + JaCoCo | Run tests with coverage |
|
||||
| `publish` | Any | Published artifacts | Unified publishing based on branch_type |
|
||||
|
||||
### Publish Job Parameters
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `branch_type` | string | "snapshot" | Branch type: snapshot, release_candidate, release, hotfix |
|
||||
|
||||
## 🔧 Development
|
||||
|
||||
### Prerequisites
|
||||
|
||||
```bash
|
||||
# Install CircleCI CLI
|
||||
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | sudo bash
|
||||
|
||||
# Install linting tools (macOS)
|
||||
brew install shellcheck yamllint
|
||||
|
||||
# Install linting tools (Ubuntu/Debian)
|
||||
sudo apt-get install shellcheck yamllint
|
||||
```
|
||||
|
||||
### Development Commands
|
||||
|
||||
```bash
|
||||
make pack # Pack orb (resolves <<include()>>)
|
||||
make validate # Validate packed orb
|
||||
make lint # Run all linting checks
|
||||
make dev # Pack + validate
|
||||
make clean # Clean build artifacts
|
||||
```
|
||||
|
||||
### Publishing Commands
|
||||
|
||||
```bash
|
||||
make publish-snapshot # Publish as kingsrook/qqq-orb@dev:snapshot
|
||||
make publish-release # Publish as kingsrook/qqq-orb@X.Y.Z
|
||||
```
|
||||
|
||||
## 📋 Version Management
|
||||
|
||||
Automated version calculation based on GitFlow branches:
|
||||
|
||||
| Branch Pattern | Version Change | Example |
|
||||
|----------------|----------------|---------|
|
||||
| `develop` | Minor bump | `1.5.0-SNAPSHOT` → `1.6.0-SNAPSHOT` |
|
||||
| `release/1.5` | RC versions | `1.5.0-RC.1`, `1.5.0-RC.2`, ... |
|
||||
| `main` | Stable release | `1.5.0-RC.3` → `1.5.0` **requires v* tag** |
|
||||
| `hotfix/1.5.1` | Patch bump | `1.5.0` → `1.5.1` |
|
||||
|
||||
**Main branch requires release tags**:
|
||||
```bash
|
||||
git tag -a v1.5.0 -m "Release 1.5.0"
|
||||
git push origin v1.5.0
|
||||
```
|
||||
|
||||
## 🧪 Testing
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
make test
|
||||
|
||||
# Run linting checks
|
||||
make lint
|
||||
|
||||
# Validate orb configuration
|
||||
make validate
|
||||
```
|
||||
|
||||
### Test Coverage
|
||||
|
||||
The orb includes comprehensive testing:
|
||||
- **YAML Validation**: CircleCI orb configuration validation
|
||||
- **Shell Script Testing**: ShellCheck for shell script validation
|
||||
- **Orb Packing**: Tests orb packing and resolution
|
||||
- **Integration Testing**: End-to-end workflow testing
|
||||
|
||||
## 📦 Usage Examples
|
||||
|
||||
### Maven Project (Backend Only)
|
||||
Maven jobs run on Ubuntu machine executors with Temurin JDK. Default is Java 21. To use Java 17:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: snapshot
|
||||
- qqq-orb/mvn_test_only:
|
||||
java_version: "17"
|
||||
```
|
||||
|
||||
### Node.js Project (Frontend Only)
|
||||
### Docker Support
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: release
|
||||
Maven jobs use machine executors with Docker pre-installed. Tests using Testcontainers, LocalStack, or other Docker-dependent frameworks work without additional configuration.
|
||||
|
||||
### Required Context Variables
|
||||
|
||||
| Variable | Purpose |
|
||||
|----------|---------|
|
||||
| `MAVEN_USERNAME` | Sonatype username |
|
||||
| `MAVEN_PASSWORD` | Sonatype password |
|
||||
| `GPG_PRIVATE_KEY_B64` | Base64-encoded GPG key |
|
||||
| `GPG_KEYNAME` | GPG key ID |
|
||||
| `GPG_PASSPHRASE` | GPG passphrase |
|
||||
| `GITHUB_TOKEN` | GitHub API token |
|
||||
|
||||
## Project Status
|
||||
|
||||
**Maturity:** Stable, used across all QQQ repositories
|
||||
**Breaking changes:** See [CHANGELOG.md](CHANGELOG.md)
|
||||
|
||||
**Roadmap:**
|
||||
- GitHub Actions support
|
||||
- Parallel test execution
|
||||
- Container image publishing
|
||||
|
||||
## Contributing
|
||||
|
||||
```bash
|
||||
git clone git@github.com:QRun-IO/qqq-orb.git
|
||||
cd qqq-orb
|
||||
make test-all
|
||||
```
|
||||
|
||||
### Hybrid Project (Maven + Node.js)
|
||||
See [QQQ Contribution Guidelines](https://github.com/Kingsrook/qqq/blob/develop/CONTRIBUTING.md).
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: release_candidate
|
||||
```
|
||||
## License
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
**Important**: This repository is a component of the QQQ framework. All contributions, issues, and discussions should go through the main QQQ repository.
|
||||
|
||||
### Development Workflow
|
||||
|
||||
1. **Fork the main QQQ repository**: https://github.com/Kingsrook/qqq
|
||||
2. **Create a feature branch**: `git checkout -b feature/amazing-feature`
|
||||
3. **Make your changes** (including orb changes if applicable)
|
||||
4. **Run tests**: `make test`
|
||||
5. **Commit your changes**: `git commit -m 'Add amazing feature'`
|
||||
6. **Push to the branch**: `git push origin feature/amazing-feature`
|
||||
7. **Open a Pull Request** to the main QQQ repository
|
||||
|
||||
### Code Standards
|
||||
|
||||
- **YAML**: Follow CircleCI orb best practices
|
||||
- **Shell Scripts**: Use ShellCheck for validation
|
||||
- **Documentation**: Update README and inline documentation
|
||||
- **Testing**: Comprehensive test coverage
|
||||
|
||||
## 📄 License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
```
|
||||
QQQ Orb
|
||||
Copyright (C) 2021-2024 Kingsrook, LLC
|
||||
651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
contact@kingsrook.com | https://github.com/Kingsrook/
|
||||
```
|
||||
|
||||
## 🆘 Support & Community
|
||||
|
||||
### ⚠️ Important: Use Main QQQ Repository
|
||||
|
||||
**All support, issues, discussions, and community interactions should go through the main QQQ repository:**
|
||||
|
||||
- **Main Repository**: https://github.com/Kingsrook/qqq
|
||||
- **Issues**: https://github.com/Kingsrook/qqq/issues
|
||||
- **Discussions**: https://github.com/Kingsrook/qqq/discussions
|
||||
- **Wiki**: https://github.com/Kingsrook/qqq/wiki
|
||||
|
||||
### Why This Repository Exists
|
||||
|
||||
This repository is maintained separately from the main QQQ repository to:
|
||||
- **Enable independent orb development** and versioning
|
||||
- **Allow orb-specific CI/CD** and deployment pipelines
|
||||
- **Provide clear separation** between orb and framework concerns
|
||||
- **Support different release cycles** for CI/CD tools vs. core framework
|
||||
|
||||
### Getting Help
|
||||
|
||||
- **Documentation**: Check the [QQQ Wiki](https://github.com/Kingsrook/qqq/wiki)
|
||||
- **Issues**: Report bugs and feature requests on [Main QQQ Issues](https://github.com/Kingsrook/qqq/issues)
|
||||
- **Discussions**: Join community discussions on [Main QQQ Discussions](https://github.com/Kingsrook/qqq/discussions)
|
||||
- **Questions**: Ask questions in the main QQQ repository
|
||||
|
||||
### Contact Information
|
||||
|
||||
- **Company**: Kingsrook, LLC
|
||||
- **Email**: contact@kingsrook.com
|
||||
- **Website**: https://qrun.io
|
||||
- **Main GitHub**: https://github.com/Kingsrook/qqq
|
||||
- **CircleCI Registry**: [kingsrook/qqq-orb](https://circleci.com/developer/orbs/orb/kingsrook/qqq-orb)
|
||||
|
||||
## 🙏 Acknowledgments
|
||||
|
||||
- **CircleCI Team**: For the excellent CI/CD platform and orb system
|
||||
- **Maven Team**: For the powerful Java build system
|
||||
- **npm Team**: For the Node.js package management system
|
||||
- **QQQ Framework Team**: For the underlying low-code platform
|
||||
- **Open Source Community**: For the tools and libraries that make this possible
|
||||
|
||||
---
|
||||
|
||||
**Built with ❤️ by the Kingsrook Team**
|
||||
|
||||
**This is a CI/CD component of the QQQ framework. For complete information, support, and community, visit: https://github.com/Kingsrook/qqq**
|
||||
AGPL-3.0 - QRun-IO
|
||||
+2
-111
@@ -1,112 +1,3 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
QQQ Orb follows semantic versioning and provides security updates for the following versions:
|
||||
|
||||
| Version | Supported | End of Life |
|
||||
| ------- | ------------------ | ----------- |
|
||||
| 2.1.x | :white_check_mark: | TBD |
|
||||
| 2.0.x | :white_check_mark: | TBD |
|
||||
| 1.x.x | :white_check_mark: | TBD |
|
||||
| < 1.0 | :x: | EOL |
|
||||
|
||||
**Note**: We recommend using the latest stable version for security updates.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
**🚨 Security vulnerabilities should NEVER be reported publicly.**
|
||||
|
||||
If you discover a security vulnerability in QQQ Orb, please report it privately:
|
||||
|
||||
### **Email Security Reports**
|
||||
Send security reports to: **security@kingsrook.com**
|
||||
|
||||
### **What to Include**
|
||||
- **Description**: Clear description of the vulnerability
|
||||
- **Impact**: Potential impact on users and CI/CD systems
|
||||
- **Reproduction**: Steps to reproduce the issue
|
||||
- **Environment**: QQQ Orb version, CircleCI version, OS details
|
||||
- **Timeline**: If you need disclosure by a specific date
|
||||
|
||||
### **Response Timeline**
|
||||
- **Initial Response**: Within 24 hours
|
||||
- **Assessment**: Within 3 business days
|
||||
- **Update**: Regular updates on progress
|
||||
- **Resolution**: As quickly as possible based on severity
|
||||
|
||||
### **What Happens Next**
|
||||
1. **Acknowledgment**: We'll acknowledge receipt within 24 hours
|
||||
2. **Investigation**: Our security team will investigate the report
|
||||
3. **Assessment**: We'll assess the severity and impact
|
||||
4. **Fix Development**: Develop and test a security fix
|
||||
5. **Release**: Release a security update
|
||||
6. **Disclosure**: Public disclosure with credit (if requested)
|
||||
|
||||
## Security Best Practices
|
||||
|
||||
### **For Users**
|
||||
- **Keep Updated**: Always use the latest stable version
|
||||
- **Monitor Releases**: Watch for security advisories
|
||||
- **Report Issues**: Report any security concerns immediately
|
||||
- **Follow Guidelines**: Use QQQ Orb according to security best practices
|
||||
- **Secure Contexts**: Ensure CircleCI contexts contain only necessary secrets
|
||||
|
||||
### **For Contributors**
|
||||
- **Security Review**: All code changes undergo security review
|
||||
- **Dependency Scanning**: Regular vulnerability scanning of dependencies
|
||||
- **Secure Development**: Follow secure coding practices
|
||||
- **Testing**: Security testing is part of our development process
|
||||
- **Secret Management**: Never commit secrets or credentials
|
||||
|
||||
## Security Features
|
||||
|
||||
QQQ Orb includes several security features:
|
||||
|
||||
- **Input Validation**: Comprehensive input validation and sanitization
|
||||
- **Secret Management**: Secure handling of CI/CD secrets and credentials
|
||||
- **Audit Logging**: Comprehensive audit trails for CI/CD events
|
||||
- **Secure Defaults**: Secure-by-default configuration
|
||||
- **Dependency Scanning**: Regular scanning of orb dependencies
|
||||
|
||||
## Security Updates
|
||||
|
||||
### **Release Process**
|
||||
Security updates follow our standard [Release Flow](https://github.com/Kingsrook/qqq/wiki/Release-Flow):
|
||||
|
||||
1. **Security Fix**: Develop and test security fix
|
||||
2. **Release Branch**: Create release branch for security update
|
||||
3. **Testing**: Thorough testing of security fix
|
||||
4. **Release**: Release security update to users
|
||||
5. **Communication**: Notify users of security update
|
||||
|
||||
### **Update Notifications**
|
||||
- **GitHub Releases**: Security updates announced in release notes
|
||||
- **Security Advisories**: GitHub security advisories for critical issues
|
||||
- **Email Notifications**: Direct notifications for critical vulnerabilities
|
||||
- **CircleCI Registry**: Updated orb versions in CircleCI registry
|
||||
|
||||
## CI/CD Security Considerations
|
||||
|
||||
### **CircleCI Context Security**
|
||||
- **Minimal Permissions**: Use least-privilege access for contexts
|
||||
- **Secret Rotation**: Regularly rotate secrets and credentials
|
||||
- **Access Control**: Limit access to sensitive contexts
|
||||
- **Audit Logs**: Monitor context usage and access
|
||||
|
||||
### **Orb Security**
|
||||
- **Version Pinning**: Always pin specific orb versions
|
||||
- **Source Verification**: Verify orb source and integrity
|
||||
- **Regular Updates**: Keep orb versions up to date
|
||||
- **Security Scanning**: Scan orb dependencies regularly
|
||||
|
||||
## Contact Information
|
||||
|
||||
- **Security Email**: security@kingsrook.com
|
||||
- **General Contact**: contact@kingsrook.com
|
||||
- **Company**: Kingsrook, LLC
|
||||
- **Website**: https://qrun.io
|
||||
|
||||
---
|
||||
|
||||
**Thank you for helping keep QQQ Orb secure!** 🛡️
|
||||
|
||||
* See Project [Security Policy](https://github.com/Kingsrook/qqq/blob/develop/SECURITY.md)
|
||||
+3
-4
@@ -4,14 +4,13 @@ version: 2.1
|
||||
|
||||
description: >
|
||||
QQQ Orb to handle the branching, testing, releasing, and auto updating of
|
||||
all maven and npm based projects within the Kingsrook/QRunIO Repo world.
|
||||
all Maven and npm based projects within the QRun-IO ecosystem.
|
||||
|
||||
display:
|
||||
home_url: "https://www.qrun.io"
|
||||
source_url: "https://github.com/Kingsrook/qqq-orb"
|
||||
home_url: "https://github.com/QRun-IO/qqq-orb"
|
||||
source_url: "https://github.com/QRun-IO/qqq-orb"
|
||||
|
||||
orbs:
|
||||
localstack: localstack/platform@2.1
|
||||
browser-tools: circleci/browser-tools@1.4.7
|
||||
slack: circleci/slack@5.2.1
|
||||
node: circleci/node@4.7
|
||||
@@ -11,6 +11,8 @@ steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-{{ checksum "pom.xml" }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-npm-dependencies-{{ checksum "package.json" }}
|
||||
- run:
|
||||
name: Setup NPM authentication
|
||||
@@ -30,5 +32,8 @@ steps:
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.m2
|
||||
- node_modules
|
||||
key: v1-dependencies-{{ checksum "pom.xml" }}
|
||||
- save_cache:
|
||||
paths:
|
||||
- node_modules
|
||||
key: v1-npm-dependencies-{{ checksum "package.json" }}
|
||||
@@ -33,6 +33,9 @@ steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-{{ checksum "pom.xml" }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-npm-dependencies-{{ checksum "package.json" }}
|
||||
|
||||
# (Optional) Guard: if node_modules is missing, install it quickly so "npm run build" works
|
||||
- run:
|
||||
@@ -67,3 +70,9 @@ steps:
|
||||
paths:
|
||||
- ~/.m2
|
||||
key: v1-dependencies-{{ checksum "pom.xml" }}
|
||||
|
||||
# Re-cache Node deps
|
||||
- save_cache:
|
||||
paths:
|
||||
- node_modules
|
||||
key: v1-npm-dependencies-{{ checksum "package.json" }}
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
description: >
|
||||
Full checkout of the repository with complete git history.
|
||||
Uses CircleCI's checkout (handles SSH keys and known_hosts)
|
||||
then fetches full history for version calculation.
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Fetch full git history
|
||||
command: |
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags || true
|
||||
@@ -0,0 +1,30 @@
|
||||
description: >
|
||||
Installs Eclipse Temurin JDK and Maven on Ubuntu machine executor.
|
||||
Sets JAVA_HOME and updates PATH for subsequent steps.
|
||||
Optionally installs Node.js for frontend builds.
|
||||
Also verifies Docker is available (required for Testcontainers/LocalStack tests).
|
||||
|
||||
parameters:
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: >
|
||||
Java major version to install (e.g., "17", "21").
|
||||
Uses Eclipse Temurin (AdoptOpenJDK successor) distribution.
|
||||
install_node:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Whether to also install Node.js (for frontend builds)"
|
||||
node_version:
|
||||
type: string
|
||||
default: "20"
|
||||
description: "Node.js major version to install (e.g., '18', '20')"
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Install Java << parameters.java_version >> and build tools
|
||||
environment:
|
||||
PARAM_JAVA_VERSION: << parameters.java_version >>
|
||||
PARAM_INSTALL_NODE: << parameters.install_node >>
|
||||
PARAM_NODE_VERSION: << parameters.node_version >>
|
||||
command: <<include(scripts/install_java.sh)>>
|
||||
@@ -0,0 +1,26 @@
|
||||
description: >
|
||||
Creates a GitHub Release for the current version tag.
|
||||
- Extracts version from pom.xml or package.json
|
||||
- Verifies the Git tag exists
|
||||
- Creates GitHub release with auto-generated notes
|
||||
- Adds artifact links to Maven Central and/or npmjs
|
||||
- Handles prerelease versions (RC, SNAPSHOT, alpha, beta)
|
||||
|
||||
parameters:
|
||||
project_type:
|
||||
type: enum
|
||||
enum: [maven, node, both, auto]
|
||||
default: auto
|
||||
description: >
|
||||
Project type for artifact link generation.
|
||||
- maven: Link to Maven Central
|
||||
- node: Link to npmjs
|
||||
- both: Link to both registries
|
||||
- auto: Auto-detect from project files
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Create GitHub Release
|
||||
command: <<include(scripts/create_github_release.sh)>>
|
||||
environment:
|
||||
PROJECT_TYPE: << parameters.project_type >>
|
||||
+37
-21
@@ -4,55 +4,71 @@ description: >
|
||||
|
||||
usage:
|
||||
version: 2.1
|
||||
|
||||
orbs:
|
||||
qqq-orb: kingsrook/qqq-orb@0.3.1
|
||||
qqq-orb: kingsrook/qqq-orb@0.3.8
|
||||
|
||||
workflows:
|
||||
# Test workflow for feature branches
|
||||
|
||||
test_only:
|
||||
jobs:
|
||||
- qqq-orb/mvn_test_only:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
filters:
|
||||
branches:
|
||||
ignore: [develop, main, /release\/.*/, /hotfix\/.*/]
|
||||
filters:
|
||||
branches:
|
||||
ignore: /(develop|main|release/.*|hotfix/.*|integration.*)/
|
||||
tags:
|
||||
only: []
|
||||
|
||||
# Snapshot deployment for develop branch
|
||||
publish_snapshot:
|
||||
jobs:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
branch_type: snapshot
|
||||
filters:
|
||||
branches:
|
||||
only: [develop]
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
|
||||
publish_feature:
|
||||
jobs:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
branch_type: feature
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- feature/.*
|
||||
tags:
|
||||
only: [ /publish.*/ ]
|
||||
|
||||
# Release candidate workflow
|
||||
publish_release_candidate:
|
||||
jobs:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
branch_type: release_candidate
|
||||
filters:
|
||||
branches:
|
||||
only: [/release\/.*/]
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- /release\/.*/
|
||||
|
||||
# Production release workflow
|
||||
publish_release:
|
||||
jobs:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
branch_type: release
|
||||
filters:
|
||||
branches:
|
||||
only: [main]
|
||||
filters:
|
||||
branches:
|
||||
only: [ main ]
|
||||
tags:
|
||||
only: [ /v.*/ ]
|
||||
|
||||
# Hotfix release workflow
|
||||
publish_hotfix_release:
|
||||
jobs:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
branch_type: hotfix
|
||||
filters:
|
||||
branches:
|
||||
only: [/hotfix\/.*/]
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- /hotfix\/.*/
|
||||
@@ -0,0 +1,18 @@
|
||||
description: >
|
||||
Java/OpenJDK machine executor with Docker support.
|
||||
Uses Ubuntu 22.04 VM with Docker pre-installed.
|
||||
Java is installed via the install_java command.
|
||||
Required for tests that use Testcontainers or LocalStack Docker extensions.
|
||||
|
||||
parameters:
|
||||
image:
|
||||
default: ubuntu-2204:current
|
||||
description: >
|
||||
Ubuntu machine image tag. Use 'current' for latest or pin to specific
|
||||
version like 'ubuntu-2204:2023.02.1' for reproducibility.
|
||||
type: string
|
||||
|
||||
machine:
|
||||
image: '<<parameters.image>>'
|
||||
|
||||
resource_class: large
|
||||
@@ -1,27 +1,33 @@
|
||||
description: >
|
||||
Unified publishing job for all branch types
|
||||
Unified publishing job for all branch types with frontend
|
||||
Handles version management, building, testing, and publishing based on branch type
|
||||
Supports: snapshot, release_candidate, release, and hotfix workflows
|
||||
|
||||
executor: localstack/default
|
||||
executor: java
|
||||
|
||||
parameters:
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: "Java major version to install (e.g., '17', '21')"
|
||||
node_version:
|
||||
type: string
|
||||
default: "20"
|
||||
description: "Node.js major version to install (e.g., '18', '20')"
|
||||
branch_type:
|
||||
type: string
|
||||
default: "snapshot"
|
||||
description: "Branch type: snapshot, release_candidate, release, or hotfix"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- install_java:
|
||||
java_version: << parameters.java_version >>
|
||||
install_node: true
|
||||
node_version: << parameters.node_version >>
|
||||
- git_full_checkout
|
||||
- mvn_manage_version
|
||||
- frontend_build
|
||||
- frontend_test
|
||||
- frontend_package
|
||||
- mvn_jar_deploy
|
||||
- when:
|
||||
condition:
|
||||
or:
|
||||
- equal: ["snapshot", << parameters.branch_type >>]
|
||||
- equal: ["release_candidate", << parameters.branch_type >>]
|
||||
steps:
|
||||
- git_operations
|
||||
- git_operations
|
||||
@@ -1,12 +1,26 @@
|
||||
description: >
|
||||
Complete test-only workflow for feature branches
|
||||
Complete test-only workflow for feature branches with frontend
|
||||
Runs build, test, API version check, and documentation generation
|
||||
Used by: test_only workflow for feature branches
|
||||
Triggers: Any push to branches NOT matching develop, main, release/*, hotfix/*
|
||||
|
||||
executor: localstack/default
|
||||
executor: java
|
||||
|
||||
parameters:
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: "Java major version to install (e.g., '17', '21')"
|
||||
node_version:
|
||||
type: string
|
||||
default: "20"
|
||||
description: "Node.js major version to install (e.g., '18', '20')"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- install_java:
|
||||
java_version: << parameters.java_version >>
|
||||
install_node: true
|
||||
node_version: << parameters.node_version >>
|
||||
- git_full_checkout
|
||||
- frontend_build
|
||||
- frontend_test
|
||||
@@ -1,15 +1,19 @@
|
||||
description: >
|
||||
Unified publishing job for all branch types
|
||||
Handles version management, building, testing, and publishing based on branch type
|
||||
Supports: snapshot, release_candidate, release, and hotfix workflows
|
||||
Supports: snapshot, release_candidate, release (tagged), feature (tagged) and hotfix workflows
|
||||
|
||||
executor: localstack/default
|
||||
executor: java
|
||||
|
||||
parameters:
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: "Java major version to install (e.g., '17', '21')"
|
||||
branch_type:
|
||||
type: string
|
||||
default: "snapshot"
|
||||
description: "Branch type: snapshot, release_candidate, release, or hotfix"
|
||||
description: "Branch type: snapshot, release_candidate, release, features, or hotfix"
|
||||
check_middleware_api_versions:
|
||||
type: boolean
|
||||
default: false
|
||||
@@ -20,25 +24,45 @@ parameters:
|
||||
description: "Whether to publish AsciiDoc documentation"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- install_java:
|
||||
java_version: << parameters.java_version >>
|
||||
|
||||
- git_full_checkout
|
||||
|
||||
- mvn_build
|
||||
|
||||
- mvn_manage_version
|
||||
|
||||
- attach_workspace:
|
||||
at: .
|
||||
|
||||
- mvn_verify
|
||||
|
||||
- when:
|
||||
condition: << parameters.check_middleware_api_versions >>
|
||||
steps:
|
||||
- check_middleware_api_versions
|
||||
|
||||
- mvn_jar_deploy
|
||||
|
||||
- when:
|
||||
condition:
|
||||
or:
|
||||
- equal: ["snapshot", << parameters.branch_type >>]
|
||||
- equal: ["release_candidate", << parameters.branch_type >>]
|
||||
not:
|
||||
equal: [ "<< parameters.branch_type >>", "feature" ]
|
||||
steps:
|
||||
- git_operations
|
||||
|
||||
- when:
|
||||
condition: << parameters.publish_asciidoc >>
|
||||
steps:
|
||||
- publish_asciidoc
|
||||
|
||||
- when:
|
||||
condition:
|
||||
or:
|
||||
- equal: [ "<< parameters.branch_type >>", "release" ]
|
||||
- equal: [ "<< parameters.branch_type >>", "release_candidate" ]
|
||||
- equal: [ "<< parameters.branch_type >>", "hotfix" ]
|
||||
steps:
|
||||
- publish_github_release:
|
||||
project_type: maven
|
||||
@@ -4,16 +4,22 @@ description: >
|
||||
Used by: test_only workflow for feature branches
|
||||
Triggers: Any push to branches NOT matching develop, main, release/*, hotfix/*
|
||||
|
||||
executor: localstack/default
|
||||
executor: java
|
||||
|
||||
parameters:
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: "Java major version to install (e.g., '17', '21')"
|
||||
check_middleware_api_versions:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Whether to run middleware API version checks"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- install_java:
|
||||
java_version: << parameters.java_version >>
|
||||
- git_full_checkout
|
||||
- mvn_build
|
||||
- mvn_verify
|
||||
- when:
|
||||
|
||||
@@ -3,16 +3,22 @@ description: >
|
||||
Handles version management, building, testing, and publishing based on branch type
|
||||
Supports: snapshot, release_candidate, release, and hotfix workflows
|
||||
|
||||
executor: localstack/default
|
||||
executor:
|
||||
name: default
|
||||
tag: << parameters.node_version >>
|
||||
|
||||
parameters:
|
||||
node_version:
|
||||
type: string
|
||||
default: "lts"
|
||||
description: "Node.js version tag (e.g., 'lts', '18.0', '20.0')."
|
||||
branch_type:
|
||||
type: string
|
||||
default: "snapshot"
|
||||
description: "Branch type: snapshot, release_candidate, release, or hotfix"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- git_full_checkout
|
||||
- node_install_dependencies
|
||||
- node_run_tests
|
||||
- node_manage_version
|
||||
@@ -20,3 +26,13 @@ steps:
|
||||
at: .
|
||||
- node_build_package
|
||||
- node_publish
|
||||
|
||||
- when:
|
||||
condition:
|
||||
or:
|
||||
- equal: [ "<< parameters.branch_type >>", "release" ]
|
||||
- equal: [ "<< parameters.branch_type >>", "release_candidate" ]
|
||||
- equal: [ "<< parameters.branch_type >>", "hotfix" ]
|
||||
steps:
|
||||
- publish_github_release:
|
||||
project_type: node
|
||||
@@ -3,15 +3,21 @@ description: >
|
||||
Handles testing based on branch type
|
||||
Supports: snapshot, release_candidate, release, and hotfix workflows
|
||||
|
||||
executor: localstack/default
|
||||
executor:
|
||||
name: default
|
||||
tag: << parameters.node_version >>
|
||||
|
||||
parameters:
|
||||
node_version:
|
||||
type: string
|
||||
default: "lts"
|
||||
description: "Node.js version tag (e.g., 'lts', '18.0', '20.0')."
|
||||
branch_type:
|
||||
type: string
|
||||
default: "snapshot"
|
||||
description: "Branch type: snapshot, release_candidate, release, or hotfix"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- git_full_checkout
|
||||
- node_install_dependencies
|
||||
- node_run_tests
|
||||
+274
-142
@@ -18,7 +18,7 @@ set -e
|
||||
###################
|
||||
## Configuration ##
|
||||
###################
|
||||
POM_FILE="pom.xml"
|
||||
POM_FILE="${POM_FILE:-pom.xml}"
|
||||
DRY_RUN=false
|
||||
|
||||
##################################
|
||||
@@ -29,13 +29,45 @@ if [[ "$1" == "--dry-run" ]]; then
|
||||
echo "DRY RUN MODE - No changes will be made"
|
||||
fi
|
||||
|
||||
################################################
|
||||
## Function to find original feature branch ##
|
||||
################################################
|
||||
find_original_feature_branch() {
|
||||
local original_branch=""
|
||||
|
||||
# Method 1: Look for remote branches containing this commit
|
||||
echo "Method 1: Checking remote branches..." >&2
|
||||
original_branch=$(git branch -r --contains HEAD 2>/dev/null | grep 'origin/feature/' | head -1 | sed 's/origin\///' | sed 's/^[[:space:]]*//' || echo "")
|
||||
if [[ -n "$original_branch" ]]; then
|
||||
echo "Found via remote branches: [$original_branch]" >&2
|
||||
fi
|
||||
|
||||
# Return the result
|
||||
if [[ "$original_branch" =~ ^feature/ ]]; then
|
||||
echo "✅ Found original feature branch: [$original_branch]" >&2
|
||||
echo "$original_branch"
|
||||
else
|
||||
echo "⚠️ Could not determine original feature branch, using generic name" >&2
|
||||
echo "feature/publish"
|
||||
fi
|
||||
}
|
||||
|
||||
####################################
|
||||
## Get current branch and version ##
|
||||
####################################
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
CURRENT_VERSION=$(grep '<revision>' $POM_FILE | sed 's/.*<revision>//;s/<.*//')
|
||||
# Try to get branch from CircleCI environment variable first (for CI environments)
|
||||
# then fall back to git command (for local development)
|
||||
if [[ -n "$CIRCLE_BRANCH" ]]; then
|
||||
echo "Using branch from CircleCI environment: $CIRCLE_BRANCH"
|
||||
CURRENT_BRANCH="$CIRCLE_BRANCH"
|
||||
else
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
fi
|
||||
|
||||
CURRENT_VERSION=$(grep '<revision>' "$POM_FILE" | sed 's/.*<revision>//;s/<.*//')
|
||||
|
||||
# Check if we're on a tag (HEAD means we're on a tag)
|
||||
CURRENT_TAG=""
|
||||
if [[ "$CURRENT_BRANCH" == "HEAD" ]]; then
|
||||
# Get the tag name we're on
|
||||
CURRENT_TAG=$(git describe --tags --exact-match HEAD 2>/dev/null || echo "")
|
||||
@@ -49,6 +81,9 @@ if [[ "$CURRENT_BRANCH" == "HEAD" ]]; then
|
||||
echo "This is a release candidate tag, treating as release branch"
|
||||
CURRENT_BRANCH="release/${CURRENT_TAG#v}"
|
||||
CURRENT_BRANCH="release/${CURRENT_BRANCH%-RC.*}"
|
||||
elif [[ "$CURRENT_TAG" =~ ^publish- ]]; then
|
||||
echo "This is a publish tag for feature branch, treating as feature branch"
|
||||
CURRENT_BRANCH=$(find_original_feature_branch)
|
||||
else
|
||||
echo "Unknown tag format: $CURRENT_TAG"
|
||||
CURRENT_BRANCH="unknown"
|
||||
@@ -67,6 +102,12 @@ echo "Current version: $CURRENT_VERSION"
|
||||
############################################
|
||||
extract_version_parts() {
|
||||
local version=$1
|
||||
|
||||
# Remove 'v' prefix if present
|
||||
if [[ "$version" =~ ^v(.+)$ ]]; then
|
||||
version=${BASH_REMATCH[1]}
|
||||
fi
|
||||
|
||||
########################################
|
||||
## Handle RC versions like 1.5.0-RC.1 ##
|
||||
########################################
|
||||
@@ -81,6 +122,14 @@ extract_version_parts() {
|
||||
MAJOR=${BASH_REMATCH[1]}
|
||||
MINOR=${BASH_REMATCH[2]}
|
||||
PATCH=${BASH_REMATCH[3]}
|
||||
#############################################################
|
||||
## Handle feature-specific versions like 1.5.0-NEW-abc1234-SNAPSHOT ##
|
||||
## or 1.4.0-test-new-orb-825957d-SNAPSHOT ##
|
||||
#############################################################
|
||||
elif [[ "$version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)-[a-zA-Z0-9-]+-[a-f0-9]+-SNAPSHOT$ ]]; then
|
||||
MAJOR=${BASH_REMATCH[1]}
|
||||
MINOR=${BASH_REMATCH[2]}
|
||||
PATCH=${BASH_REMATCH[3]}
|
||||
#######################################
|
||||
## Handle stable versions like 1.5.0 ##
|
||||
#######################################
|
||||
@@ -94,139 +143,6 @@ extract_version_parts() {
|
||||
fi
|
||||
}
|
||||
|
||||
#############################################################
|
||||
## Function to calculate next version based on branch type ##
|
||||
#############################################################
|
||||
calculate_next_version() {
|
||||
local branch=$1
|
||||
|
||||
case "$branch" in
|
||||
"develop")
|
||||
#############################################################################
|
||||
## Check if we just merged a release branch back to develop ##
|
||||
## Look for very specific patterns that indicate a release completion ##
|
||||
## Only look at recent commits to avoid historical merges triggering bumps ##
|
||||
#############################################################################
|
||||
RECENT_RELEASE_MERGES=$(git log --oneline -10 --grep="Merge.*release.*into.*develop" --grep="Merge.*release.*back.*develop" --grep="Bump.*version.*after.*release.*v" --since="3 days ago" || true)
|
||||
|
||||
#######################################################################
|
||||
## Also check if current version suggests we're ready for next cycle ##
|
||||
#######################################################################
|
||||
if [[ -n "$RECENT_RELEASE_MERGES" ]] || [[ "$CURRENT_VERSION" =~ -RC\.[0-9]+$ ]] || [[ "$CURRENT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
#########################################################################
|
||||
## We just merged a release or have an RC/stable version, bump to next ##
|
||||
#########################################################################
|
||||
NEW_VERSION="$MAJOR.$((MINOR + 1)).0-SNAPSHOT"
|
||||
else
|
||||
################################################################
|
||||
## Keep current SNAPSHOT version - no recent release activity ##
|
||||
################################################################
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
fi
|
||||
;;
|
||||
|
||||
"main")
|
||||
###############################################################################
|
||||
## Main should always have stable versions ##
|
||||
## Check for version tags to detect releases instead of merge commits ##
|
||||
###############################################################################
|
||||
echo "In Main - Looking for the most recent version tag"
|
||||
|
||||
# If we're on a tag, use that tag; otherwise find the latest tag
|
||||
if [[ "$CURRENT_BRANCH" == "main" && -n "$CURRENT_TAG" ]]; then
|
||||
LATEST_TAG="$CURRENT_TAG"
|
||||
echo "Using current tag: $LATEST_TAG"
|
||||
else
|
||||
LATEST_TAG=$(git describe --tags --abbrev=0 --match="v*" 2>/dev/null || echo "")
|
||||
echo "Found latest tag: $LATEST_TAG"
|
||||
fi
|
||||
|
||||
if [[ -n "$LATEST_TAG" ]]; then
|
||||
# Extract version from tag (e.g., v1.5.0 -> 1.5.0)
|
||||
if [[ "$LATEST_TAG" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
|
||||
TAG_VERSION=${BASH_REMATCH[1]}
|
||||
echo "Release tag: $LATEST_TAG (version: $TAG_VERSION)"
|
||||
|
||||
# Check if current version matches the tag
|
||||
if [[ "$CURRENT_VERSION" == "$TAG_VERSION" ]]; then
|
||||
################################################################
|
||||
## We're at the tagged release, keep stable version ##
|
||||
################################################################
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
echo "Version matches release tag, keeping stable version"
|
||||
elif [[ "$CURRENT_VERSION" =~ -RC\.[0-9]+$ ]]; then
|
||||
########################################################################
|
||||
## We have an RC version, convert to the tag version ##
|
||||
########################################################################
|
||||
NEW_VERSION="$TAG_VERSION"
|
||||
echo "Converting RC version to tag version: $NEW_VERSION"
|
||||
else
|
||||
#####################################################################
|
||||
## Keep current version (might be ahead of tag) ##
|
||||
#####################################################################
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
echo "Keeping current version (ahead of tag)"
|
||||
fi
|
||||
else
|
||||
echo "Warning: Tag format not recognized: $LATEST_TAG"
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
fi
|
||||
else
|
||||
#####################################################################
|
||||
## No tags found - main branch should always have a release tag ##
|
||||
#####################################################################
|
||||
echo "ERROR: No version tags found on main branch"
|
||||
echo "Main branch should always have a corresponding release tag (e.g., v1.5.0)"
|
||||
echo "Please create a release tag before deploying from main"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
release/*)
|
||||
############################################################################
|
||||
## Extract major.minor from branch name (e.g., release/1.5 -> 1.5.0-RC.n) ##
|
||||
############################################################################
|
||||
if [[ "$branch" =~ release/([0-9]+)\.([0-9]+) ]]; then
|
||||
BRANCH_MAJOR=${BASH_REMATCH[1]}
|
||||
BRANCH_MINOR=${BASH_REMATCH[2]}
|
||||
|
||||
############################################
|
||||
## Check if we already have an RC version ##
|
||||
############################################
|
||||
if [[ "$CURRENT_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)-RC\.([0-9]+)$ ]]; then
|
||||
################################################
|
||||
## Extract current RC number and increment it ##
|
||||
################################################
|
||||
CURRENT_RC=${BASH_REMATCH[4]}
|
||||
NEW_RC=$((CURRENT_RC + 1))
|
||||
NEW_VERSION="$BRANCH_MAJOR.$BRANCH_MINOR.0-RC.$NEW_RC"
|
||||
else
|
||||
###############################
|
||||
## First RC for this release ##
|
||||
###############################
|
||||
NEW_VERSION="$BRANCH_MAJOR.$BRANCH_MINOR.0-RC.1"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Invalid release branch format: $branch"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
hotfix/*)
|
||||
###################################
|
||||
## Bump patch version for hotfix ##
|
||||
###################################
|
||||
NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
|
||||
;;
|
||||
|
||||
feature/*|*)
|
||||
###############################################################
|
||||
## Feature branches inherit version from develop, no changes ##
|
||||
###############################################################
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#########################################
|
||||
## Function to set version using Maven ##
|
||||
@@ -237,7 +153,6 @@ set_version() {
|
||||
if [[ "$DRY_RUN" == "true" ]]; then
|
||||
echo "DRY RUN: Would set version to: $new_version"
|
||||
echo "Command: mvn versions:set-property -Dproperty=revision -DnewVersion=$new_version -DgenerateBackupPoms=false"
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -247,12 +162,11 @@ set_version() {
|
||||
## Use Maven versions plugin to set version ##
|
||||
##############################################
|
||||
mvn versions:set-property -Dproperty=revision -DnewVersion="$new_version" -DgenerateBackupPoms=false
|
||||
|
||||
|
||||
#######################
|
||||
## Verify the change ##
|
||||
#######################
|
||||
ACTUAL_VERSION=$(grep "<revision>" $POM_FILE | sed 's/.*<revision>//;s/<.*//')
|
||||
ACTUAL_VERSION=$(grep "<revision>" "$POM_FILE" | sed 's/.*<revision>//;s/<.*//')
|
||||
if [[ "$ACTUAL_VERSION" == "$new_version" ]]; then
|
||||
echo "✅ Version successfully updated to: $ACTUAL_VERSION"
|
||||
else
|
||||
@@ -261,6 +175,195 @@ set_version() {
|
||||
fi
|
||||
}
|
||||
|
||||
#############################################
|
||||
## Branch Detection and Routing Functions ##
|
||||
#############################################
|
||||
|
||||
detect_branch_type() {
|
||||
local branch=$1
|
||||
|
||||
if [[ "$branch" == "main" ]]; then
|
||||
echo "main"
|
||||
elif [[ "$branch" == "develop" ]]; then
|
||||
echo "develop"
|
||||
elif [[ "$branch" =~ ^release/ ]]; then
|
||||
echo "release"
|
||||
elif [[ "$branch" =~ ^hotfix/ ]]; then
|
||||
echo "hotfix"
|
||||
elif [[ "$branch" =~ ^feature/ ]]; then
|
||||
echo "feature"
|
||||
else
|
||||
echo "unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
#############################################
|
||||
## Branch-Specific Version Handlers ##
|
||||
#############################################
|
||||
|
||||
handle_main_branch() {
|
||||
echo "=== Handling MAIN branch ==="
|
||||
echo "Main branch should always have stable versions"
|
||||
echo "Looking for the most recent version tag"
|
||||
|
||||
# If we're on a tag, use that tag; otherwise find the latest tag
|
||||
local latest_tag=""
|
||||
if [[ -n "$CURRENT_TAG" ]]; then
|
||||
latest_tag="$CURRENT_TAG"
|
||||
echo "Using current tag: $latest_tag"
|
||||
else
|
||||
latest_tag=$(git describe --tags --abbrev=0 --match="v*" 2>/dev/null || echo "")
|
||||
echo "Found latest tag: $latest_tag"
|
||||
fi
|
||||
|
||||
if [[ -n "$latest_tag" ]]; then
|
||||
# Extract version from tag (e.g., v1.5.0 -> 1.5.0)
|
||||
if [[ "$latest_tag" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
|
||||
local tag_version=${BASH_REMATCH[1]}
|
||||
echo "Release tag: $latest_tag (version: $tag_version)"
|
||||
|
||||
# Check if current version matches the tag
|
||||
if [[ "$CURRENT_VERSION" == "$tag_version" ]]; then
|
||||
echo "Version matches release tag, keeping stable version"
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
elif [[ "$CURRENT_VERSION" =~ -RC\.[0-9]+$ ]]; then
|
||||
echo "Converting RC version to tag version: $tag_version"
|
||||
NEW_VERSION="$tag_version"
|
||||
else
|
||||
NEW_VERSION="$tag_version"
|
||||
fi
|
||||
else
|
||||
echo "Warning: Tag format not recognized: $latest_tag"
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: No version tags found on main branch"
|
||||
echo "Main branch should always have a corresponding release tag (e.g., v1.5.0)"
|
||||
echo "Please create a release tag before deploying from main"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
handle_develop_branch() {
|
||||
echo "=== Handling DEVELOP branch ==="
|
||||
echo "Develop branch manages SNAPSHOT versions"
|
||||
|
||||
# Check if we just merged a release branch back to develop
|
||||
local recent_release_merges
|
||||
recent_release_merges=$(git log --oneline -10 --grep="Merge.*release.*into.*develop" --grep="Merge.*release.*back.*develop" --grep="Bump.*version.*after.*release.*v" --since="3 days ago" || true)
|
||||
|
||||
# Also check if current version suggests we're ready for next cycle
|
||||
if [[ -n "$recent_release_merges" ]] || [[ "$CURRENT_VERSION" =~ -RC\.[0-9]+$ ]] || [[ "$CURRENT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Recent release activity detected or RC/stable version found"
|
||||
echo "Bumping to next minor version SNAPSHOT"
|
||||
NEW_VERSION="$MAJOR.$((MINOR + 1)).0-SNAPSHOT"
|
||||
else
|
||||
echo "No recent release activity, keeping current SNAPSHOT version"
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
fi
|
||||
}
|
||||
|
||||
handle_release_branch() {
|
||||
echo "=== Handling RELEASE branch ==="
|
||||
echo "Release branch manages RC versions"
|
||||
|
||||
# Extract major.minor from branch name (e.g., release/1.5 -> 1.5.0-RC.n)
|
||||
if [[ "$CURRENT_BRANCH" =~ release/([0-9]+)\.([0-9]+) ]]; then
|
||||
local branch_major=${BASH_REMATCH[1]}
|
||||
local branch_minor=${BASH_REMATCH[2]}
|
||||
|
||||
echo "Release branch: $branch_major.$branch_minor"
|
||||
|
||||
# Check if we already have an RC version
|
||||
if [[ "$CURRENT_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)-RC\.([0-9]+)$ ]]; then
|
||||
# Extract current RC number and increment it
|
||||
local current_rc=${BASH_REMATCH[4]}
|
||||
local new_rc=$((current_rc + 1))
|
||||
echo "Incrementing RC from $current_rc to $new_rc"
|
||||
NEW_VERSION="$branch_major.$branch_minor.0-RC.$new_rc"
|
||||
else
|
||||
# First RC for this release
|
||||
echo "Creating first RC for this release"
|
||||
NEW_VERSION="$branch_major.$branch_minor.0-RC.1"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Invalid release branch format: $CURRENT_BRANCH"
|
||||
echo "Expected format: release/X.Y (e.g., release/1.5)"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
handle_hotfix_branch() {
|
||||
echo "=== Handling HOTFIX branch ==="
|
||||
echo "Hotfix branch bumps patch version"
|
||||
|
||||
NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
|
||||
echo "Bumping patch version: $CURRENT_VERSION -> $NEW_VERSION"
|
||||
}
|
||||
|
||||
handle_feature_branch() {
|
||||
echo "=== Handling FEATURE branch ==="
|
||||
echo "Feature branches create unique SNAPSHOT versions"
|
||||
|
||||
# Extract feature name from branch (e.g., feature/new-feature -> new-feature)
|
||||
local feature_name
|
||||
if [[ "$CURRENT_BRANCH" =~ ^feature/(.+)$ ]]; then
|
||||
feature_name=${BASH_REMATCH[1]}
|
||||
else
|
||||
feature_name="unknown"
|
||||
fi
|
||||
|
||||
# Create safe abbreviation (first 3 characters, uppercase)
|
||||
local feature_abbrev
|
||||
feature_abbrev=$(echo "$feature_name" | cut -c1-100 | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# Generate short commit hash
|
||||
local commit_hash
|
||||
commit_hash=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
||||
|
||||
# Create unique SNAPSHOT version
|
||||
if [[ "$CURRENT_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)-SNAPSHOT$ ]]; then
|
||||
# Convert SNAPSHOT to feature-specific version
|
||||
local base_version=${BASH_REMATCH[1]}
|
||||
NEW_VERSION="$base_version-$feature_abbrev-$commit_hash-SNAPSHOT"
|
||||
echo "Creating feature-specific version: $NEW_VERSION"
|
||||
elif [[ "$CURRENT_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
|
||||
# Convert stable version to feature-specific SNAPSHOT
|
||||
NEW_VERSION="$CURRENT_VERSION-$feature_abbrev-$commit_hash-SNAPSHOT"
|
||||
echo "Converting stable version to feature-specific SNAPSHOT: $NEW_VERSION"
|
||||
else
|
||||
# Check if it's already a feature-specific format
|
||||
if [[ "$CURRENT_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)-([A-Z]{3})-([a-f0-9]{7})-SNAPSHOT$ ]]; then
|
||||
local base_version=${BASH_REMATCH[1]}
|
||||
local existing_abbrev=${BASH_REMATCH[2]}
|
||||
local existing_hash=${BASH_REMATCH[3]}
|
||||
|
||||
# Check if the commit hash has changed
|
||||
if [[ "$existing_hash" != "$commit_hash" ]]; then
|
||||
# Update to new commit hash
|
||||
NEW_VERSION="$base_version-$existing_abbrev-$commit_hash-SNAPSHOT"
|
||||
echo "Updating feature-specific version with new commit hash: $NEW_VERSION"
|
||||
else
|
||||
# Keep current version if commit hash hasn't changed
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
echo "Keeping current feature-specific version: $NEW_VERSION"
|
||||
fi
|
||||
else
|
||||
# Unknown format, keep as-is
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
echo "Keeping current version (unknown format): $NEW_VERSION"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
handle_unknown_branch() {
|
||||
echo "=== Handling UNKNOWN branch ==="
|
||||
echo "Unknown branch type, keeping current version"
|
||||
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
echo "Keeping current version: $NEW_VERSION"
|
||||
}
|
||||
|
||||
####################
|
||||
## Main execution ##
|
||||
####################
|
||||
@@ -278,9 +381,38 @@ main() {
|
||||
echo ""
|
||||
|
||||
############################
|
||||
## Calculate next version ##
|
||||
## Detect branch type and route ##
|
||||
############################
|
||||
calculate_next_version "$CURRENT_BRANCH"
|
||||
local branch_type
|
||||
branch_type=$(detect_branch_type "$CURRENT_BRANCH")
|
||||
echo "Detected branch type: $branch_type"
|
||||
echo ""
|
||||
|
||||
############################
|
||||
## Route to appropriate handler ##
|
||||
############################
|
||||
case "$branch_type" in
|
||||
"main")
|
||||
handle_main_branch
|
||||
;;
|
||||
"develop")
|
||||
handle_develop_branch
|
||||
;;
|
||||
"release")
|
||||
handle_release_branch
|
||||
;;
|
||||
"hotfix")
|
||||
handle_hotfix_branch
|
||||
;;
|
||||
"feature")
|
||||
handle_feature_branch
|
||||
;;
|
||||
*)
|
||||
handle_unknown_branch
|
||||
;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
echo "Calculated next version: $NEW_VERSION"
|
||||
echo ""
|
||||
|
||||
@@ -296,7 +428,7 @@ main() {
|
||||
###################
|
||||
echo ""
|
||||
echo "Changes made:"
|
||||
git diff $POM_FILE
|
||||
git diff "$POM_FILE"
|
||||
else
|
||||
echo "No version change needed. Current version is correct for branch: $CURRENT_BRANCH"
|
||||
fi
|
||||
|
||||
@@ -3,86 +3,255 @@
|
||||
############################################################################
|
||||
## create_github_release.sh
|
||||
## GitHub Release Creation Script
|
||||
##
|
||||
##
|
||||
## This script creates GitHub releases for production releases.
|
||||
## The Git tag should already exist from the version management process.
|
||||
## This script creates the corresponding GitHub release using the GitHub API.
|
||||
##
|
||||
## Process:
|
||||
## 1. Extracts version from pom.xml revision field
|
||||
## 2. Verifies the Git tag exists (should be created by version management)
|
||||
## 3. Creates GitHub release using GitHub API (no gh CLI required)
|
||||
## 4. Generates release notes from recent commits
|
||||
## 1. Extracts version from pom.xml or package.json
|
||||
## 2. Verifies the Git tag exists
|
||||
## 3. Creates GitHub release using GitHub API with auto-generated notes
|
||||
## 4. Adds artifact links to Maven Central and/or npmjs
|
||||
##
|
||||
## Usage: Called by CircleCI orb commands publish_release and publish_hotfix
|
||||
## Environment Variables:
|
||||
## GITHUB_TOKEN - Required: GitHub token with repo scope
|
||||
## PROJECT_TYPE - Optional: maven, node, or both (default: auto-detect)
|
||||
## DRY_RUN - Optional: Set to "true" to skip API calls
|
||||
## CIRCLE_PROJECT_USERNAME - CircleCI: GitHub org/user
|
||||
## CIRCLE_PROJECT_REPONAME - CircleCI: Repository name
|
||||
##
|
||||
## Usage: Called by CircleCI orb command publish_github_release
|
||||
## Output: Creates GitHub release for the existing tag
|
||||
############################################################################
|
||||
|
||||
set -e
|
||||
|
||||
##################################
|
||||
## Extract version from pom.xml ##
|
||||
##################################
|
||||
VERSION=$(grep '<revision>' pom.xml | sed 's/.*<revision>//;s/<.*//')
|
||||
###################
|
||||
## Configuration ##
|
||||
###################
|
||||
DRY_RUN="${DRY_RUN:-false}"
|
||||
REPO_OWNER="${CIRCLE_PROJECT_USERNAME:-}"
|
||||
REPO_NAME="${CIRCLE_PROJECT_REPONAME:-}"
|
||||
API_URL="https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases"
|
||||
|
||||
############################
|
||||
## Validate configuration ##
|
||||
############################
|
||||
if [[ -z "$GITHUB_TOKEN" ]]; then
|
||||
echo "ERROR: GITHUB_TOKEN environment variable is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$REPO_OWNER" ]] || [[ -z "$REPO_NAME" ]]; then
|
||||
echo "ERROR: CIRCLE_PROJECT_USERNAME and CIRCLE_PROJECT_REPONAME must be set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Repository: ${REPO_OWNER}/${REPO_NAME}"
|
||||
|
||||
###############################
|
||||
## Extract version from file ##
|
||||
###############################
|
||||
VERSION=""
|
||||
PROJECT_TYPE="${PROJECT_TYPE:-auto}"
|
||||
|
||||
# Auto-detect project type if not specified
|
||||
if [[ "$PROJECT_TYPE" == "auto" ]]; then
|
||||
if [[ -f "pom.xml" ]]; then
|
||||
PROJECT_TYPE="maven"
|
||||
elif [[ -f "package.json" ]]; then
|
||||
PROJECT_TYPE="node"
|
||||
else
|
||||
echo "ERROR: Cannot detect project type. No pom.xml or package.json found."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Project type: $PROJECT_TYPE"
|
||||
|
||||
# Extract version based on project type
|
||||
if [[ "$PROJECT_TYPE" == "maven" ]] || [[ "$PROJECT_TYPE" == "both" ]]; then
|
||||
if [[ -f "pom.xml" ]]; then
|
||||
VERSION=$(grep '<revision>' pom.xml | sed 's/.*<revision>//;s/<.*//' | head -1)
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
# Fallback to version tag if revision not found
|
||||
VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>//;s/<.*//')
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$VERSION" ]] && { [[ "$PROJECT_TYPE" == "node" ]] || [[ "$PROJECT_TYPE" == "both" ]]; }; then
|
||||
if [[ -f "package.json" ]]; then
|
||||
VERSION=$(jq -r '.version' package.json)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
echo "ERROR: Could not extract version from project files"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TAG_NAME="v$VERSION"
|
||||
echo "Creating GitHub release for tag: $TAG_NAME"
|
||||
echo "Version: $VERSION"
|
||||
echo "Tag: $TAG_NAME"
|
||||
|
||||
#######################################
|
||||
## Determine if this is a prerelease ##
|
||||
#######################################
|
||||
PRERELEASE="false"
|
||||
if [[ "$VERSION" =~ -RC\.[0-9]+$ ]] || [[ "$VERSION" =~ -SNAPSHOT$ ]] || [[ "$VERSION" =~ -alpha ]] || [[ "$VERSION" =~ -beta ]]; then
|
||||
PRERELEASE="true"
|
||||
echo "This is a prerelease version"
|
||||
fi
|
||||
|
||||
##########################################
|
||||
## Verify the tag exists (should be created by version management) ##
|
||||
## Verify the tag exists ##
|
||||
##########################################
|
||||
if ! git tag --list | grep -q "^$TAG_NAME$"; then
|
||||
echo "ERROR: Tag $TAG_NAME does not exist"
|
||||
echo "The tag should have been created by the version management process"
|
||||
exit 1
|
||||
# Also check for version- prefix format
|
||||
ALT_TAG="version-$VERSION"
|
||||
if git tag --list | grep -q "^$ALT_TAG$"; then
|
||||
TAG_NAME="$ALT_TAG"
|
||||
echo "Using alternate tag format: $TAG_NAME"
|
||||
else
|
||||
echo "ERROR: Tag $TAG_NAME does not exist"
|
||||
echo "The tag should have been created by the version management process"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Tag $TAG_NAME exists, proceeding with GitHub release creation"
|
||||
|
||||
##########################################
|
||||
## Generate release notes from commits ##
|
||||
##########################################
|
||||
echo "Generating release notes..."
|
||||
################################
|
||||
## Build artifact links ##
|
||||
################################
|
||||
ARTIFACT_SECTION=""
|
||||
|
||||
# Get the previous tag for comparison
|
||||
PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match="v*" HEAD~1 2>/dev/null || echo "")
|
||||
# Maven Central links
|
||||
if [[ "$PROJECT_TYPE" == "maven" ]] || [[ "$PROJECT_TYPE" == "both" ]]; then
|
||||
if [[ -f "pom.xml" ]]; then
|
||||
GROUP_ID=$(grep -m1 '<groupId>' pom.xml | sed 's/.*<groupId>//;s/<.*//')
|
||||
ARTIFACT_ID=$(grep -m1 '<artifactId>' pom.xml | sed 's/.*<artifactId>//;s/<.*//')
|
||||
|
||||
if [[ -n "$PREVIOUS_TAG" ]]; then
|
||||
echo "Comparing with previous release: $PREVIOUS_TAG"
|
||||
RELEASE_NOTES=$(git log --pretty=format:"- %s" "$PREVIOUS_TAG"..HEAD | head -20)
|
||||
else
|
||||
echo "No previous tag found, using recent commits"
|
||||
RELEASE_NOTES=$(git log --pretty=format:"- %s" -10)
|
||||
if [[ -n "$GROUP_ID" ]] && [[ -n "$ARTIFACT_ID" ]]; then
|
||||
MAVEN_URL="https://central.sonatype.com/artifact/${GROUP_ID}/${ARTIFACT_ID}/${VERSION}"
|
||||
ARTIFACT_SECTION="### Artifacts
|
||||
|
||||
**Maven Central:**
|
||||
- [${GROUP_ID}:${ARTIFACT_ID}:${VERSION}](${MAVEN_URL})"
|
||||
echo "Maven artifact: ${GROUP_ID}:${ARTIFACT_ID}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create a more detailed release notes
|
||||
FULL_NOTES="## Release $VERSION
|
||||
# NPM links
|
||||
if [[ "$PROJECT_TYPE" == "node" ]] || [[ "$PROJECT_TYPE" == "both" ]]; then
|
||||
if [[ -f "package.json" ]]; then
|
||||
NPM_PACKAGE=$(jq -r '.name' package.json)
|
||||
|
||||
### Changes
|
||||
$RELEASE_NOTES
|
||||
if [[ -n "$NPM_PACKAGE" ]] && [[ "$NPM_PACKAGE" != "null" ]]; then
|
||||
NPM_URL="https://www.npmjs.com/package/${NPM_PACKAGE}/v/${VERSION}"
|
||||
if [[ -n "$ARTIFACT_SECTION" ]]; then
|
||||
ARTIFACT_SECTION="${ARTIFACT_SECTION}
|
||||
|
||||
### Artifacts
|
||||
This release includes Maven artifacts published to Maven Central.
|
||||
**NPM:**
|
||||
- [${NPM_PACKAGE}@${VERSION}](${NPM_URL})"
|
||||
else
|
||||
ARTIFACT_SECTION="### Artifacts
|
||||
|
||||
**NPM:**
|
||||
- [${NPM_PACKAGE}@${VERSION}](${NPM_URL})"
|
||||
fi
|
||||
echo "NPM package: ${NPM_PACKAGE}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Add footer
|
||||
if [[ -n "$ARTIFACT_SECTION" ]]; then
|
||||
ARTIFACT_SECTION="${ARTIFACT_SECTION}
|
||||
|
||||
---
|
||||
*Automated release from CircleCI*"
|
||||
_Automated release via CircleCI_"
|
||||
fi
|
||||
|
||||
###########################
|
||||
## Create GitHub release ##
|
||||
###########################
|
||||
echo "Creating GitHub release for $TAG_NAME"
|
||||
|
||||
# Create the release using GitHub API
|
||||
curl -X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"tag_name\": \"$TAG_NAME\",
|
||||
\"name\": \"Release $VERSION\",
|
||||
\"body\": $(echo "$FULL_NOTES" | jq -Rs .),
|
||||
\"draft\": false,
|
||||
\"prerelease\": false
|
||||
}" \
|
||||
"https://api.github.com/repos/Kingsrook/qqq/releases"
|
||||
if [[ "$DRY_RUN" == "true" ]]; then
|
||||
echo "DRY RUN: Would create release with:"
|
||||
echo " Tag: $TAG_NAME"
|
||||
echo " Name: Release $VERSION"
|
||||
echo " Prerelease: $PRERELEASE"
|
||||
echo " Artifact section:"
|
||||
echo "$ARTIFACT_SECTION"
|
||||
echo "DRY RUN: Skipping API call"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "✅ GitHub release created successfully for $TAG_NAME"
|
||||
# Build the request body
|
||||
# Using generate_release_notes to auto-generate from PRs (respects .github/release.yml)
|
||||
REQUEST_BODY=$(jq -n \
|
||||
--arg tag "$TAG_NAME" \
|
||||
--arg name "Release $VERSION" \
|
||||
--arg body "$ARTIFACT_SECTION" \
|
||||
--argjson prerelease "$PRERELEASE" \
|
||||
'{
|
||||
tag_name: $tag,
|
||||
name: $name,
|
||||
body: $body,
|
||||
draft: false,
|
||||
prerelease: $prerelease,
|
||||
generate_release_notes: true
|
||||
}')
|
||||
|
||||
# Create the release with retry logic
|
||||
MAX_RETRIES=2
|
||||
RETRY_COUNT=0
|
||||
|
||||
while [[ $RETRY_COUNT -lt $MAX_RETRIES ]]; do
|
||||
HTTP_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$REQUEST_BODY" \
|
||||
"$API_URL")
|
||||
|
||||
HTTP_BODY=$(echo "$HTTP_RESPONSE" | sed '$d')
|
||||
HTTP_CODE=$(echo "$HTTP_RESPONSE" | tail -n1)
|
||||
|
||||
if [[ "$HTTP_CODE" -ge 200 ]] && [[ "$HTTP_CODE" -lt 300 ]]; then
|
||||
RELEASE_URL=$(echo "$HTTP_BODY" | jq -r '.html_url')
|
||||
echo "GitHub release created successfully: $RELEASE_URL"
|
||||
exit 0
|
||||
elif [[ "$HTTP_CODE" -ge 500 ]]; then
|
||||
echo "Server error (HTTP $HTTP_CODE), retrying..."
|
||||
RETRY_COUNT=$((RETRY_COUNT + 1))
|
||||
sleep 2
|
||||
elif [[ "$HTTP_CODE" == "422" ]]; then
|
||||
# Check if release already exists
|
||||
if echo "$HTTP_BODY" | grep -q "already_exists"; then
|
||||
echo "Release for $TAG_NAME already exists, skipping"
|
||||
exit 0
|
||||
else
|
||||
echo "ERROR: GitHub API returned HTTP $HTTP_CODE"
|
||||
echo "$HTTP_BODY"
|
||||
# Don't fail the build - artifacts are already published
|
||||
echo "WARNING: GitHub release creation failed, but artifacts are published"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
echo "ERROR: GitHub API returned HTTP $HTTP_CODE"
|
||||
echo "$HTTP_BODY"
|
||||
# Don't fail the build - artifacts are already published
|
||||
echo "WARNING: GitHub release creation failed, but artifacts are published"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
|
||||
echo "WARNING: GitHub release creation failed after $MAX_RETRIES retries"
|
||||
echo "Artifacts are published, continuing..."
|
||||
exit 0
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Install Java and Maven on Ubuntu machine executor
|
||||
# Uses Eclipse Temurin (AdoptOpenJDK successor) for reliable JDK installation
|
||||
# Optionally installs Node.js via NodeSource repository
|
||||
|
||||
JAVA_VERSION="${PARAM_JAVA_VERSION:-21}"
|
||||
INSTALL_NODE="${PARAM_INSTALL_NODE:-false}"
|
||||
NODE_VERSION="${PARAM_NODE_VERSION:-20}"
|
||||
|
||||
echo "Installing Java ${JAVA_VERSION} and Maven..."
|
||||
|
||||
# Add Eclipse Temurin repository
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq wget apt-transport-https gpg maven curl
|
||||
|
||||
# Add Temurin GPG key
|
||||
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo gpg --dearmor -o /usr/share/keyrings/adoptium.gpg
|
||||
|
||||
# Add repository
|
||||
echo "deb [signed-by=/usr/share/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
|
||||
|
||||
# Install Java
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq "temurin-${JAVA_VERSION}-jdk"
|
||||
|
||||
# Set JAVA_HOME
|
||||
JAVA_HOME="/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-amd64"
|
||||
echo "export JAVA_HOME=${JAVA_HOME}" >> "${BASH_ENV}"
|
||||
echo "export PATH=${JAVA_HOME}/bin:\$PATH" >> "${BASH_ENV}"
|
||||
|
||||
# Install Node.js if requested
|
||||
if [ "${INSTALL_NODE}" = "true" ]; then
|
||||
echo ""
|
||||
echo "Installing Node.js ${NODE_VERSION}..."
|
||||
curl -fsSL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | sudo -E bash -
|
||||
sudo apt-get install -y -qq nodejs
|
||||
echo ""
|
||||
echo "Node.js version:"
|
||||
node --version
|
||||
echo "npm version:"
|
||||
npm --version
|
||||
fi
|
||||
|
||||
# Verify installation
|
||||
echo ""
|
||||
echo "Java version:"
|
||||
java -version
|
||||
echo ""
|
||||
echo "Maven version:"
|
||||
mvn --version
|
||||
echo ""
|
||||
echo "Docker version:"
|
||||
docker --version
|
||||
echo ""
|
||||
echo "Installation completed successfully"
|
||||
@@ -27,7 +27,14 @@ if [[ -n "$(git status --porcelain pom.xml)" ]]; then
|
||||
NEW_VERSION=$(grep '<revision>' pom.xml | sed 's/.*<revision>//;s/<.*//')
|
||||
git add pom.xml
|
||||
git commit -m "Bump version to $NEW_VERSION [skip ci]"
|
||||
git push origin "HEAD:${CIRCLE_BRANCH}"
|
||||
|
||||
if [ -n "$CIRCLE_BRANCH" ]; then
|
||||
git push origin "HEAD:${CIRCLE_BRANCH}"
|
||||
else
|
||||
# Tag build: push to main (or your default branch)
|
||||
git push origin HEAD:main
|
||||
fi
|
||||
|
||||
echo "Version updated to: $NEW_VERSION and pushed"
|
||||
else
|
||||
echo "No version change needed"
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
# Calculate Version Script Test Suite
|
||||
|
||||
This directory contains comprehensive tests for the `calculate_version.sh` script.
|
||||
|
||||
## Test Files
|
||||
|
||||
- `test_calculate_version.sh` - Main test suite with comprehensive test cases
|
||||
- `run_tests.sh` - Test runner with different output modes
|
||||
- `README.md` - This documentation
|
||||
|
||||
## Running Tests
|
||||
|
||||
### Quick Test Run
|
||||
```bash
|
||||
./tests/run_tests.sh
|
||||
```
|
||||
|
||||
### Verbose Test Run
|
||||
```bash
|
||||
./tests/run_tests.sh --verbose
|
||||
```
|
||||
|
||||
### CI Mode (minimal output)
|
||||
```bash
|
||||
./tests/run_tests.sh --ci
|
||||
```
|
||||
|
||||
### Direct Test Suite
|
||||
```bash
|
||||
./tests/test_calculate_version.sh
|
||||
./tests/test_calculate_version.sh --verbose
|
||||
```
|
||||
|
||||
## Test Coverage
|
||||
|
||||
The test suite covers:
|
||||
|
||||
### Branch Types
|
||||
- **Main Branch**: Tests stable version handling, tag detection, RC conversion
|
||||
- **Develop Branch**: Tests SNAPSHOT version management, release detection
|
||||
- **Release Branch**: Tests RC version creation and incrementing
|
||||
- **Hotfix Branch**: Tests patch version bumping
|
||||
- **Feature Branch**: Tests version inheritance
|
||||
|
||||
### Edge Cases
|
||||
- Invalid branch formats
|
||||
- Unknown branch types
|
||||
- Missing tags on main branch
|
||||
- Various version formats (stable, SNAPSHOT, RC)
|
||||
|
||||
### Version Parsing
|
||||
- Standard versions: `1.0.0`
|
||||
- SNAPSHOT versions: `1.0.0-SNAPSHOT`
|
||||
- RC versions: `1.0.0-RC.1`, `1.0.0-RC.10`
|
||||
- Multi-digit versions: `10.20.30`
|
||||
|
||||
## Test Environment
|
||||
|
||||
The test suite:
|
||||
1. Creates a temporary test directory
|
||||
2. Initializes a test git repository
|
||||
3. Creates test pom.xml files with different versions
|
||||
4. Creates test branches and tags
|
||||
5. Runs the calculate_version.sh script
|
||||
6. Validates the output
|
||||
7. Cleans up test data
|
||||
|
||||
## Integration with Make
|
||||
|
||||
The tests are integrated into the Makefile and can be run with:
|
||||
```bash
|
||||
make test-scripts
|
||||
```
|
||||
|
||||
## Test Results
|
||||
|
||||
The test suite provides:
|
||||
- ✅ Pass/fail status for each test
|
||||
- 📊 Summary statistics
|
||||
- 🔍 Detailed output in verbose mode
|
||||
- 🚫 Clean exit codes for CI integration
|
||||
|
||||
## Adding New Tests
|
||||
|
||||
To add new test cases:
|
||||
|
||||
1. Add a new test function in `test_calculate_version.sh`
|
||||
2. Call `run_test` with appropriate parameters:
|
||||
```bash
|
||||
run_test "Test Name" "branch_name" "current_version" "expected_version" "tag_name"
|
||||
```
|
||||
3. Add the test function to the main execution flow
|
||||
4. Update this README if needed
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **Permission denied**: Make sure test scripts are executable
|
||||
```bash
|
||||
chmod +x tests/*.sh
|
||||
```
|
||||
|
||||
2. **Git not found**: Ensure git is installed and available in PATH
|
||||
|
||||
3. **Test failures**: Run with `--verbose` to see detailed output
|
||||
```bash
|
||||
./tests/run_tests.sh --verbose
|
||||
```
|
||||
|
||||
### Debug Mode
|
||||
|
||||
For debugging, you can run individual test functions by modifying the main function in `test_calculate_version.sh` to call only specific test functions.
|
||||
Executable
+91
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
################################################################
|
||||
## run_tests.sh ##
|
||||
## Test runner for calculate_version.sh script ##
|
||||
## ##
|
||||
## This script runs the comprehensive test suite and provides ##
|
||||
## different output formats for different use cases. ##
|
||||
## ##
|
||||
## Usage: ./run_tests.sh [--verbose] [--ci] ##
|
||||
################################################################
|
||||
set -e
|
||||
|
||||
###################
|
||||
## Configuration ##
|
||||
###################
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
TEST_SCRIPT="$SCRIPT_DIR/test_calculate_version.sh"
|
||||
VERBOSE=false
|
||||
CI_MODE=false
|
||||
|
||||
##################################
|
||||
## Parse command line arguments ##
|
||||
##################################
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--verbose)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
--ci)
|
||||
CI_MODE=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [--verbose] [--ci]"
|
||||
echo " --verbose Show detailed test output"
|
||||
echo " --ci CI mode (minimal output, exit codes for CI)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
####################
|
||||
## Main execution ##
|
||||
####################
|
||||
main() {
|
||||
echo "🧪 Running calculate_version.sh test suite..."
|
||||
|
||||
###############################
|
||||
## Verify test script exists ##
|
||||
###############################
|
||||
if [[ ! -f "$TEST_SCRIPT" ]]; then
|
||||
echo "❌ Test script not found: $TEST_SCRIPT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
###############
|
||||
## Run tests ##
|
||||
###############
|
||||
local test_args=""
|
||||
if [[ "$VERBOSE" == "true" ]]; then
|
||||
test_args="--verbose"
|
||||
fi
|
||||
|
||||
if [[ "$CI_MODE" == "true" ]]; then
|
||||
###############################################
|
||||
## CI mode: minimal output, focus on results ##
|
||||
###############################################
|
||||
echo "Running tests in CI mode..."
|
||||
if "$TEST_SCRIPT" $test_args > /tmp/test_output.log 2>&1; then
|
||||
echo "✅ All tests passed!"
|
||||
exit 0
|
||||
else
|
||||
echo "❌ Tests failed!"
|
||||
echo "Test output:"
|
||||
cat /tmp/test_output.log
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
###################################
|
||||
## Interactive mode: full output ##
|
||||
###################################
|
||||
"$TEST_SCRIPT" $test_args
|
||||
fi
|
||||
}
|
||||
|
||||
#######################
|
||||
## Run main function ##
|
||||
#######################
|
||||
main "$@"
|
||||
Executable
+581
@@ -0,0 +1,581 @@
|
||||
#!/bin/bash
|
||||
|
||||
#######################################################################
|
||||
## test_calculate_version.sh ##
|
||||
## Comprehensive test suite for calculate_version.sh script ##
|
||||
## ##
|
||||
## This test suite validates all branch types and edge cases for the ##
|
||||
## version calculation script. ##
|
||||
## ##
|
||||
## Usage: ./test_calculate_version.sh [--verbose] ##
|
||||
#######################################################################
|
||||
set -e
|
||||
|
||||
###################
|
||||
## Configuration ##
|
||||
###################
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
CALCULATE_VERSION_SCRIPT="$PROJECT_ROOT/src/scripts/calculate_version.sh"
|
||||
TEST_DIR="$PROJECT_ROOT/tests/test_data"
|
||||
VERBOSE=false
|
||||
|
||||
###################
|
||||
## Test counters ##
|
||||
###################
|
||||
TESTS_RUN=0
|
||||
TESTS_PASSED=0
|
||||
TESTS_FAILED=0
|
||||
|
||||
##################################
|
||||
## Parse command line arguments ##
|
||||
##################################
|
||||
if [[ "$1" == "--verbose" ]]; then
|
||||
VERBOSE=true
|
||||
fi
|
||||
|
||||
##############################
|
||||
## Test Framework Functions ##
|
||||
##############################
|
||||
|
||||
################################################
|
||||
## Create a temporary directory for test data ##
|
||||
################################################
|
||||
setup_test_environment() {
|
||||
echo "Setting up test environment..."
|
||||
|
||||
#################################################
|
||||
## Remove existing test directory if it exists ##
|
||||
#################################################
|
||||
if [[ -d "$TEST_DIR" ]]; then
|
||||
rm -rf "$TEST_DIR"
|
||||
fi
|
||||
|
||||
#################################
|
||||
## Create fresh test directory ##
|
||||
#################################
|
||||
mkdir -p "$TEST_DIR"
|
||||
|
||||
##################################
|
||||
## Create a test git repository ##
|
||||
##################################
|
||||
cd "$TEST_DIR"
|
||||
git init --quiet
|
||||
git config user.name "Test User"
|
||||
git config user.email "test@example.com"
|
||||
|
||||
echo "✅ Test environment ready"
|
||||
}
|
||||
|
||||
###############################
|
||||
## Clean up test environment ##
|
||||
###############################
|
||||
cleanup_test_environment() {
|
||||
echo "Cleaning up test environment..."
|
||||
cd "$PROJECT_ROOT"
|
||||
rm -rf "$TEST_DIR"
|
||||
echo "✅ Cleanup complete"
|
||||
}
|
||||
|
||||
################################
|
||||
## Create a test pom.xml file ##
|
||||
################################
|
||||
create_test_pom() {
|
||||
local version="$1"
|
||||
cat > "$TEST_DIR/pom.xml" << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>test-project</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<properties>
|
||||
<revision>$version</revision>
|
||||
</properties>
|
||||
</project>
|
||||
EOF
|
||||
}
|
||||
|
||||
##########################
|
||||
## Create a test branch ##
|
||||
##########################
|
||||
create_test_branch() {
|
||||
local branch_name="$1"
|
||||
local tag_name="$2"
|
||||
|
||||
cd "$TEST_DIR"
|
||||
|
||||
###############################
|
||||
## Create a commit if needed ##
|
||||
###############################
|
||||
if [[ -z "$(git log --oneline 2>/dev/null)" ]]; then
|
||||
echo "Initial commit" > README.md
|
||||
git add README.md
|
||||
git commit -m "Initial commit" --quiet
|
||||
fi
|
||||
|
||||
#############################
|
||||
## Create tag if specified ##
|
||||
#############################
|
||||
if [[ -n "$tag_name" ]]; then
|
||||
git tag -a "$tag_name" -m "Test tag $tag_name" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
################################
|
||||
## Handle special HEAD case ##
|
||||
################################
|
||||
if [[ "$branch_name" == "HEAD" ]]; then
|
||||
# For HEAD case, checkout the tag to simulate detached HEAD state
|
||||
if [[ -n "$tag_name" ]]; then
|
||||
git checkout "$tag_name" --quiet
|
||||
fi
|
||||
else
|
||||
# Create and checkout branch
|
||||
git checkout -b "$branch_name" 2>/dev/null || git checkout "$branch_name" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
#####################
|
||||
## Run a test case ##
|
||||
#####################
|
||||
run_test() {
|
||||
local test_name="$1"
|
||||
local branch_name="$2"
|
||||
local current_version="$3"
|
||||
local expected_version="$4"
|
||||
local tag_name="$5"
|
||||
|
||||
TESTS_RUN=$((TESTS_RUN + 1))
|
||||
|
||||
echo "🧪 Test: $test_name"
|
||||
|
||||
#####################
|
||||
## Setup test case ##
|
||||
#####################
|
||||
create_test_pom "$current_version"
|
||||
create_test_branch "$branch_name" "$tag_name"
|
||||
|
||||
####################
|
||||
## Run the script ##
|
||||
####################
|
||||
cd "$TEST_DIR"
|
||||
local output
|
||||
local exit_code=0
|
||||
|
||||
if [[ "$VERBOSE" == "true" ]]; then
|
||||
echo " Running: POM_FILE=pom.xml $CALCULATE_VERSION_SCRIPT --dry-run"
|
||||
fi
|
||||
|
||||
output=$(cd "$TEST_DIR" && POM_FILE=pom.xml "$CALCULATE_VERSION_SCRIPT" --dry-run 2>&1) || exit_code=$?
|
||||
|
||||
######################################
|
||||
## Check if script ran successfully ##
|
||||
######################################
|
||||
if [[ $exit_code -ne 0 ]]; then
|
||||
echo " ❌ FAILED: Script exited with code $exit_code"
|
||||
echo " Output: $output"
|
||||
TESTS_FAILED=$((TESTS_FAILED + 1))
|
||||
return 1
|
||||
fi
|
||||
|
||||
################################################
|
||||
## Extract the calculated version from output ##
|
||||
################################################
|
||||
local calculated_version
|
||||
calculated_version=$(echo "$output" | grep "Calculated next version:" | sed 's/.*: //')
|
||||
|
||||
#########################################################
|
||||
## Check if expected version contains wildcard pattern ##
|
||||
#########################################################
|
||||
if [[ "$expected_version" == *"*"* ]]; then
|
||||
#######################################
|
||||
## Convert wildcard pattern to regex ##
|
||||
#######################################
|
||||
local regex_pattern
|
||||
|
||||
# shellcheck disable=SC2001
|
||||
# Handle different wildcard patterns:
|
||||
# *-*-SNAPSHOT -> feature-name-commit-SNAPSHOT
|
||||
# *-SNAPSHOT -> commit-SNAPSHOT
|
||||
if [[ "$expected_version" == *-*-SNAPSHOT ]]; then
|
||||
# Pattern: 1.4.0-*-*-SNAPSHOT -> 1.4.0-[feature-name]-[commit]-SNAPSHOT
|
||||
regex_pattern=$(echo "$expected_version" | sed 's/\*/[a-zA-Z0-9-]+/g')
|
||||
else
|
||||
# Pattern: 1.4.0-*-SNAPSHOT -> 1.4.0-[commit]-SNAPSHOT
|
||||
regex_pattern=$(echo "$expected_version" | sed 's/\*/[a-f0-9]+/g')
|
||||
fi
|
||||
|
||||
if [[ "$calculated_version" =~ ^$regex_pattern$ ]]; then
|
||||
echo " ✅ PASSED: Expected pattern $expected_version, got $calculated_version"
|
||||
TESTS_PASSED=$((TESTS_PASSED + 1))
|
||||
return 0
|
||||
else
|
||||
echo " ❌ FAILED: Expected pattern $expected_version, got $calculated_version"
|
||||
if [[ "$VERBOSE" == "true" ]]; then
|
||||
echo " Full output:"
|
||||
# Add indentation to each line
|
||||
while IFS= read -r line; do
|
||||
echo " $line"
|
||||
done <<< "$output"
|
||||
fi
|
||||
TESTS_FAILED=$((TESTS_FAILED + 1))
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
#################
|
||||
## Exact match ##
|
||||
#################
|
||||
if [[ "$calculated_version" == "$expected_version" ]]; then
|
||||
echo " ✅ PASSED: Expected $expected_version, got $calculated_version"
|
||||
TESTS_PASSED=$((TESTS_PASSED + 1))
|
||||
return 0
|
||||
else
|
||||
echo " ❌ FAILED: Expected $expected_version, got $calculated_version"
|
||||
if [[ "$VERBOSE" == "true" ]]; then
|
||||
echo " Full output:"
|
||||
# Add indentation to each line
|
||||
while IFS= read -r line; do
|
||||
echo " $line"
|
||||
done <<< "$output"
|
||||
fi
|
||||
TESTS_FAILED=$((TESTS_FAILED + 1))
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
## Print test summary ##
|
||||
########################
|
||||
print_summary() {
|
||||
echo ""
|
||||
echo "=== Test Summary ==="
|
||||
echo "Tests run: $TESTS_RUN"
|
||||
echo "Tests passed: $TESTS_PASSED"
|
||||
echo "Tests failed: $TESTS_FAILED"
|
||||
|
||||
if [[ $TESTS_FAILED -eq 0 ]]; then
|
||||
echo "🎉 All tests passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ Some tests failed!"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
################
|
||||
## Test Cases ##
|
||||
################
|
||||
|
||||
################################
|
||||
## Test main branch scenarios ##
|
||||
################################
|
||||
test_main_branch() {
|
||||
echo ""
|
||||
echo "=== Testing MAIN Branch ==="
|
||||
|
||||
###########################################
|
||||
## Test 1: Main branch with matching tag ##
|
||||
###########################################
|
||||
run_test "Main branch with matching tag" "main" "1.5.0" "1.5.0" "v1.5.0"
|
||||
|
||||
#################################################
|
||||
## Test 2: Main branch with RC version and tag ##
|
||||
#################################################
|
||||
run_test "Main branch with RC version" "main" "1.5.0-RC.1" "1.5.0" "v1.5.0"
|
||||
|
||||
#######################################################
|
||||
## Test 3: Main branch with SNAPSHOT version and tag ##
|
||||
#######################################################
|
||||
run_test "Main branch with SNAPSHOT version" "main" "1.5.0-SNAPSHOT" "1.5.0" "v1.5.0"
|
||||
|
||||
#############################################
|
||||
## Test 4: Main branch on tag (HEAD state) ##
|
||||
#############################################
|
||||
run_test "Main branch on tag (HEAD)" "HEAD" "1.5.0" "1.5.0" "v1.5.0"
|
||||
|
||||
############################################################
|
||||
## Test 5: Main branch with v-prefixed version in pom.xml ##
|
||||
############################################################
|
||||
run_test "Main branch with v-prefixed version" "main" "v0.2.1" "0.2.1" "v0.2.1"
|
||||
}
|
||||
|
||||
###################################
|
||||
## Test develop branch scenarios ##
|
||||
###################################
|
||||
test_develop_branch() {
|
||||
echo ""
|
||||
echo "=== Testing DEVELOP Branch ==="
|
||||
|
||||
#######################################################################
|
||||
## Test 1: Develop branch with SNAPSHOT version (no recent activity) ##
|
||||
#######################################################################
|
||||
run_test "Develop branch - no recent activity" "develop" "1.5.0-SNAPSHOT" "1.5.0-SNAPSHOT" ""
|
||||
|
||||
##########################################################
|
||||
## Test 2: Develop branch with RC version (should bump) ##
|
||||
##########################################################
|
||||
run_test "Develop branch with RC version" "develop" "1.5.0-RC.1" "1.6.0-SNAPSHOT" ""
|
||||
|
||||
##############################################################
|
||||
## Test 3: Develop branch with stable version (should bump) ##
|
||||
##############################################################
|
||||
run_test "Develop branch with stable version" "develop" "1.5.0" "1.6.0-SNAPSHOT" ""
|
||||
}
|
||||
|
||||
###################################
|
||||
## Test release branch scenarios ##
|
||||
###################################
|
||||
test_release_branch() {
|
||||
echo ""
|
||||
echo "=== Testing RELEASE Branch ==="
|
||||
|
||||
#######################################
|
||||
## Test 1: Release branch - first RC ##
|
||||
#######################################
|
||||
run_test "Release branch - first RC" "release/1.5" "1.5.0-SNAPSHOT" "1.5.0-RC.1" ""
|
||||
|
||||
###########################################
|
||||
## Test 2: Release branch - increment RC ##
|
||||
###########################################
|
||||
run_test "Release branch - increment RC" "release/1.5" "1.5.0-RC.1" "1.5.0-RC.2" ""
|
||||
|
||||
#####################################################
|
||||
## Test 3: Release branch - increment RC from RC.5 ##
|
||||
#####################################################
|
||||
run_test "Release branch - increment RC.5" "release/1.5" "1.5.0-RC.5" "1.5.0-RC.6" ""
|
||||
}
|
||||
|
||||
##################################
|
||||
## Test hotfix branch scenarios ##
|
||||
##################################
|
||||
test_hotfix_branch() {
|
||||
echo ""
|
||||
echo "=== Testing HOTFIX Branch ==="
|
||||
|
||||
########################################
|
||||
## Test 1: Hotfix branch - bump patch ##
|
||||
########################################
|
||||
run_test "Hotfix branch - bump patch" "hotfix/fix-bug" "1.5.0" "1.5.1" ""
|
||||
|
||||
################################################
|
||||
## Test 2: Hotfix branch - bump patch from RC ##
|
||||
################################################
|
||||
run_test "Hotfix branch - bump patch from RC" "hotfix/fix-bug" "1.5.0-RC.1" "1.5.1" ""
|
||||
}
|
||||
|
||||
###################################
|
||||
## Test feature branch scenarios ##
|
||||
###################################
|
||||
test_feature_branch() {
|
||||
echo ""
|
||||
echo "=== Testing FEATURE Branch ==="
|
||||
|
||||
###########################################################################
|
||||
## Test 1: Feature branch - convert SNAPSHOT to feature-specific version ##
|
||||
###########################################################################
|
||||
run_test "Feature branch - convert SNAPSHOT to feature-specific version" "feature/new-feature" "1.5.0-SNAPSHOT" "1.5.0-new-feature-*-SNAPSHOT" ""
|
||||
|
||||
##################################################################################
|
||||
## Test 2: Feature branch - convert stable version to feature-specific SNAPSHOT ##
|
||||
##################################################################################
|
||||
run_test "Feature branch - convert stable version to feature-specific SNAPSHOT" "feature/user-auth" "1.5.0" "1.5.0-user-auth-*-SNAPSHOT" ""
|
||||
|
||||
############################################################################################
|
||||
## Test 3: Feature branch - update existing feature-specific version with new commit hash ##
|
||||
############################################################################################
|
||||
run_test "Feature branch - update existing feature-specific version" "feature/existing-feature" "1.5.0-SNAPSHOT" "1.5.0-existing-feature-*-SNAPSHOT" ""
|
||||
|
||||
############################################################################################
|
||||
## Test 4: Feature branch - parse existing long feature-specific version ##
|
||||
############################################################################################
|
||||
run_test "Feature branch - parse existing long feature-specific version" "feature/test-new-orb" "1.4.0-test-new-orb-825957d-SNAPSHOT" "1.4.0-test-new-orb-*-SNAPSHOT" ""
|
||||
}
|
||||
|
||||
####################################
|
||||
## Test publish tag scenarios ##
|
||||
####################################
|
||||
test_publish_tag() {
|
||||
echo ""
|
||||
echo "=== Testing PUBLISH Tag Scenarios ==="
|
||||
|
||||
###########################################################################
|
||||
## Test 1: Publish tag - convert SNAPSHOT to feature-specific version ##
|
||||
## Note: Will use actual feature branch name found in git log ##
|
||||
###########################################################################
|
||||
run_test "Publish tag - convert SNAPSHOT to feature-specific version" "HEAD" "1.4.0-SNAPSHOT" "1.4.0-*-*-SNAPSHOT" "publish-825957d"
|
||||
|
||||
##################################################################################
|
||||
## Test 2: Publish tag - convert stable version to feature-specific SNAPSHOT ##
|
||||
## Note: Will use actual feature branch name found in git log ##
|
||||
##################################################################################
|
||||
run_test "Publish tag - convert stable version to feature-specific SNAPSHOT" "HEAD" "1.4.0" "1.4.0-*-*-SNAPSHOT" "publish-abc1234"
|
||||
|
||||
############################################################################################
|
||||
## Test 3: Publish tag - update existing feature-specific version with new commit hash ##
|
||||
############################################################################################
|
||||
run_test "Publish tag - update existing feature-specific version" "HEAD" "1.4.0-test-feature-1234567-SNAPSHOT" "1.4.0-test-feature-*-SNAPSHOT" "publish-def5678"
|
||||
|
||||
############################################################################################
|
||||
## Test 4: Publish tag with different commit hash format ##
|
||||
## Note: Will use actual feature branch name found in git log ##
|
||||
############################################################################################
|
||||
run_test "Publish tag - different commit hash format" "HEAD" "1.5.0-SNAPSHOT" "1.5.0-*-*-SNAPSHOT" "publish-9a8b7c6"
|
||||
}
|
||||
|
||||
#####################
|
||||
## Test edge cases ##
|
||||
#####################
|
||||
test_edge_cases() {
|
||||
echo ""
|
||||
echo "=== Testing Edge Cases ==="
|
||||
|
||||
#########################################################
|
||||
## Test 1: Invalid release branch format (should fail) ##
|
||||
#########################################################
|
||||
echo "🧪 Test: Invalid release branch format (should fail)"
|
||||
TESTS_RUN=$((TESTS_RUN + 1))
|
||||
|
||||
create_test_pom "1.5.0-SNAPSHOT"
|
||||
create_test_branch "release/invalid" ""
|
||||
|
||||
cd "$TEST_DIR"
|
||||
local output
|
||||
local exit_code=0
|
||||
|
||||
output=$(cd "$TEST_DIR" && POM_FILE=pom.xml "$CALCULATE_VERSION_SCRIPT" --dry-run 2>&1) || exit_code=$?
|
||||
|
||||
if [[ $exit_code -ne 0 ]]; then
|
||||
echo " ✅ PASSED: Script correctly failed with invalid release branch format"
|
||||
TESTS_PASSED=$((TESTS_PASSED + 1))
|
||||
else
|
||||
echo " ❌ FAILED: Script should have failed with invalid release branch format"
|
||||
TESTS_FAILED=$((TESTS_FAILED + 1))
|
||||
fi
|
||||
|
||||
#################################
|
||||
## Test 2: Unknown branch type ##
|
||||
#################################
|
||||
run_test "Unknown branch type" "unknown-branch" "1.5.0-SNAPSHOT" "1.5.0-SNAPSHOT" ""
|
||||
|
||||
####################################################
|
||||
## Test 3: Main branch with no tags (should fail) ##
|
||||
####################################################
|
||||
echo "🧪 Test: Main branch with no tags (should fail)"
|
||||
TESTS_RUN=$((TESTS_RUN + 1))
|
||||
|
||||
create_test_pom "1.5.0-SNAPSHOT"
|
||||
create_test_branch "main" "" # No tag
|
||||
|
||||
cd "$TEST_DIR"
|
||||
output=$(cd "$TEST_DIR" && POM_FILE=pom.xml "$CALCULATE_VERSION_SCRIPT" --dry-run 2>&1) || exit_code=$?
|
||||
|
||||
if [[ $exit_code -ne 0 ]]; then
|
||||
echo " ✅ PASSED: Script correctly failed with no tags on main branch"
|
||||
TESTS_PASSED=$((TESTS_PASSED + 1))
|
||||
else
|
||||
echo " ❌ FAILED: Script should have failed with no tags on main branch"
|
||||
TESTS_FAILED=$((TESTS_FAILED + 1))
|
||||
fi
|
||||
}
|
||||
|
||||
##########################
|
||||
## Test version parsing ##
|
||||
##########################
|
||||
test_version_parsing() {
|
||||
echo ""
|
||||
echo "=== Testing Version Parsing ==="
|
||||
|
||||
##################################
|
||||
## Test various version formats ##
|
||||
##################################
|
||||
local test_versions=(
|
||||
"1.0.0"
|
||||
"1.0.0-SNAPSHOT"
|
||||
"1.0.0-RC.1"
|
||||
"1.0.0-RC.10"
|
||||
"10.20.30"
|
||||
"10.20.30-SNAPSHOT"
|
||||
"10.20.30-RC.5"
|
||||
"v1.0.0"
|
||||
"v1.0.0-SNAPSHOT"
|
||||
"v1.0.0-RC.1"
|
||||
"v10.20.30"
|
||||
)
|
||||
|
||||
for version in "${test_versions[@]}"; do
|
||||
echo "🧪 Testing version parsing: $version"
|
||||
|
||||
##################################################################
|
||||
## Create a simple test to verify version parsing doesn't crash ##
|
||||
##################################################################
|
||||
create_test_pom "$version"
|
||||
create_test_branch "main" ""
|
||||
|
||||
cd "$TEST_DIR"
|
||||
local output
|
||||
local exit_code=0
|
||||
|
||||
output=$(cd "$TEST_DIR" && POM_FILE=pom.xml "$CALCULATE_VERSION_SCRIPT" --dry-run 2>&1) || exit_code=$?
|
||||
|
||||
if [[ $exit_code -eq 0 ]]; then
|
||||
echo " ✅ PASSED: Version $version parsed successfully"
|
||||
TESTS_PASSED=$((TESTS_PASSED + 1))
|
||||
else
|
||||
echo " ❌ FAILED: Version $version parsing failed"
|
||||
echo " Output: $output"
|
||||
TESTS_FAILED=$((TESTS_FAILED + 1))
|
||||
fi
|
||||
|
||||
TESTS_RUN=$((TESTS_RUN + 1))
|
||||
done
|
||||
}
|
||||
|
||||
####################
|
||||
## Main execution ##
|
||||
####################
|
||||
main() {
|
||||
echo "=== QQQ Version Calculator Test Suite ==="
|
||||
echo "Testing script: $CALCULATE_VERSION_SCRIPT"
|
||||
echo ""
|
||||
|
||||
##########################
|
||||
## Verify script exists ##
|
||||
##########################
|
||||
if [[ ! -f "$CALCULATE_VERSION_SCRIPT" ]]; then
|
||||
echo "❌ Script not found: $CALCULATE_VERSION_SCRIPT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
############################
|
||||
## Setup test environment ##
|
||||
############################
|
||||
setup_test_environment
|
||||
|
||||
#########################
|
||||
## Run all test suites ##
|
||||
#########################
|
||||
test_main_branch
|
||||
test_develop_branch
|
||||
test_release_branch
|
||||
test_hotfix_branch
|
||||
test_feature_branch
|
||||
test_publish_tag
|
||||
test_edge_cases
|
||||
test_version_parsing
|
||||
|
||||
##############################
|
||||
## Cleanup and show results ##
|
||||
##############################
|
||||
cleanup_test_environment
|
||||
print_summary
|
||||
}
|
||||
|
||||
#######################
|
||||
## Run main function ##
|
||||
#######################
|
||||
main "$@"
|
||||
Reference in new issue
Block a user