CI/CD templates for the MAAP (Multi-Mission Algorithm and Analysis Platform) including GitLab CI/CD pipeline templates for building and deploying OGC Application Packages to HySDS, and GitHub Actions workflows for repository management.
This repository provides reusable CI/CD templates for both GitLab and GitHub:
- build-ogc-app-pack.yml - Builds Docker images from algorithm repositories and generates OGC-compliant CWL workflow files
- deploy-ogc-hysds.yml - Converts and deploys OGC Application Packages to HySDS infrastructure
- gitflow-validation.yml - Enforces GitFlow branching rules on pull requests
Add this template to build Docker images and generate CWL files:
include:
- remote: 'https://raw.githubusercontent.com/MAAP-Project/maap-ci-templates/main/gitlab/build-ogc-app-pack.yml'Add this template to deploy existing OGC packages:
Add this template to build Docker images and generate CWL files:
include:
- remote: 'https://raw.githubusercontent.com/MAAP-Project/maap-ci-templates/main/gitlab/build-ogc-app-pack.yml'Add this template to deploy existing OGC packages:
include:
- remote: 'https://raw.githubusercontent.com/MAAP-Project/maap-ci-templates/main/gitlab/deploy-ogc-hysds.yml'Add this reusable workflow to validate GitFlow rules on pull requests in your GitHub repository. Create or update .github/workflows/pr-validation.yml:
name: Pull Request Validation
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
gitflow-validation:
name: Validate GitFlow Rules
uses: MAAP-Project/maap-ci-templates/.github/workflows/gitflow-validation.yml@mainThis workflow enforces standard GitFlow branching patterns:
feature/*βdevelopbugfix/*βdeveloporrelease/*developβrelease/*release/*βmainordevelophotfix/*βmainmainβdevelop
For detailed usage and configuration options, see the GitFlow Validation Documentation below.
The build pipeline consists of two stages:
-
Build - Builds Docker image from algorithm repository
- Uses Docker-in-Docker (dind) service
- Clones algorithm repository at specified branch
- Builds Docker image with configurable base image and build command
- Pushes image to OGC Application Package registry
- Authenticates using deploy token
-
Generate - Generates OGC Application Package CWL file
- Uses algorithm configuration (base64-encoded JSON)
- Generates CWL workflow using ogc-app-pack-generator
- Publishes CWL file to configured endpoint via GitLab API
- Creates or updates CWL file using POST/PUT requests
The build pipeline consists of two stages:
-
Build - Builds Docker image from algorithm repository
- Uses Docker-in-Docker (dind) service
- Clones algorithm repository at specified branch
- Builds Docker image with configurable base image and build command
- Pushes image to OGC Application Package registry
- Authenticates using deploy token
-
Generate - Generates OGC Application Package CWL file
- Uses algorithm configuration (base64-encoded JSON)
- Generates CWL workflow using ogc-app-pack-generator
- Publishes CWL file to configured endpoint via GitLab API
- Creates or updates CWL file using POST/PUT requests
The deployment pipeline consists of four stages:
- Validate - Downloads and validates OGC Application Package CWL files against OGC standards
- Download Artifacts - Manages Docker image artifacts via local S3-backed registry
- Convert to HySDS - Converts OGC CWL specifications to HySDS format
- Deploy to HySDS - Deploys the converted specifications to HySDS infrastructure
IMAGE_NAME- Name for the Docker image (e.g., "my-algorithm")IMAGE_TAG- Tag for the Docker image (e.g., "v1.0.0")OGC_APP_PACK_REGISTRY- Docker registry URL for OGC Application PackagesOGC_APP_PACK_DEPLOY_TOKEN- Authentication token for registry accessREPOSITORY_URL- Git repository URL containing the algorithm codeBRANCH_REF- Branch or tag reference to clone from repositoryBUILD_CMD- Command to execute for building the algorithm (e.g., "./build.sh")BASE_IMAGE_NAME- Base Docker image to use (default: condaforge/miniforge3:25.3.1-0)ALGO_CONFIG_JSON_B64- Base64-encoded JSON configuration for algorithmOGC_PROCESS_FILE_PUBLISH_URL- GitLab API URL to publish the generated CWL fileOGC_APP_PACK_WRITE_TOKEN- GitLab API token with write permissions
IMAGE_NAME- Name for the Docker image (e.g., "my-algorithm")IMAGE_TAG- Tag for the Docker image (e.g., "v1.0.0")OGC_APP_PACK_REGISTRY- Docker registry URL for OGC Application PackagesOGC_APP_PACK_DEPLOY_TOKEN- Authentication token for registry accessREPOSITORY_URL- Git repository URL containing the algorithm codeBRANCH_REF- Branch or tag reference to clone from repositoryBUILD_CMD- Command to execute for building the algorithm (e.g., "./build.sh")BASE_IMAGE_NAME- Base Docker image to use (default: condaforge/miniforge3:25.3.1-0)ALGO_CONFIG_JSON_B64- Base64-encoded JSON configuration for algorithmOGC_PROCESS_FILE_PUBLISH_URL- GitLab API URL to publish the generated CWL fileOGC_APP_PACK_WRITE_TOKEN- GitLab API token with write permissions
Configure these in your GitLab CI/CD settings:
HYSDS_DOCKER_REGISTRY- Target HySDS Docker registry URLMAAP_CODE_BUCKET- S3 bucket for storing artifacts and CWL filesS3_REGION- S3 region (default: us-west-2)CWL_URL: URL to the OGC Application Package CWL file to deploy (use this OR PROCESS, not both)PROCESS: Base64-encoded CWL file content (use this OR CWL_URL, not both)PROCESS_NAME_HYSDS- Name to use for the HySDS job specification
MAAP_OGC_EXECUTOR_CONTAINER_NAME- Name of the MAAP OGC executor containerMAAP_OGC_EXECUTOR_CONTAINER_VERSION- Version of the MAAP OGC executor containerMAAP_OGC_EXECUTOR_CONTAINER_URL- Full URL to the MAAP OGC executor container imageMAAP_PRIVATE_DOCKER_REGISTRY- Private Docker registry URL for MAAP imagesMAAP_PRIVATE_REGISTRY_TOKEN- Authentication token for private registry access
MOZART_REST_URL- HySDS Mozart REST API endpointSTORAGE- Storage backend URL for HySDSGRQ_REST_URL- HySDS GRQ (General Request Queue) REST API endpoint
The pipeline supports two methods for providing the OGC Application Package:
Set the CWL_URL variable to point to a publicly accessible CWL file:
variables:
CWL_URL: "https://raw.githubusercontent.com/grallewellyn/cwl-files/refs/heads/main/cwl1.cwl"Set the PROCESS variable to a base64-encoded CWL file content. This is useful when the CWL is generated dynamically, stored in a database, or passed through an API.
Example Python client that reads a CWL file and passes it to the API:
import base64
# Read CWL file
with open('path/to/process.cwl', 'r') as f:
cwl_content = f.read()
# Base64 encode the content
process_base64 = base64.b64encode(cwl_content.encode()).decode()
# Pass process_base64 to your API
# The API should then set this as the PROCESS variable in GitLab CI/CDThe pipeline will automatically decode the base64 content back to CWL format.
Then set in GitLab CI/CD variables (typically via API):
variables:
PROCESS: "Y3dsVmVyc2lvbjogdjEuMApjbGFzcz... (base64 encoded content)"Important: Only provide ONE of CWL_URL or PROCESS. The pipeline will fail if both or neither are set.
- docker runners with Docker-in-Docker (dind) support
- Access to Docker registry for pushing images
- GitLab container registry credentials
- docker runners with Docker-in-Docker (dind) support
- Access to Docker registry for pushing images
- GitLab container registry credentials
- docker runners - For validation and conversion stages (Python 3.12 environment)
- shell runners - For download and deployment stages (must have Docker daemon access and AWS credentials)
- Automated Docker image building from algorithm repositories
- Configurable base images (default: condaforge/miniforge3)
- Shallow git cloning for faster builds
- OGC CWL workflow generation from algorithm configuration
- Automatic CWL publishing to configured endpoints via GitLab API
- Manual and API-triggered pipelines with rule-based execution
- Automated Docker image building from algorithm repositories
- Configurable base images (default: condaforge/miniforge3)
- Shallow git cloning for faster builds
- OGC CWL workflow generation from algorithm configuration
- Automatic CWL publishing to configured endpoints via GitLab API
- Manual and API-triggered pipelines with rule-based execution
- OGC Application Package validation using
ogc_ap_validator - Automated version extraction from CWL
s:versionfield - Docker image retagging and registry migration
- Digest-based push verification with automatic retry on failure
- Digest-based push verification with automatic retry on failure
- HySDS specification generation via
hysds-ogc-container-builder - Self-contained deployment with inline scripts for portability
- Absolute path handling for reliable artifact passing between stages
- Absolute path handling for reliable artifact passing between stages
- Pip dependency caching between pipeline runs
- Shallow git clones (
--depth 1) for faster repository checkout - Conditional Docker pulls (only if not cached locally)
- Early validation to fail fast on errors
- Direct registry URLs instead of tar files for faster deployment
- Optimized Docker digest comparison for reliable push verification
- Optimized Docker digest comparison for reliable push verification
image.env- Dotenv artifact containingFULLY_QUALIFIED_IMAGE_URLcwl_workflows/*- Generated CWL workflow filesalgo_config.yaml- Parsed algorithm configuration in YAML format
image.env- Dotenv artifact containingFULLY_QUALIFIED_IMAGE_URLcwl_workflows/*- Generated CWL workflow filesalgo_config.yaml- Parsed algorithm configuration in YAML format
- CWL file (renamed with version tag)
docker_url.txt- Registry URL of the pushed Docker imagehysds-io.json*- HySDS input/output specificationjob-spec.json*- HySDS job specificationbuild.env- Environment variables passed via dotenv
CWL files are renamed to: ${PROCESS_NAME_HYSDS}.${TAG}.process.cwl where TAG is extracted from the s:version: field in the CWL file.
- ogc-app-pack-generator - OGC CWL workflow generator
condaforge/miniforge3:25.3.1-0- Default base image- Docker registry v2
- GitLab API for CWL file publishing
- ogc-app-pack-generator - OGC CWL workflow generator
condaforge/miniforge3:25.3.1-0- Default base image- Docker registry v2
- GitLab API for CWL file publishing
- ogc_ap_validator v0.5.0 - OGC Application Package validation
- hysds-ogc-container-builder - HySDS specification generator
hysds/verdi:v5.2.0- HySDS deployment container- Docker registry v2
The GitFlow validation workflow enforces standard GitFlow branching patterns on pull requests to maintain a consistent branching strategy across your repositories.
- Automatic PR validation: Runs automatically on pull request creation and updates
- GitFlow enforcement: Validates source and target branch combinations against GitFlow rules
- Clear feedback: Provides detailed error messages showing allowed branch combinations
- Reusable workflow: Easily integrate into any GitHub repository
- Extensible: Support for custom branch patterns (future enhancement)
The workflow enforces these standard GitFlow patterns:
| Source Branch | Target Branch | Purpose |
|---|---|---|
feature/* |
develop |
New features merge into development |
bugfix/* |
develop |
Bug fixes for next release |
bugfix/* |
release/* |
Bug fixes during release stabilization |
develop |
release/* |
Create new release from development |
release/* |
main |
Deploy stable release to production |
release/* |
develop |
Merge release changes back to development |
hotfix/* |
main |
Emergency fixes to production |
main |
develop |
Sync production hotfixes back to development |
- Create
.github/workflows/pr-validation.ymlin your repository:
name: Pull Request Validation
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
gitflow-validation:
name: Validate GitFlow Rules
uses: MAAP-Project/maap-ci-templates/.github/workflows/gitflow-validation.yml@main- Commit and push the workflow file
- All future pull requests will be validated automatically
For production stability, pin to a specific version or tag:
jobs:
gitflow-validation:
uses: MAAP-Project/maap-ci-templates/.github/workflows/[email protected]Combine with GitHub branch protection rules for maximum effectiveness:
- Go to your repository Settings β Branches
- Add branch protection rule for
mainanddevelop - Enable "Require status checks to pass before merging"
- Select "Validate GitFlow Rules" as a required check
This prevents merges that violate GitFlow rules.
The workflow supports optional configuration:
jobs:
gitflow-validation:
uses: MAAP-Project/maap-ci-templates/.github/workflows/gitflow-validation.yml@main
with:
custom_allowed_patterns: |
- pattern: "custom/*"
target: "develop"Note: Custom pattern support is reserved for future implementation.
Successful validation:
π Validating PR: feature/add-user-auth β develop
β
Feature branch merging into develop β OK
Failed validation:
π Validating PR: feature/add-user-auth β main
β Invalid Git-Flow PR direction: feature/add-user-auth β main
Allowed combinations:
- feature/* β develop
- bugfix/* β develop
- bugfix/* β release/*
- develop β release/*
- release/* β main
- release/* β develop
- hotfix/* β main
- main β develop
Workflow not running:
- Ensure the workflow file is in
.github/workflows/directory - Verify the file has
.ymlor.yamlextension - Check that branch protection rules include the workflow as a required check
Validation failing unexpectedly:
- Verify your branch names match GitFlow patterns (e.g.,
feature/my-feature, notfeatures/my-feature) - Check that source and target branches are correct in the PR
- Review the workflow output for specific error messages
Custom patterns not working:
- Custom pattern support is planned for a future release
- For now, only standard GitFlow patterns are enforced
- Added build-ogc-app-pack.yml template: New template for building Docker images and generating OGC CWL files (commit 4c61ee4)
- Shallow git cloning: Uses
--depth 1 --single-branchfor faster algorithm repository checkout (commit 1d90320) - Inline Dockerfile generation: Builds Docker images with configurable base image, repository URL, branch, and build command
- Automated CWL publishing: Publishes generated CWL files to GitLab via API with POST/PUT fallback
- Rule-based execution: Supports both web UI and API triggers, blocks direct git push events
- Improved Docker push verification: Implemented digest-based verification by comparing local and registry digests instead of relying on
docker manifest inspect(commit 8238226, de88942) - Absolute path handling: Added
$CI_PROJECT_DIRprefix to all artifact paths for reliable artifact passing between stages in GitLab CI (commit b3ac036) - Artifact debugging: Added pre-script artifact listing in conversion and deployment stages to help diagnose issues (commit 34fe5ac)
- Updated converter call: Updated
cwl_to_hysdsinvocation to use the latest API with--docker-uriflag (commit e4a6306) - PYTHONPATH configuration: Explicitly set
PYTHONPATHfor converter module imports - Logging improvements: Removed colons from inline script echo statements to prevent GitLab CI collapsible section formatting issues (commit e5b0369, b635271)
- Build reliability: Fixed typos and improved error messages throughout the pipeline (commit e6eedcb)
[Add your license here]
For issues and questions, please open an issue in this repository.