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

prowjob,env: add script to extract env vars from job #3946

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dhiller
Copy link
Contributor

@dhiller dhiller commented Feb 10, 2025

What this PR does / why we need it:

Adds a script that extract the environment variables from a job and converts them into a set of export commands.

Example:

$ ./hack/export-job-env-vars.sh periodic-kubevirt-e2e-k8s-1.31-sig-storage-root
export KUBEVIRT_E2E_RUN_ALL_SUITES=true && export KUBEVIRT_QUARANTINE=true && export TARGET=k8s-1.31-sig-storage && export FEATURE_GATES=Root

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Feb 10, 2025
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from dhiller. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

fi

rg -l "$1" "${PROJECT_INFRA_ROOT}/github/ci/prow-deploy/files/jobs" | \
xargs yq -r '.periodics[] | select(.name=="periodic-kubevirt-e2e-k8s-1.31-sig-storage-root") | .spec.containers[0].env[] | "export "+.name+"="+.value+ " &&"' | \
Copy link
Member

Choose a reason for hiding this comment

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

Will this include env variables that are included in presets? You might have to create the prowjob with hack/mkpj.sh to get all env variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point - this script originated from a quick hack I did for someone asking to replicate the settings of the k/kubevirt lanes.

This PR is just to not lose it though - I could add this as a follow up, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To answer your question - no, it obviously will not include the presets :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just noticed that this will not work as expected anyways - sorry for the noise, reverted to draft

@dhiller dhiller marked this pull request as draft February 10, 2025 12:35
@kubevirt-bot kubevirt-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 10, 2025
@dhiller dhiller force-pushed the export-job-env-vars branch from 783ea93 to 3f4aba4 Compare February 10, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants