Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/step-security/hard…
Browse files Browse the repository at this point in the history
…en-runner-2.9.0
  • Loading branch information
claudiol committed Jul 25, 2024
2 parents a72e748 + b73969b commit 79581f7
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 27 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
======

Expand All @@ -13,6 +24,10 @@ Minor Changes
- Include blueprint import file option
- Add ignition to simplified installer blueprint



=======

v2.3.0
======

Expand Down
2 changes: 1 addition & 1 deletion blueprints/rhel-9-latest-HIPAA.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions plugins/modules/create_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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=[]),
)


Expand Down Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions roles/builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions roles/builder/meta/argument_specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
49 changes: 25 additions & 24 deletions roles/builder/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/plugins/modules/test_create_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"version_type": "patch",
"packages": [],
"groups": [],
"customizations": {"user": "bob"}
"customizations": {"user": "bob"},
"containers": []
}


Expand Down

0 comments on commit 79581f7

Please sign in to comment.