Understanding CI/CD for Ignition Modules
Continuous Integration and Continuous Deployment (CI/CD) automates the building, testing, and releasing of your Ignition modules. Let's understand why each part matters and how it works.
Why CI/CD?
CI/CD provides several benefits for Ignition module development:
- Quality Assurance: Automatically test every change
- Consistency: Every build follows the same process
- Automation: Reduce manual steps and potential errors
- Validation: Ensure changes don't break the build
Pipeline Structure
Our CI/CD pipeline has two main workflows:
Pull Request Validation
Pull request validation ensures code quality before merging:
name: Build PRs
on: pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 17
cache: "gradle"
- name: Build
run: ./gradlew build
This workflow:
- Triggers on every pull request
- Sets up Java for building
- Builds the module to verify compilation
- Preserves the artifact for review
We use Java 17 because it's the current LTS version supported by Ignition 8.1+. This ensures compatibility with the target platform.
Release Automation
The release process is more complex because it involves signing and publishing:
name: Release
on:
push:
tags:
- "[0-9].[0-9].[0-9]" # Matches semantic versions
Key components explained:
-
Trigger Conditions:
- Activates on version tags (e.g., "1.0.0")
- Can be manually triggered for testing
-
Certificate Handling:
- name: Deserialize signing certs
run: |
echo "${{ secrets.CODE_SIGNING_CERT_BASE64 }}" | base64 --decode > cert.crt- Securely stores certificates as base64
- Decodes at build time
- Keeps sensitive data protected
-
Build and Sign:
- name: Build & Sign
run: >
./gradlew
-Pversion=${{ github.event.inputs.tag || github.ref_name }}
-PsignModule=true
build
signModule- Uses the tag as the version
- Enables module signing
- Creates the final .modl file
Secret Management
GitHub Secrets protect sensitive data:
Required secrets:
CODE_SIGNING_CERT_BASE64
: The certificate for signingCODE_SIGNING_KEYSTORE_BASE64
: Java keystore containing private keysCODE_SIGNING_CERT_PASSWORD
: Certificate passwordCODE_SIGNING_KEYSTORE_PASSWORD
: Keystore passwordCODE_SIGNING_CERT_ALIAS
: Certificate identifier in keystore
Never commit certificates or passwords to your repository. Always use repository secrets or secure environment variables.
Workflow Benefits
This setup provides several advantages:
-
Automation:
- No manual build steps
- Consistent process
- Reduced human error
-
Security:
- Protected credentials
- Secure signing process
- Controlled access
-
Quality:
- Automated validation
- Reproducible builds
- Version tracking
-
Efficiency:
- Quick feedback on PRs
- Automated releases
- Clear build history
Common Issues and Solutions
Build Failures
- Symptom: PR build fails
- Check:
- Build logs for errors
- Java version compatibility
- Dependencies resolution
Signing Issues
- Symptom: Release signing fails
- Check:
- Secret configuration
- Certificate validity
- Keystore permissions
Next Steps
After setting up CI/CD:
- Learn about module signing
- Understand the release process