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

[kustomize_deploy] Include symlinks when user kustomize dir is set #2546

Conversation

eduolivares
Copy link
Contributor

With this patch, not only regular files but also symlinks are taken into account.

@github-actions github-actions bot marked this pull request as draft November 18, 2024 08:38
Copy link

Thanks for the PR! ❤️
I'm marking it as a draft, once your happy with it merging and the PR is passing CI, click the "Ready for review" button below.

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/0b6480babdf1415894b1ce5747a88e7d

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 38m 43s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 14m 07s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 16m 29s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 09s
cifmw-pod-pre-commit POST_FAILURE in 7m 38s
✔️ cifmw-architecture-validate-hci SUCCESS in 5m 06s
✔️ build-push-container-cifmw-client SUCCESS in 21m 33s
✔️ cifmw-molecule-kustomize_deploy SUCCESS in 5m 10s

- name: Fetch the content of the kustomize patches
ansible.builtin.slurp:
path: "{{ item.path }}"
register: _cifmw_kustomize_deploy_yaml_patches_slurp
loop: "{{ _cifmw_kustomize_deploy_yaml_patches_find.files | default([]) }}"
loop: "{{ _cifmw_kustomize_deploy_yaml_patches_find | default([]) }}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can get rid of the new task, the one before this one and make this one like this:

    - name: Fetch the content of the kustomize patches
      ansible.builtin.debug:
        msg: "{{ item.path }}"
      register: _cifmw_kustomize_deploy_yaml_patches_slurp
      loop: >-
        {{
          _kustomize_deploy_yaml_files.results |
          map(attribute='files') | flatten
        }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested it and it looks much better. Thanks, @pablintino

With this patch, not only regular files but also symlinks are taken into
account.
@eduolivares eduolivares force-pushed the kustomize-patches-symlinks branch from 58a389e to d8995d3 Compare November 18, 2024 14:31
@eduolivares eduolivares marked this pull request as ready for review November 18, 2024 14:31
@pablintino
Copy link
Collaborator

/approve

@pablintino pablintino requested a review from a team November 18, 2024 17:25
Copy link
Collaborator

@lewisdenny lewisdenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

The default file_type for ansible.builtin.find is 'file'

This patch loops over both file and link file types, the loop returns two .results, each containing a filles list.

Fetch the content of the kustomize patches task guards against there being no files or links returned by looping over the returned files list and defaulting to an empty list.

It then filters the results pulling out the files attribute returns a flat list of files found.

Copy link
Contributor

openshift-ci bot commented Nov 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lewisdenny, pablintino

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [lewisdenny,pablintino]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@lewisdenny
Copy link
Collaborator

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Nov 19, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit f31aef1 into openstack-k8s-operators:main Nov 19, 2024
4 of 5 checks passed
@eduolivares eduolivares deleted the kustomize-patches-symlinks branch November 19, 2024 07:26
@eduolivares
Copy link
Contributor Author

/cherry-pick 18.0-fr1

@openshift-cherrypick-robot

@eduolivares: new pull request created: #2552

In response to this:

/cherry-pick 18.0-fr1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants