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

feat: deployment config for expected params and targets #1214

Merged
merged 7 commits into from
Dec 18, 2024

Conversation

ecrupper
Copy link
Contributor

Additional context: go-vela/community#1002

This change will allow for the deployment block in Vela pipeline files:

version: "1"

deployment:
    targets: [ dev, stage, prod ]
    parameters:
        foo:
            description: blah
            required: true
            type: string

These configurations can also be templated using the standard template format already existing today in Vela:

version: "1"

templates:
    - name: my-deploy-config
       source: over-there.yml
       type: file

deployment:
    template:
        name: my-deploy-config
        vars:
            regions: [ north, east, west ]

Deployment configurations can also be requested using the new API endpoint:

GET /api/v1/deployments/:org/:repo/config

This will allow for the CLI and UI to validate deployments prior to their launch. However, because you can create deployments in other ways outside the scope of Vela, and Vela still will process the resulting webhook, this PR also validates the incoming deployment against the config and will stop the compilation if there's a mismatch.

@ecrupper ecrupper requested a review from a team as a code owner October 24, 2024 14:23
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 51.19617% with 102 lines in your changes missing coverage. Please review.

Project coverage is 56.88%. Comparing base (aa973fe) to head (b25ab8d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
api/deployment/get_config.go 0.00% 56 Missing ⚠️
compiler/native/expand.go 50.00% 14 Missing and 4 partials ⚠️
api/webhook/post.go 0.00% 8 Missing ⚠️
api/build/compile_publish.go 0.00% 6 Missing ⚠️
compiler/native/compile.go 33.33% 4 Missing and 2 partials ⚠️
compiler/types/pipeline/deployment.go 89.28% 4 Missing and 2 partials ⚠️
api/deployment/get.go 0.00% 1 Missing ⚠️
router/deployment.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1214      +/-   ##
==========================================
- Coverage   56.91%   56.88%   -0.04%     
==========================================
  Files         599      602       +3     
  Lines       32904    33098     +194     
==========================================
+ Hits        18727    18827     +100     
- Misses      13541    13627      +86     
- Partials      636      644       +8     
Files with missing lines Coverage Δ
compiler/native/transform.go 95.38% <100.00%> (+0.03%) ⬆️
compiler/template/native/render.go 86.95% <100.00%> (ø)
compiler/types/pipeline/build.go 72.72% <ø> (ø)
compiler/types/yaml/build.go 91.04% <100.00%> (+0.27%) ⬆️
compiler/types/yaml/deployment.go 100.00% <100.00%> (ø)
scm/github/webhook.go 90.10% <100.00%> (+0.04%) ⬆️
api/deployment/get.go 0.00% <0.00%> (ø)
router/deployment.go 0.00% <0.00%> (ø)
api/build/compile_publish.go 0.00% <0.00%> (ø)
compiler/native/compile.go 70.35% <33.33%> (-0.81%) ⬇️
... and 4 more

KellyMerrick
KellyMerrick previously approved these changes Dec 13, 2024
Copy link
Contributor

@KellyMerrick KellyMerrick left a comment

Choose a reason for hiding this comment

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

lgtm

api/deployment/get_config.go Outdated Show resolved Hide resolved
Copy link
Contributor

@KellyMerrick KellyMerrick left a comment

Choose a reason for hiding this comment

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

lgtm

@ecrupper ecrupper merged commit fa06a47 into main Dec 18, 2024
11 of 13 checks passed
@ecrupper ecrupper deleted the feat/deployment-config branch December 18, 2024 17:34
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