Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: fix definition parse logic and allow if/for comprehension & use op.#Suspend for deploy #5743

Merged
merged 3 commits into from
Mar 28, 2023

Conversation

Somefive
Copy link
Collaborator

…e op.#Suspend for deploy

  1. Fix definition parse logic to support if/for comprehension under template field.
  2. Use op.#Suspend for deploy workflowstep.

Now deploy.cue is like

import (
	"vela/op"
)

"deploy": {
	type: "workflow-step"
	annotations: {
		"category": "Application Delivery"
	}
	labels: {
		"scope": "Application"
	}
	description: "A powerful and unified deploy step for components multi-cluster delivery with policies."
}
template: {
	if parameter.auto == false {
		suspend: op.#Suspend & {message: "Waiting approval to the deploy step \"\(context.stepName)\""}
	}
	deploy: op.#Deploy & {
		policies:                 parameter.policies
		parallelism:              parameter.parallelism
		ignoreTerraformComponent: parameter.ignoreTerraformComponent
	}
	parameter: {
		//+usage=If set to false, the workflow will suspend automatically before this step, default to be true.
		auto: *true | bool
		//+usage=Declare the policies that used for this deployment. If not specified, the components will be deployed to the hub cluster.
		policies: *[] | [...string]
		//+usage=Maximum number of concurrent delivered components.
		parallelism: *5 | int
		//+usage=If set false, this step will apply the components with the terraform workload.
		ignoreTerraformComponent: *true | bool
	}
}

Description of your changes

Fixes #

I have:

  • Read and followed KubeVela's contribution process.
  • Related Docs updated properly. In a new feature or configuration option, an update to the documentation is necessary.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Special notes for your reviewer

@github-advanced-security
Copy link

You have successfully added a new Trivy configuration .github/workflows/trivy-scan.yml:images. As part of the setup process, we have scanned this repository and found 5 existing alerts. Please check the repository Security tab to see all alerts.

@Somefive Somefive marked this pull request as ready for review March 27, 2023 08:38
@codecov
Copy link

codecov bot commented Mar 27, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: -0.14 ⚠️

Comparison is base (8619f1c) 60.07% compared to head (923c9f4) 59.94%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5743      +/-   ##
==========================================
- Coverage   60.07%   59.94%   -0.14%     
==========================================
  Files         217      217              
  Lines       30717    30694      -23     
==========================================
- Hits        18453    18398      -55     
- Misses      10521    10548      +27     
- Partials     1743     1748       +5     
Flag Coverage Δ
core-unittests 55.83% <50.00%> (-0.08%) ⬇️
e2e-multicluster-test 25.64% <0.00%> (-0.13%) ⬇️
e2e-rollout-tests 22.27% <ø> (-0.09%) ⬇️

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

Impacted Files Coverage Δ
pkg/appfile/parser.go 61.76% <ø> (-0.07%) ⬇️
pkg/workflow/step/generator.go 100.00% <ø> (ø)
pkg/definition/definition.go 72.39% <50.00%> (-0.20%) ⬇️

... and 10 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Somefive Somefive force-pushed the feat/deploy-auto-use-op-suspend branch from 180f819 to 0dd394e Compare March 27, 2023 11:01
@FogDong FogDong changed the title Chore: fix definition parse logic and allow if/for comprehension & us… Chore: fix definition parse logic and allow if/for comprehension & use op.#Suspend for deploy Mar 28, 2023
@Somefive Somefive force-pushed the feat/deploy-auto-use-op-suspend branch 2 times, most recently from 1587b17 to 2430ba7 Compare March 28, 2023 06:30
…e op.#Suspend for deploy

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
@Somefive Somefive force-pushed the feat/deploy-auto-use-op-suspend branch from 2430ba7 to 923c9f4 Compare March 28, 2023 07:01
@Somefive Somefive merged commit 542b32b into kubevela:master Mar 28, 2023
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.

None yet

2 participants