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: enable setting catalog version without "v" prefix #357

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

ksimon1
Copy link
Member

@ksimon1 ksimon1 commented Mar 20, 2024

What this PR does / why we need it:
chore: enable setting catalog version without "v" prefix
this commit allows to set REMOVE_CATALOG_VERSION_PREFIX env variable, which will remove "v" prefix from version in catalog version - e.g. 0.19.0 when true vs v0.19.0 when false.

This will help in DS where OCP catalog removes v from version. This commit also replaces all version variables from catalog version and replaces it with catalog_version which can hold version with or without v prefix

Signed-off-by: Karel Simon [email protected]

Release note:

NONE

@kubevirt-bot kubevirt-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Mar 20, 2024
Copy link

openshift-ci bot commented Mar 20, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link

openshift-ci bot commented Mar 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ksimon1

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

The pull request process is described 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 20, 2024
@ksimon1 ksimon1 marked this pull request as ready for review March 20, 2024 17:56
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 20, 2024
@kubevirt-bot kubevirt-bot requested a review from opokornyy March 20, 2024 17:56
@ksimon1
Copy link
Member Author

ksimon1 commented Mar 21, 2024

/retest

@@ -13,6 +13,8 @@ sa_name: "{{ role_name }}"
role_binding_name: "{{ role_name }}"
default_file_mode: "0644"
version: "{{ lookup('env','RELEASE_VERSION')| default('latest', true) }}"
remove_catalog_version_prefix: "{{ lookup('env','REMOVE_CATALOG_VERSION_PREFIX')| default(false, true) | bool}}"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
remove_catalog_version_prefix: "{{ lookup('env','REMOVE_CATALOG_VERSION_PREFIX')| default(false, true) | bool}}"
remove_catalog_version_prefix: "{{ lookup('env','REMOVE_CATALOG_VERSION_PREFIX')| default(false) | bool}}"

Shouldn't it look like this?

Copy link
Member Author

Choose a reason for hiding this comment

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

According to docs (https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_filters.html#providing-default-values)
If you want to use the default value when variables evaluate to false or an empty string you have to set the second parameter to true:
So I assume the true can stay

Copy link
Member

Choose a reason for hiding this comment

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

I think we're both right in this specific case. When using bools we don't care for empty vars as they evaluate to false too. But in other cases your solution might be preferred!

this commit allows to set REMOVE_CATALOG_VERSION_PREFIX env variable,
which will remove "v" prefix from version in catalog version - e.g. 0.19.0
when true vs v0.19.0 when false.

This will help in DS where OCP catalog removes v from version.
This commit also replaces all version variables from catalog version
and replaces it with catalog_version which can hold version with or
without v prefix
Signed-off-by: Karel Simon <[email protected]>
@ksimon1
Copy link
Member Author

ksimon1 commented Mar 21, 2024

/retest

@0xFelix
Copy link
Member

0xFelix commented Mar 21, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 21, 2024
@ksimon1
Copy link
Member Author

ksimon1 commented Mar 21, 2024

/retest

@ksimon1 ksimon1 merged commit ff79166 into kubevirt:main Mar 21, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants