diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 056dae5d..ade6a34d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,17 @@ Infra.Osbuild Release Notes .. contents:: Topics + +v2.3.2 +====== + +Minor Changes +------------- + +- Add [[container]] section in generated blueprint, to support embedded container images + +======= + v2.3.1 ====== @@ -13,6 +24,10 @@ Minor Changes - Include blueprint import file option - Add ignition to simplified installer blueprint + + +======= + v2.3.0 ====== diff --git a/blueprints/rhel-9-latest-HIPAA.toml b/blueprints/rhel-9-latest-HIPAA.toml index 859448cc..75d59592 100644 --- a/blueprints/rhel-9-latest-HIPAA.toml +++ b/blueprints/rhel-9-latest-HIPAA.toml @@ -3,7 +3,7 @@ # Blueprint for Health Insurance Portability and Accountability Act (HIPAA) # # Profile Description: -# The HIPAA Security Rule establishes U.S. national standards to protect individuals’ +# The HIPAA Security Rule establishes U.S. national standards to protect individuals # electronic personal health information that is created, received, used, or # maintained by a covered entity. The Security Rule requires appropriate # administrative, physical and technical safeguards to ensure the diff --git a/galaxy.yml b/galaxy.yml index b077f223..5ff6f61d 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,9 @@ namespace: infra name: osbuild # The version of the collection. Must be compatible with semantic versioning -version: 2.3.1 + +version: 2.3.2 + # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md diff --git a/plugins/modules/create_blueprint.py b/plugins/modules/create_blueprint.py index 7ea0f873..245e335d 100644 --- a/plugins/modules/create_blueprint.py +++ b/plugins/modules/create_blueprint.py @@ -73,6 +73,13 @@ elements: str default: [] required: false + containers: + description: + - List of container images to embed into the image + type: list + elements: str + default: [] + required: false customizations: description: - Dictionary of customizations @@ -122,6 +129,7 @@ packages=dict(type="list", required=False, elements="str", default=[]), groups=dict(type="list", required=False, elements="str", default=[]), customizations=dict(type="dict", required=False, default={}), + containers=dict(type="list", required=False, elements="str", default=[]), ) @@ -188,6 +196,12 @@ def create_blueprint(module, weldr): else: toml_data["customizations"][key]: dict = customization + if module.params["containers"]: + toml_data["containers"]: list = [] + for container in module.params["containers"]: + container = container.strip() + toml_data["containers"].append({"source": f"{container}"}) + try: with open(module.params["dest"], "w") as fd: weldr.toml.dump(toml_data, fd) diff --git a/roles/builder/README.md b/roles/builder/README.md index 6212a5bf..6cbf1a90 100644 --- a/roles/builder/README.md +++ b/roles/builder/README.md @@ -253,6 +253,23 @@ builder_compose_pkgs: - "tmux" ``` + +### builder_compose_containers + +Type: list +Required: false + +List of Container images to include in the image. + +Example: + +```yaml +builder_compose_containers: + - quay.io/luisarizmendi/kiosk-token:latest + - quay.io/luisarizmendi/secret-http:latest +``` + + ### builder_compose_customizations Type: dict diff --git a/roles/builder/meta/argument_specs.yaml b/roles/builder/meta/argument_specs.yaml index e5efc2d2..027f9665 100644 --- a/roles/builder/meta/argument_specs.yaml +++ b/roles/builder/meta/argument_specs.yaml @@ -111,6 +111,12 @@ argument_specs: description: "List of RPMs to include in the image." elements: "str" + builder_compose_containers: + type: "list" + required: false + description: "List of Container Images to include in the image." + elements: "str" + builder_compose_customizations: type: "dict" required: false diff --git a/roles/builder/tasks/main.yml b/roles/builder/tasks/main.yml index db2c4d01..346811ac 100644 --- a/roles/builder/tasks/main.yml +++ b/roles/builder/tasks/main.yml @@ -95,34 +95,35 @@ distro: "{{ builder_blueprint_distro | default(omit) }}" packages: "{{ builder_compose_pkgs | default(omit) }}" customizations: "{{ builder_compose_customizations | default(omit) }}" + containers: "{{ builder_compose_containers | default(omit) }}" register: builder_blueprint_output when: builder_blueprint_import_file is not defined - block: - - name: Copy the blueprint file - copy: - src: "{{ builder_blueprint_import_file }}" - dest: "{{ builder_blueprint_src_path }}" - - ## TODO: Check the imported file TOML format - - name: Read the content of the TOML file - slurp: - src: "{{ builder_blueprint_src_path }}" - register: toml_file_content - - - name: Parse TOML content - shell: "echo '{{ toml_file_content.content | b64decode }}' | python -c 'import sys, toml; print(toml.loads(sys.stdin.read())[\"version\"])'" - register: _imported_blueprint_version - - - name: Set blueprint name in the imported TOML file - shell: "sed -i '0,/name =/ s/name =.*/name = \"{{ builder_blueprint_name }}\"/' {{ builder_blueprint_src_path }}" - - - name: Set expected var output with current_version from TOML - set_fact: - builder_blueprint_output: - msg: "Blueprint file written to location: {{ builder_blueprint_src_path }}" - changed: true - current_version: "{{ _imported_blueprint_version.stdout }}" + - name: Copy the blueprint file + copy: + src: "{{ builder_blueprint_import_file }}" + dest: "{{ builder_blueprint_src_path }}" + + ## TODO: Check the imported file TOML format + - name: Read the content of the TOML file + slurp: + src: "{{ builder_blueprint_src_path }}" + register: toml_file_content + + - name: Parse TOML content + shell: "echo '{{ toml_file_content.content | b64decode }}' | python -c 'import sys, toml; print(toml.loads(sys.stdin.read())[\"version\"])'" + register: _imported_blueprint_version + + - name: Set blueprint name in the imported TOML file + shell: "sed -i '0,/name =/ s/name =.*/name = \"{{ builder_blueprint_name }}\"/' {{ builder_blueprint_src_path }}" + + - name: Set expected var output with current_version from TOML + set_fact: + builder_blueprint_output: + msg: "Blueprint file written to location: {{ builder_blueprint_src_path }}" + changed: true + current_version: "{{ _imported_blueprint_version.stdout }}" when: builder_blueprint_import_file is defined - name: Push the blueprint into image builder diff --git a/tests/unit/plugins/modules/test_create_blueprint.py b/tests/unit/plugins/modules/test_create_blueprint.py index 595931fc..679d6261 100644 --- a/tests/unit/plugins/modules/test_create_blueprint.py +++ b/tests/unit/plugins/modules/test_create_blueprint.py @@ -20,7 +20,8 @@ "version_type": "patch", "packages": [], "groups": [], - "customizations": {"user": "bob"} + "customizations": {"user": "bob"}, + "containers": [] }