feat(x2a): Copy all files created#3181
Conversation
Changed Packages
|
When the export agent creates new files because of RULES, it will create files based on the rules, but was not copied on the phase: Example: ``` -> tail -n 5 ../chef-examples/EXPORT-AGENTS.md --- Every migrated Ansible project must include a GitHub Actions workflow at `.github/workflows/ansible-ci.yml` that runs `ansible-lint` on every pull request. The workflow runs on `ubuntu-latest`, checks out the code, installs `ansible-lint`, and executes `ansible-lint roles/ --strict`.% $ -> ls ../chef-examples/.github/workflows ansible-ci.yml ``` This change just go over the git files, and merged the files that are created, outside the ansible folder, and do all the files directly Related to: FLPATH-3351 Signed-off-by: Eloy Coto <eloy.coto@acalustra.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3181 +/- ##
==========================================
+ Coverage 60.97% 61.00% +0.02%
==========================================
Files 2098 2099 +1
Lines 65133 65165 +32
Branches 16908 16906 -2
==========================================
+ Hits 39717 39756 +39
+ Misses 25128 25116 -12
- Partials 288 293 +5
*This pull request uses carry forward flags. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
mareklibra
left a comment
There was a problem hiding this comment.
Original idea behind having all the filenames hardcoded was in having control over the target content to include what is really needed, having the artifacts.
This patch changes the logic - we will need to explicitly exclude whatever is meant to be temporal.
I agree it makes more sense when the input agents evolved from the single Chef.
It's not an issue, just noting.
| cp -v "${SOURCE_BASE}/Policyfile.lock.json" "${PROJECT_PATH}/" 2>/dev/null || true | ||
| # Copy all files the x2a tool created/modified to the module output directory | ||
| # Exclude files we copied into source before running x2a | ||
| copy_changed_files "${SOURCE_BASE}" "${OUTPUT_DIR}" \ |
There was a problem hiding this comment.
Does that properly handle the Policyfile.lock.json? The OUTPUT_DIR is a module path, not the project root as it used to be.
There was a problem hiding this comment.
Could INPUT-AGENTS.md be leaked into the module's directory?
There was a problem hiding this comment.
That files are to be copy, always
|
|
||
| echo "=== Copying changed files to ${dest_dir}/ ===" | ||
|
|
||
| cd "${source_dir}" |
There was a problem hiding this comment.
Missing revert - sort of pushd/popd clean-up would be safer for the future.
So far absolute paths are used, however leaving the working directory unchanged by the copy_changed_files would be a better practice.
Before the migration-dependencies were not copied, so the AI allucinated a bit without me noticing it. With this change, the files are copied correctly, and AI it's correct: From logs: ``` Copying migration-dependencies from target to source directory... '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies' -> '/workspace/source/migration-dependencies' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/.chef' -> '/workspace/source/migration-dependencies/.chef' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/.chef/config.rb' -> '/workspace/source/migration-dependencies/.chef/config.rb' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/Policyfile.lock.json' -> '/workspace/source/migration-dependencies/Policyfile.lock.json' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/README.md' -> '/workspace/source/migration-dependencies/README.md' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/cookbook_artifacts' -> '/workspace/source/migration-dependencies/cookbook_artifacts' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/cookbook_artifacts/cache-8af253a1652c2d2161cc3e72a8b3048c6ebcf62f' -> '/workspace/source/migration-dependencies/cookbook_artifacts/cache-8af253a1652c2d2161cc3e72a8b3048c6ebcf62f' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/cookbook_artifacts/cache-8af253a1652c2d2161cc3e72a8b3048c6ebcf62f/metadata.json' -> '/workspace/source/migration-dependencies/cookbook_artifacts/cache-8af253a1652c2d2161cc3e72a8b3048c6ebcf62f/metadata.json' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/cookbook_artifacts/cache-8af253a1652c2d2161cc3e72a8b3048c6ebcf62f/recipes' -> '/workspace/source/migration-dependencies/cookbook_artifacts/cache-8af253a1652c2d2161cc3e72a8b3048c6ebcf62f/recipes' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/cookbook_artifacts/cache-8af253a1652c2d2161cc3e72a8b3048c6ebcf62f/recipes/default.rb' -> '/workspace/source/migration-dependencies/cookbook_artifacts/cache-8af253a1652c2d2161cc3e72a8b3048c6ebcf62f/recipes/default.rb' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/cookbook_artifacts/fastapi-tutorial-dd2f622316b9a9e4b9bf50d492ffa2551017405b' -> '/workspace/source/migration-dependencies/cookbook_artifacts/fastapi-tutorial-dd2f622316b9a9e4b9bf50d492ffa2551017405b' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/cookbook_artifacts/fastapi-tutorial-dd2f622316b9a9e4b9bf50d492ffa2551017405b/metadata.json' -> '/workspace/source/migration-dependencies/cookbook_artifacts/fastapi-tutorial-dd2f622316b9a9e4b9bf50d492ffa2551017405b/metadata.json' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/cookbook_artifacts/fastapi-tutorial-dd2f622316b9a9e4b9bf50d492ffa2551017405b/recipes' -> '/workspace/source/migration-dependencies/cookbook_artifacts/fastapi-tutorial-dd2f622316b9a9e4b9bf50d492ffa2551017405b/recipes' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/cookbook_artifacts/fastapi-tutorial-dd2f622316b9a9e4b9bf50d492ffa2551017405b/recipes/default.rb' -> '/workspace/source/migration-dependencies/cookbook_artifacts/fastapi-tutorial-dd2f622316b9a9e4b9bf50d492ffa2551017405b/recipes/default.rb' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/cookbook_artifacts/memcached-7992788f1a376defb902059063f5295e37d281cb' -> '/workspace/source/migration-dependencies/cookbook_artifacts/memcached-7992788f1a376defb902059063f5295e37d281cb' '/workspace/target/llasd21312-c74d4e/modules/cache/migration-dependencies/cookbook_artifacts/memcached-7992788f1a376defb902059063f5295e37d281cb/.editorconfig' -> '/workspace/source/migration-dependencies/cookbook_artifacts/memcached-7992788f1a376defb902059063f5295e37d281cb/.editorconfig' ``` From the migration plan: ~~~ ``` cookbooks/cache/recipes/default.rb /workspace/source/migration-dependencies/cookbook_artifacts/memcached-7992788f1a376defb902059063f5295e37d281cb/recipes/default.rb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/recipes/default.rb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/recipes/_install_prereqs.rb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/recipes/install.rb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/recipes/ulimit.rb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/recipes/disable_os_default.rb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/recipes/configure.rb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/recipes/enable.rb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/providers/configure.rb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/providers/install.rb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/templates/default/redis.conf.erb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/templates/default/redis.init.erb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/templates/default/redis.upstart.conf.erb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/templates/default/redis@.service.erb /workspace/source/migration-dependencies/cookbook_artifacts/memcached-7992788f1a376defb902059063f5295e37d281cb/attributes/default.rb /workspace/source/migration-dependencies/cookbook_artifacts/redisio-cac70a2ec9102cac4f5391358c8565d244f5d4db/attributes/default.rb ``` ~~~ Signed-off-by: Eloy Coto <eloy.coto@acalustra.com>
|



When the export agent creates new files because of RULES, it will create files based on the rules, but was not copied on the phase:
Example:
This change just go over the git files, and merged the files that are created, outside the ansible folder, and do all the files directly
Related to: FLPATH-3351