-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Feature Request: Publish KCL Module with Dagger and GitHub Actions
Problem Statement / Feature Request
We aim to establish a robust and automated process for publishing KCL modules. This involves leveraging Dagger to define the publishing logic and integrating this logic into our GitHub Workflows for seamless execution. The goal is to standardize and automate the release of KCL modules, ensuring consistency and efficiency.
Context and Background
Currently, publishing KCL modules might involve manual steps or ad-hoc scripts. By adopting Dagger, we can encapsulate the build, test, and publish logic into a portable and reproducible pipeline. Integrating this with GitHub Workflows will enable continuous delivery for our KCL modules.
Proposed Solution / Requirements
The proposed solution involves two main components:
-
Develop a Dagger Pipeline for KCL Module Publishing:
- Create a Dagger module (e.g., in Go, CUE, or Python) that defines the steps necessary to publish a KCL module.
- This pipeline should handle:
- Dependency resolution for the KCL module.
- Building/packaging the KCL module.
- Authenticating with the target module registry (e.g., OCI registry, if applicable).
- Pushing the packaged KCL module to the registry.
- (Optional) Version bumping based on release criteria.
# Example Dagger pseudo-code (conceptual) def publish_kcl_module(source_dir: Directory, version: str): # build the kcl module built_module = source_dir.exec("kcl build") # authenticate with registry registry = container().from_("my_kcl_registry_cli").with_secret("token", my_registry_token) authenticated_registry = registry.login(...) # push the module authenticated_registry.exec(f"kcl push {built_module} --version {version}")
-
Integrate Dagger Pipeline into GitHub Workflows:
- Create a new GitHub Actions workflow (e.g.,
.github/workflows/publish-kcl-module.yaml) that triggers the Dagger pipeline. - The workflow should:
- Check out the repository.
- Set up Dagger CLI.
- Execute the Dagger function responsible for publishing the KCL module, passing necessary parameters (e.g., version, registry credentials).
- Define appropriate trigger events (e.g.,
on: pushto a specific branch,on: release/types: published, orworkflow_dispatchfor manual triggers).
# Example GitHub Actions Workflow pseudo-code (conceptual) name: Publish KCL Module on: push: tags: - 'v*.*.*' workflow_dispatch: jobs: publish: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Install Dagger uses: dagger/setup-dagger@v1 with: dagger-version: '0.9.0' # Specify desired Dagger version - name: Publish KCL Module with Dagger env: KCL_REGISTRY_TOKEN: ${{ secrets.KCL_REGISTRY_TOKEN }} # Example for secrets run: | dagger call publishKclModule --source-dir . --version ${{ github.ref_name }}
- Create a new GitHub Actions workflow (e.g.,
Additional Notes or Considerations
- Registry Choice: Clarify which KCL module registry will be used (e.g., an OCI-compliant registry, a dedicated KCL registry, etc.).
- Authentication: Detail the authentication mechanism required for the chosen registry and how secrets will be managed within GitHub Actions.
- Version Management: How will KCL module versions be managed? Will Dagger assist in automatic version bumping or will it rely on Git tags?
- Error Handling: Ensure the Dagger pipeline and GitHub Workflow include robust error handling and reporting.
Actionable Next Steps
- Define the exact structure and dependencies of the KCL module for publishing.
- Implement the Dagger pipeline for building, packaging, and pushing a KCL module.
- Create the GitHub Actions workflow to invoke the Dagger pipeline.
- Set up necessary secrets and environment variables in GitHub.
- Test the end-to-end workflow with a sample KCL module.
- Document the publishing process and Dagger pipeline usage.