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

Zaza could expand bundles via variable insertion before deploy #234

Closed
ChrisMacNaughton opened this issue May 10, 2019 · 1 comment
Closed

Comments

@ChrisMacNaughton
Copy link
Collaborator

ChrisMacNaughton commented May 10, 2019

Given the following bundle.yaml and tests.yaml example, we could use the variables defined in the tests.yaml to build our test matrix, reducing the repetition in our charms.

bundle.yaml:

series: *series
applications:
  ceph-osd:
    charm: ceph-osd
    options:
      source: *source
  ceph-mon:
    charm: cs:ceph-mon
    options:
      source: *source
relations:
  - - ceph-mon
    - ceph-osd

tests.yaml:

charm_name: ceph-osd
base_bundle:
  - bundle
# gate_bundles:
#   --snip--
# smoke_bundles:
#   --snip--
# dev_bundles:
#   --snip--
configure: []
tests:
  - zaza.openstack.charm_tests.ceph.tests.CephTest

# The below section is entirely optional and will be used as a transform
# on the {gate,smoke,dev}_bundles sections at the beginning. The matrix below
# would transform into, basically: 
# gate_bundles:
#   - bionic-stein
#   - bionic-rocky
#   - bionic-queens
#   - xenial-queens
#   - xenial-pike
#   - xenial-ocata
#   - xenial-mitaka
#   - trusty-mitaka
# smoke_bundles:
#   - bionic-queens
# dev_bundles:
#   - cosmic-rocky
#   - disco-stein
matrix:
  series:
    - disco:
        -  source|openstack-origin:
            - stein:
                - dev: true
                - gate: false
    - cosmic:
        -  source|openstack-origin:
            - rocky:
                - dev: true
                - gate: false
    - bionic:
        -  source|openstack-origin:
            - stein
            - rocky
            - queens:
              - smoke: true
    - xenial:
        -  source|openstack-origin:
            - queens
            - pike
            - ocata
            - mitaka
    - trusty:
        -  source|openstack-origin:
            - mitaka

An alternate method for mapping in the matrix section to the *-bundle section could be:

base-bundle:
  bundle
# The mode_map key would be used as a replace map to identify
# the pattern to transform the matrix variables into the bundle
# mappings for dev/smoke/gate
mode_map: "*series-*openstack-origin"
gate_bundles:
  - bionic-stein
  - bionic-rocky
  - bionic-queens
smoke_bundles:
  - bionic-queens
dev_bundles:
  - cosmic-rocky
  - disco-stein
matrix:
  series:
    - disco:
        -  source|openstack-origin:
            - stein
    - cosmic:
        -  source|openstack-origin:
            - rocky
    - bionic:
        -  source|openstack-origin:
            - stein
            - rocky
            - queens

In addition to mapping the bundles to be run, the above would additionally add the following section to the bundle.yaml (bundle.yaml in the above config):

variables:
  series: &series disco
  source: &source stein
  openstack-origin: &openstack-origin stein

Where the [disco / stein] combination is an entry generated by the matrix values in tests.yaml.

While this method would increase the length of the tests.yaml (potentially considerably), It would almost entirely remove the repetition mapping each U-OS combination to a new bundle.

It is also possible that the base-bundle section could be extended to allow for mapping different base bundles depending on the variables in the matrix section. I think that this would be valuable when considering bundles that change deployed applications per release, or for restricting some applications to a subset of releases.

After combining these variables in their "base" bundle, we could render the base bundle in addition to overlays as the primary bundle to deploy.

@ChrisMacNaughton ChrisMacNaughton changed the title Zaza could expand bundles via variable insertion before yaml.loading the bundles Zaza could expand bundles via variable insertion before deploy May 10, 2019
@ChrisMacNaughton
Copy link
Collaborator Author

I have created a new RFC branch, and associated Pull Request for this into that branch at #235

coreycb pushed a commit to coreycb/zaza that referenced this issue Oct 17, 2023
…elease-upgrade-interactive

Set some apt config to accept package defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant