Manage-the-update-dependency-ENVTEST_K8S_VERSION

What is does

  • This merge request updates the ENVTEST_K8S_VERSION in the Makefile to be aligned with the version specified in the sylva-units chart. The ENVTEST_K8S_VERSION is retrieved from the values.yaml file in the sylva-units chart and used commonly across the three operators: workload-cluster-operator#27 (closed), #28 (closed), and heat-operator#25 (closed). This ensures consistency in testing environments across all operators.
  • By aligning the ENVTEST_K8S_VERSION across all operators, we ensure that all testing environments are consistent. This helps in maintaining a stable and reliable testing environment across the project.

Technical details

1.Generic usage in Makefile and renovate.json:

  • The DepNameTemplate previously used in the Renovate configuration has been replaced with the explicit DepName defined in the Makefile, i.e., ENVTEST_K8S_VERSION.
  • The datasource is dynamically sourced from the custom datasource custom.checking-sylva-units-values, ensuring compatibility with the values.yaml file of the sylva-units chart.

2.Renovate Annotation in the Makefile:

  • A custom Renovate annotation has been added to the Makefile to specify the dependency along with the custom datasource:

    # renovate: custom datasource depName=ENVTEST_K8S_VERSION datasource=custom.checking-sylva-units-values 
    ENVTEST_K8S_VERSION = 1.28.0
  • This annotation enables Renovate to recognize and automatically update the version based on the external datasource.

3. Regex-based customManager:

  • Renovate’s regex-based custom manager is used to parse and track the ENVTEST_K8S_VERSION in the Makefile. The regex is defined as:

    \s+# renovate: custom datasource depName=(?<depName>.*)? datasource=(?<datasource>.*)\s.*?_VERSION = (?<currentValue>.*)\s

    This allows Renovate to identify the dependency name (ENVTEST_K8S_VERSION) and its associated custom datasource directly from the Makefile.

 4.Custom Datasource:

The values for ENVTEST_K8S_VERSION are retrieved from the custom datasource custom.checking-sylva-units-values, which points to the values.yaml file of the sylva-units chart:

"customDatasources": { 
 "checking-sylva-units-values": {
 "defaultRegistryUrlTemplate": "https://gitlab.com/sylva-projects/sylva-core/-/raw/main/charts/sylva-units/values.yaml", 
 "format": "yaml", 
 "transformTemplates": [ "{\"releases\":[{\"version\": $string(k8s_version_short)}],\"homepage\":\"https://gitlab.com/sylva-projects/sylva- core/-/raw/main/charts/sylva-units/values.yaml\"}"
 ]
 }
 }

By implementing these changes, the synchronization of the ENVTEST_K8S_VERSION is automated, ensuring consistency and reducing manual overhead.

Test

Regex testing https://regex101.com/r/ZetDv8/1

Reference

Edited by emmanuel wyckens

Merge request reports

Loading