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

enhance(exec): templates and env support for exec pipeline #492

Merged
merged 2 commits into from
Oct 13, 2023

Conversation

ecrupper
Copy link
Contributor

@ecrupper ecrupper commented Oct 9, 2023

This is the final of three changes that will enhance the vela exec pipeline command. These changes fall under the CLI section below.

The Issue

vela exec pipeline does not work with templates. It also does not work with custom environments if the user is trying to emulate any of the default environment variables, such as VELA_BUILD_COMMIT.

Server Changes

  1. Execute the local environment sourcing after the default env override. This will ensure that user-set values that would be found in the default environment will be properly interpreted by the compiler.
  2. Adjustments to getTemplate that allows the compiler to read both from local file tree as well as remote using a GitHub token.

Worker Changes

  1. Remove calls to merge environment with default environment found in executor/local/step.go. This call is unnecessary and will only overwrite user-supplied environment values found in the default env.

CLI Changes

  1. Support for --template, --template-file, --compiler.github.token, and --compiler.github.url flags to the exec pipeline command. This will allow users the option to leverage templates in local pipeline execution, both local and remote.
  2. Support for --env-file and --env-file-path to allow users to source environment variables from a file.

An aside:
Closes go-vela/community#340

@ecrupper ecrupper self-assigned this Oct 9, 2023
@ecrupper ecrupper requested a review from a team as a code owner October 9, 2023 17:10
@JordanSussman
Copy link
Collaborator

@ecrupper is it fair to say that the local-env flag will resolve go-vela/community#340?

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Merging #492 (1eaa3b6) into main (0dd737e) will decrease coverage by 0.36%.
The diff coverage is 18.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #492      +/-   ##
==========================================
- Coverage   86.37%   86.02%   -0.36%     
==========================================
  Files         145      145              
  Lines        6310     6345      +35     
==========================================
+ Hits         5450     5458       +8     
- Misses        704      730      +26     
- Partials      156      157       +1     
Files Coverage Δ
action/pipeline/validate.go 87.50% <100.00%> (-1.23%) ⬇️
action/pipeline/exec.go 0.00% <0.00%> (ø)
command/pipeline/exec.go 0.00% <0.00%> (ø)

@ecrupper
Copy link
Contributor Author

ecrupper commented Oct 9, 2023

@ecrupper is it fair to say that the local-env flag will resolve go-vela/community#340?

Yep! Local env is cleared prior to pipeline execution unless that flag is specified

@ecrupper ecrupper merged commit ebb8068 into main Oct 13, 2023
15 of 16 checks passed
@ecrupper ecrupper deleted the enhance/pipeline/exec-improvements branch October 13, 2023 22:18
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.

vela exec pipeline loads all host environmental variables into pipeline
4 participants