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

Support dynamic OCP default version #1049

Merged

Conversation

YuviGold
Copy link
Contributor

@YuviGold YuviGold commented Aug 22, 2021

Return the openshift version that needs to be handled
according to the following process:

  1. In case env var OPENSHIFT_INSTALL_RELEASE_IMAGE is defined to override the release image -
    extract its OCP version.
  2. In case env var OPENSHIFT_VERSION is defined - return it.
  3. In case of allow_default is enabled, return the default supported version by assisted-service.
    3.1 If a client is provided, request the versions from the service (supports remote service).
    3.2 Otherwise, Get from the JSON file in assisted-service repository.

/cc @eliorerz

@openshift-ci openshift-ci bot requested a review from eliorerz August 22, 2021 14:52
@openshift-ci openshift-ci bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 22, 2021
@YuviGold
Copy link
Contributor Author

/cc @tsorya @osherdp

@openshift-ci openshift-ci bot requested review from osherdp and tsorya August 22, 2021 15:06
discovery-infra/test_infra/utils/utils.py Outdated Show resolved Hide resolved
discovery-infra/test_infra/utils/utils.py Show resolved Hide resolved
@YuviGold
Copy link
Contributor Author

/hold
In order to support remote clusters, it would be better to fetch the versions from the client.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 23, 2021
@YuviGold YuviGold force-pushed the support-dynamic-ocp-default branch from 1ee0b5c to e8eee06 Compare August 26, 2021 10:03
@openshift-ci openshift-ci bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 26, 2021
@YuviGold YuviGold force-pushed the support-dynamic-ocp-default branch from e8eee06 to 4bb8801 Compare August 26, 2021 10:04
@YuviGold
Copy link
Contributor Author

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 26, 2021
@YuviGold
Copy link
Contributor Author

/test e2e-metal-assisted-multi-version

@YuviGold YuviGold force-pushed the support-dynamic-ocp-default branch from 4bb8801 to 54df102 Compare August 26, 2021 11:04
@eliorerz
Copy link
Contributor

/test ?

@openshift-ci
Copy link

openshift-ci bot commented Aug 26, 2021

@eliorerz: The following commands are available to trigger required jobs:

  • /test e2e-metal-assisted
  • /test e2e-metal-assisted-kube-api
  • /test images

The following commands are available to trigger optional jobs:

  • /test e2e-metal-assisted-ipv6
  • /test e2e-metal-assisted-multi-version
  • /test e2e-metal-assisted-none
  • /test e2e-metal-assisted-none-ipv6
  • /test e2e-metal-assisted-olm
  • /test e2e-metal-assisted-single-node
  • /test e2e-metal-single-node-live-iso
  • /test system-test-operator

Use /test all to run the following jobs that were automatically triggered:

  • pull-ci-openshift-assisted-test-infra-master-e2e-metal-assisted
  • pull-ci-openshift-assisted-test-infra-master-e2e-metal-assisted-kube-api
  • pull-ci-openshift-assisted-test-infra-master-images

In response to this:

/test ?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@eliorerz
Copy link
Contributor

/test e2e-metal-assisted-ipv6

Copy link
Contributor

@eliorerz eliorerz left a comment

Choose a reason for hiding this comment

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

Looking good.. I added a few comments.

@@ -13,25 +12,14 @@ def api_client():
yield get_api_client()


def get_api_client(offline_token=None, **kwargs) -> InventoryClient:
Copy link
Contributor

Choose a reason for hiding this comment

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

QE are using this method
FYI @lalon4 @nshidlin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

discovery-infra/test_infra/utils/utils.py Outdated Show resolved Hide resolved
with open(OCP_VERSIONS_JSON_PATH, 'r') as f:
data = json.load(f)

d = [k for k, v in data.items() if v.get('default', False)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe set default as const, e.g.

Suggested change
d = [k for k, v in data.items() if v.get('default', False)]
d = [k for k, v in data.items() if v.get(consts.OCP_VERSIONS_DEFAULT_KEY, False)]

Also too many generic name in this function, data, k,v, d..

@YuviGold YuviGold force-pushed the support-dynamic-ocp-default branch from 54df102 to d659764 Compare August 26, 2021 14:07
@YuviGold
Copy link
Contributor Author

/test e2e-metal-assisted-multi-version

@YuviGold YuviGold force-pushed the support-dynamic-ocp-default branch from d659764 to f6c3196 Compare August 29, 2021 13:44
@YuviGold
Copy link
Contributor Author

/test e2e-metal-assisted-multi-version

@YuviGold
Copy link
Contributor Author

/test e2e-metal-assisted-kube-api

@YuviGold YuviGold force-pushed the support-dynamic-ocp-default branch 2 times, most recently from a677bd3 to 200b04f Compare August 30, 2021 09:04
@YuviGold
Copy link
Contributor Author

/test e2e-metal-assisted-multi-version

@YuviGold
Copy link
Contributor Author

/test ?

@openshift-ci
Copy link

openshift-ci bot commented Aug 30, 2021

@YuviGold: The following commands are available to trigger required jobs:

  • /test e2e-metal-assisted
  • /test e2e-metal-assisted-kube-api
  • /test images

The following commands are available to trigger optional jobs:

  • /test e2e-metal-assisted-ipv6
  • /test e2e-metal-assisted-multi-version
  • /test e2e-metal-assisted-none
  • /test e2e-metal-assisted-none-ipv6
  • /test e2e-metal-assisted-olm
  • /test e2e-metal-assisted-single-node
  • /test e2e-metal-single-node-live-iso
  • /test system-test-operator

Use /test all to run the following jobs that were automatically triggered:

  • pull-ci-openshift-assisted-test-infra-master-e2e-metal-assisted
  • pull-ci-openshift-assisted-test-infra-master-e2e-metal-assisted-kube-api
  • pull-ci-openshift-assisted-test-infra-master-images

In response to this:

/test ?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@YuviGold
Copy link
Contributor Author

/test e2e-metal-assisted-olm
/test e2e-metal-assisted-single-node
/test e2e-metal-single-node-live-iso

@YuviGold
Copy link
Contributor Author

/retest

Return the openshift version that needs to be handled
according to the following process:

1. In case env var OPENSHIFT_INSTALL_RELEASE_IMAGE is defined to override the release image -
extract its OCP version.
2. In case env var OPENSHIFT_VERSION is defined - return it.
3. In case allow_default is enabled, return the default supported version by assisted-service.
    3.1 If a client is provided, request the versions fron the service (supports remote service).
    3.2 Otherwise, Get from the JSON file in assisted-service repository.
@YuviGold YuviGold force-pushed the support-dynamic-ocp-default branch from 200b04f to 63151a8 Compare August 30, 2021 12:28
@eliorerz
Copy link
Contributor

/test e2e-metal-assisted-ipv6

1 similar comment
@YuviGold
Copy link
Contributor Author

/test e2e-metal-assisted-ipv6

@YuviGold
Copy link
Contributor Author

/test e2e-metal-assisted-olm
/test e2e-metal-assisted-single-node
/test e2e-metal-single-node-live-iso
/test e2e-metal-assisted-multi-version

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 30, 2021
Copy link
Contributor

@eliorerz eliorerz left a comment

Choose a reason for hiding this comment

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

/hold

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 30, 2021
@openshift-ci
Copy link

openshift-ci bot commented Aug 30, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: eliorerz, YuviGold

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

@YuviGold
Copy link
Contributor Author

/test e2e-metal-assisted-ipv6

@YuviGold
Copy link
Contributor Author

Everything passed 🎉
/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 30, 2021
@@ -16,7 +15,7 @@ class _EnvVariablesUtils(ABC):
remote_service_url: str = get_env("REMOTE_SERVICE_URL")
pull_secret: str = get_env("PULL_SECRET")
offline_token: str = get_env("OFFLINE_TOKEN")
openshift_version: str = get_openshift_version()
openshift_version: str = ''
Copy link
Contributor

@tsorya tsorya Aug 30, 2021

Choose a reason for hiding this comment

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

nit: maybe None? to be consistent with all others

@@ -44,6 +47,11 @@ class GlobalVariables(_EnvVariablesUtils):

def __post_init__(self):
super().__post_init__()
client=None
if not self.is_kube_api:
with suppress(RuntimeError, TimeoutError):
Copy link
Contributor

Choose a reason for hiding this comment

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

why it is ok to fail ? please comment

@@ -740,7 +735,31 @@ def get_kubeconfig_path(cluster_name: str) -> str:
return kubeconfig_path


def get_openshift_version(default=consts.DEFAULT_OPENSHIFT_VERSION):
def get_default_openshift_version(client=None) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure regarding utils. Why it is not part of cluster configuration classes?

@openshift-merge-robot openshift-merge-robot merged commit 2e970c1 into openshift:master Aug 30, 2021
YuviGold added a commit to YuviGold/release that referenced this pull request Sep 12, 2021
On openshift/assisted-test-infra#1049
assisted-test-infra became aware dynamically for the default version of
a deployed assisted-service.
The CI should use it and avoid setting an harcoded version.
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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants