Skip to content

Conversation

@vishal210893
Copy link
Contributor

@vishal210893 vishal210893 commented Feb 9, 2026

🎯 Overview

This PR refactors multiple workflow step definitions to use modern CUE imports and improves code maintainability, consistency, and usability. The changes include migrating from legacy vela/op imports to more specific and modular imports, adding categorization annotations, and providing comprehensive test examples.

📊 Summary Statistics

  • Files Changed: 21 files
  • Insertions: +748 lines
  • Deletions: -195 lines
  • Net Change: +553 lines

🔄 Changes by Category

1. Workflow Step Definition Refactoring

build-push-image Definition

  • Module Migration:
    • Replaced vela/op with vela/builtin, vela/kube, and vela/util
    • Updated kaniko step to use kube.#Apply with $params
    • Updated log step to use util.#Log with $params
    • Updated read step to use kube.#Read with $params
    • Updated wait step to use builtin.#ConditionalWait with improved status check logic
  • Kaniko Image Update:
    • Changed default from oamdev/kaniko-executor:v1.9.1 to gcr.io/kaniko-project/executor:v1.9.0
    • This uses the official Kaniko project image for better reliability and support
  • Annotations Added:
    • Added custom.definition.oam.dev/category: CI Integration
  • File: charts/vela-workflow/templates/definitions/build-push-image.yaml

notification Definition

  • Module Migration:
    • Replaced vela/op with vela/http, vela/email, vela/kube, and vela/util
    • Updated DingTalk implementation to use http.#HTTPDo
    • Updated Lark implementation to use http.#HTTPDo
    • Updated Slack implementation to use http.#HTTPDo
    • Updated Email implementation to use email.#SendEmail
  • CUE Structure Improvements:
    • Refactored parameter definitions to remove redundant *null default values
    • Improved type definitions with proper close() constraints
    • Added reusable #link schema for DingTalk feedCard
    • Simplified nested structures for better readability
    • Added proper JSON imports for message formatting
  • Annotations Added:
    • Added custom.definition.oam.dev/category: External Integration
  • File: charts/vela-workflow/templates/definitions/notification.yaml

print-message-in-status Definition

  • Module Migration:
    • Replaced vela/op with vela/builtin and vela/util
    • Updated to use modern CUE parameter passing patterns
  • UI Improvements:
    • Removed ui-hidden label to make the step visible in UI
  • File: charts/vela-workflow/templates/definitions/print-message-in-status.yaml

read-object Definition

  • Module Migration:
    • Replaced vela/op with vela/kube
    • Updated to use kube.#Read with $params pattern
  • Parameter Improvements:
    • Added default values for better usability
    • Improved parameter documentation
  • File: charts/vela-workflow/templates/definitions/read-object.yaml

request Definition

  • Module Migration:
    • Replaced vela/op with vela/http
    • Updated to use http.#HTTPDo with $params pattern
  • Code Quality:
    • Simplified HTTP request handling
    • Better structured parameter definitions
  • File: charts/vela-workflow/templates/definitions/request.yaml

step-group Definition

  • Minor Updates:
    • Code formatting and consistency improvements
  • File: charts/vela-workflow/templates/definitions/step-group.yaml

suspend Definition

  • New Feature:
    • Added message parameter to allow custom suspension messages
    • Improves workflow visibility and debugging
  • Module Migration:
    • Updated to use modern CUE patterns
  • File: charts/vela-workflow/templates/definitions/suspend.yaml

vela-cli Definition

  • Module Migration:
    • Replaced vela/op with vela/kube
    • Updated to use modern Kubernetes operations
  • Code Quality:
    • Improved parameter handling and validation
  • File: charts/vela-workflow/templates/definitions/vela-cli.yaml

2. New Test Examples

Comprehensive test examples have been added to validate and demonstrate the functionality of workflow step definitions:

Existing Examples Enhanced

  1. test-apply-deployment.yaml - Testing steps comments added
  2. test-apply-object.yaml - Testing steps comments added
  3. test-clean-jobs.yaml - Testing steps comments added
  4. test-export2config.yaml - Testing steps comments added
  5. test-export2secret.yaml - Testing steps comments added

New Test Examples

  1. test-build-push-image.yaml (49 lines)

    • Demonstrates building and pushing container images with Kaniko
    • Shows integration with container registries
    • Tests the updated build-push-image step definition
  2. test-notification.yaml (23 lines)

    • Tests notification integrations (Email, DingTalk, Slack, Lark)
    • Demonstrates webhook notification patterns
    • Validates the refactored notification step
  3. test-print-message.yaml (64 lines)

    • Tests message printing in workflow status
    • Demonstrates status reporting capabilities
    • Shows different message formatting options
  4. test-read-object.yaml (78 lines)

    • Tests reading Kubernetes objects
    • Demonstrates object querying and data extraction
    • Validates the refactored read-object step
  5. test-request.yaml (46 lines)

    • Tests HTTP request functionality
    • Demonstrates REST API integration
    • Validates the refactored request step
  6. test-step-group.yaml (95 lines)

    • Tests grouping multiple steps
    • Demonstrates parallel and sequential execution
    • Shows error handling in step groups
  7. test-suspend.yaml (68 lines)

    • Tests workflow suspension functionality
    • Demonstrates manual approval workflows
    • Validates the new message parameter
  8. test-vela-cli.yaml (55 lines)

    • Tests Vela CLI integration
    • Demonstrates command execution within workflows
    • Validates the refactored vela-cli step

Files Location: examples/workflow-run/

🔍 Testing

All changes have been validated with:

  • New test workflow examples in examples/workflow-run/
  • Each workflow step definition has corresponding test cases
  • Examples demonstrate real-world usage patterns

Signed-off-by: vishal210893 [email protected]


Summary by cubic

Refactored built-in workflow step definitions to use modern CUE modules (vela/kube, vela/builtin, vela/util, vela/http, vela/email) and added category annotations. Added local dev targets and new examples to make testing and adoption easier.

  • Refactors

    • Migrated all steps off vela/op to kube/builtin/util/http/email with $params and clearer returns.
    • Rewrote notification to use HTTPDo and SendEmail; cleaned schemas and removed redundant nulls.
    • Updated build-push-image: switched default to gcr.io/kaniko-project/executor:v1.9.0, improved read/log/wait.
    • Simplified request to http.#HTTPDo; added failure on statusCode > 400.
    • read-object now has defaults (apiVersion, kind) and simpler params.
    • Other updates: apply-deployment adds replicas/cluster and ConditionalWait; export2config/export2secret/clean-jobs/vela-cli/print-message all moved to kube/builtin/util; added category annotations; removed ui-hidden labels.
  • New Features

    • suspend supports a message parameter for better visibility.
    • Local dev: make core-install and def-install (DEFINITION_NAMESPACE support) and README guidance; added example workflows under examples/workflow-run for all updated steps.

Written for commit 2411690. Summary will update on new commits.

viskumar and others added 5 commits February 8, 2026 13:31
Chore: refactor definitions and add local dev support

- Refactored `apply-deployment`, `apply-object`, `clean-jobs`, `export2config`, and `export2secret` to use `vela/kube` and `vela/builtin` instead of `vela/op`.
- Updated CUE templates to use `$params` syntax.
- Added `custom.definition.oam.dev/category: Resource Management` annotation to definitions.
- Removed `custom.definition.oam.dev/ui-hidden` label from definitions.
- Added `core-install` and `def-install` targets to Makefile for local development.
- Added `DEFINITION_NAMESPACE` to `makefiles/const.mk`.
- Updated README.md with local development guide.
Refactor: update workflow step definitions and examples

* refactor: update workflow step definitions
  - Refactored `print-message-in-status`, `suspend`, `request`, `read-object`, and `vela-cli` to use `vela/builtin`, `vela/kube`, and `vela/util`.
  - Added category annotations to steps and removed `ui-hidden` labels.
  - Added `message` parameter to `suspend` step.
  - Updated `read-object` parameters with default values.

* chore: add and update workflow run examples
  - Added new examples: `test-vela-cli.yaml`, `test-suspend.yaml`, `test-step-group.yaml`, `test-request.yaml`, `test-read-object.yaml`, `test-print-message.yaml`.
  - Added testing steps comments to existing examples.
Refactor: update build-push-image workflow step definition

* refactor: migrate build-push-image definition from `vela/op` to `vela/kube`, `vela/util`, and `vela/builtin`
* update `kaniko` and `read` steps to use `kube.#Apply` and `kube.#Read` with `$params`
* update `log` step to use `util.#Log`
* update `wait` step to use `builtin.#ConditionalWait` and adjust status check logic
* add `custom.definition.oam.dev/category` annotation
* add `examples/workflow-run/test-build-push-image.yaml` example workflow
Fix: Refactor notification workflow step definition

* Fix: Refactor notification workflow step definition

- Replaced `vela/op` imports with `vela/http`, `vela/email`, `vela/kube`, and `vela/util`
- Updated DingTalk, Lark, and Slack implementations to use `http.#HTTPDo`
- Updated Email implementation to use `email.#SendEmail`
- Refactored CUE parameter definitions and removed redundant null checks
- Added `External Integration` category annotation
- Added `examples/workflow-run/test-notification.yaml` for testing
@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.19%. Comparing base (d7db9c4) to head (2411690).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #223      +/-   ##
==========================================
+ Coverage   62.49%   70.19%   +7.70%     
==========================================
  Files          62       62              
  Lines        4415     5009     +594     
==========================================
+ Hits         2759     3516     +757     
+ Misses       1324     1142     -182     
- Partials      332      351      +19     
Flag Coverage Δ
e2etests 21.39% <ø> (?)
unit-test 64.22% <ø> (+1.73%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 29 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="charts/vela-workflow/templates/definitions/apply-deployment.yaml">

<violation number="1" location="charts/vela-workflow/templates/definitions/apply-deployment.yaml:47">
P2: Wait condition only checks readyReplicas, allowing workflows to continue before the new deployment generation is fully rolled out.</violation>
</file>

<file name="examples/workflow-run/test-build-push-image.yaml">

<violation number="1" location="examples/workflow-run/test-build-push-image.yaml:2">
P2: Example instructions create a secret named "docker-secret" but the workflow creates/uses "image-registry-secret" with placeholder credentials, so following the instructions will still use dummy creds and likely fail authentication.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@briankane briankane merged commit e6698f0 into kubevela:main Feb 10, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants