-
Notifications
You must be signed in to change notification settings - Fork 10
mgmt-23250: Expose AAP configuration from the LZ #31
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| - name: "Check if the repository tarball exists" | ||
| ansible.builtin.stat: | ||
| path: "{{ aap_archive_dest }}" | ||
| register: __aap_archive_tarball_exists | ||
| failed_when: false | ||
| changed_when: false | ||
|
|
||
| # If the repository tarball exists, you can force a refresh by setting aap_archive_refresh to true | ||
| - name: "Package AAP configuration repository and serve via HTTP" | ||
| block: | ||
| - name: "Create temporary directory" | ||
| ansible.builtin.file: | ||
| path: "{{ aap_archive_tmp_dir }}" | ||
| state: directory | ||
| mode: "0750" | ||
|
|
||
| - name: "Clone the configuration repository" | ||
| ansible.builtin.git: | ||
| repo: "{{ aap_config_repo }}" | ||
| dest: "{{ aap_archive_tmp_dir }}" | ||
| version: "{{ aap_config_version }}" | ||
|
|
||
| - name: "Create tarball of the repository" | ||
| ansible.builtin.archive: | ||
| path: "{{ aap_archive_tmp_dir }}" | ||
| dest: "{{ aap_archive_dest }}" | ||
| format: gz | ||
|
Comment on lines
+18
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: To exclude
Example (exclude - name: Archive repo without VCS + hidden dirs
community.general.archive:
path: /repo
dest: /tmp/repo.tar.gz
format: gz
exclusion_patterns:
- "**/.git"
- "**/.git/**"
- "**/.*"
- "**/.*/*"Source: References Citations:
🌐 Web query:
💡 Result: In the archive module, there isn’t a parameter literally named
Example (exclude specific directories): - community.general.archive:
path:
- /path/to/foo/*
dest: /path/file.tar.bz2
exclude_path:
- /path/to/foo/bar
- /path/to/foo/baz[1][2] Sources: Exclude Line 25 archives the entire clone directory created at lines 18–23, which includes Suggested fix - name: "Create tarball of the repository"
ansible.builtin.archive:
path: "{{ aap_archive_tmp_dir }}"
dest: "{{ aap_archive_dest }}"
format: gz
exclude_path: "{{ aap_archive_tmp_dir }}/.git"Alternatively, switch to 🤖 Prompt for AI Agents |
||
| ignore_errors: "{{ ansible_check_mode }}" | ||
|
|
||
| - name: "Set container recreate flag" | ||
| ansible.builtin.set_fact: | ||
| __aap_archive_container_recreate: true | ||
| always: | ||
| - name: "Remove temporary directory" | ||
| ansible.builtin.file: | ||
| path: "{{ aap_archive_tmp_dir }}" | ||
| state: absent | ||
| no_log: true | ||
| when: > | ||
| __aap_archive_tarball_exists.stat.exists is false or | ||
| __aap_archive_tarball_exists.stat.exists is not defined or | ||
| aap_archive_refresh | default(false) | bool | ||
|
|
||
| - name: "Run container to publish the AAP configuration" | ||
| containers.podman.podman_container: | ||
| name: "aap-archive-srv" | ||
| image: "{{ aap_archive_image }}" | ||
| authfile: "{{ aap_archive_authfile }}" | ||
| state: started | ||
| restart_policy: always | ||
| recreate: "{{ __aap_archive_container_recreate | default(false) | bool }}" | ||
| user: "1001" | ||
| command: "/usr/libexec/s2i/run" | ||
| security_opt: | ||
| - no-new-privileges | ||
| cap_drop: | ||
| - ALL | ||
| volumes: | ||
| - "{{ aap_archive_dest }}:/opt/app-root/src/aap-config-archive.tar.gz:Z" | ||
| publish: | ||
| - "{{ aap_archive_port }}:8080" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,10 +33,17 @@ | |
| not __aap_license_stat.stat.exists | bool | ||
|
|
||
| - name: "Deploy VMaaS" | ||
| ansible.builtin.include_tasks: | ||
| file: vmaas.yaml | ||
| apply: | ||
| tags: vmaas | ||
| block: | ||
| - name: "Deploy AAP configuration archive service in the LZ" | ||
| ansible.builtin.include_tasks: | ||
| file: aap_archive_service.yaml | ||
| apply: | ||
| tags: aap_archive_service | ||
|
Comment on lines
+37
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, locate the relevant files mentioned in the review
git ls-files | grep -E "(vmaas_validation|06-day2)" | head -20Repository: rh-ecosystem-edge/enclave Length of output: 129 🏁 Script executed: # Also search for these files more broadly
find . -name "vmaas_validation.yaml" -o -name "06-day2.yaml" 2>/dev/nullRepository: rh-ecosystem-edge/enclave Length of output: 133 🌐 Web query:
💡 Result: With
How to make
|
||
| - name: "Deploy VMaaS" | ||
| ansible.builtin.include_tasks: | ||
| file: vmaas.yaml | ||
| apply: | ||
| tags: vmaas | ||
| when: | ||
| - vmaas_clusters | length > 0 | ||
| - __aap_license_stat.stat.exists is defined | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,5 @@ metadata: | |
| namespace: {{ aap_ns | default('ansible-aap') }} | ||
| type: Opaque | ||
| stringData: | ||
| AAP_PROJECT_ARCHIVE_URI: "http://{{ lzBmcIP }}:{{ aap_archive_port }}/aap-config-archive.tar.gz" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a default filter or validation for Unlike Consider adding validation or a default filter to fail fast with a clear error message. 🛡️ Proposed fix to add validation+{% if lzBmcIP is not defined or lzBmcIP == '' %}
+{{ 'lzBmcIP must be defined in config/global.yaml' | mandatory }}
+{% endif %}
apiVersion: v1
kind: Secret
metadata:Or use an assertion in the calling playbook before rendering. 🤖 Prompt for AI Agents |
||
| REMOTE_CLUSTER_KUBECONFIG_SECRET_NAME: "{{ aap_kubeconfig_secret_name | default('vmaas-cluster-kubeconfig') }}" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Verification inconclusive
Script executed:
Repository: rh-ecosystem-edge/enclave
Repository: rh-ecosystem-edge/enclave
Exit code: 0
stdout:
Pin
aap_config_versionto an immutable ref.Line 18 uses
main, which makes archive contents drift over time. For reproducible and auditable deployments, use a tag or commit SHA instead of a branch reference.🤖 Prompt for AI Agents