https://pantsbuild.org/ logo
#general
Title
# general
g

gifted-agency-25998

01/13/2023, 5:26 PM
Hey, I am working on integrating
pants
into our CI/CD (GitHub Actions) and I would like to use
changed-since=origin/main
for example, but within a module within the repo - e.g.
products/productA
but it doesn't let me 😞
Copy code
Error: 5.99 [ERROR] You used `--changed-since` at the same time as using target arguments. Please use only one.
My intention was to set up separate workflows for each of the products. I see the value in doing it without limiting it, but the problem I currently have is that the IaC deployments need to go to different accounts for each product and it's currently configured at the github workflow level. Do I have an option other than to use approach #2 from the pants documentation of removing the
--changed-since
related flags? Medium term, I plan on integrating the iac credentials into the build system rather than relying on the CI/CD pipeline which seems to be the superior solution.
e

enough-analyst-54434

01/13/2023, 5:30 PM
The shell is your friend / have you considered something like:
Copy code
./pants --changed-since... list | grep products/productA | xargs ./pants <goal>
It would also be good to get a link to the #2 you mention ... its hard to know what part of the Pants documentation you're referring to.
So, the shell being your friend is still true - you always have that escape hatch Pants aside and I think it solves your issue here. That said, this also works from a quick test in the Pants repo on main:
Copy code
$ ./pants --changed-since=HEAD~10 list
build-support/bin/generate_github_workflows.py:py_scripts
src/python/pants/backend/codegen/protobuf/go/rules.py
src/python/pants/backend/codegen/protobuf/go/rules_integration_test.py:tests
src/python/pants/backend/experimental/go/register.py
src/python/pants/backend/go/dependency_inference_test.py:tests
src/python/pants/backend/go/target_type_rules.py
src/python/pants/backend/go/target_type_rules_test.py:tests
src/python/pants/backend/go/target_types.py
src/python/pants/backend/go/go_sources/load_go_binary.py
src/python/pants/backend/go/goals/__init__.py
src/python/pants/backend/go/goals/check.py
src/python/pants/backend/go/goals/check_test.py:tests
src/python/pants/backend/go/goals/debug_goals.py
src/python/pants/backend/go/goals/generate.py
src/python/pants/backend/go/goals/generate_test.py:tests
src/python/pants/backend/go/goals/package_binary.py
src/python/pants/backend/go/goals/package_binary_integration_test.py:tests
src/python/pants/backend/go/goals/run_binary.py
src/python/pants/backend/go/goals/run_binary_integration_test.py:tests
src/python/pants/backend/go/goals/tailor.py
src/python/pants/backend/go/goals/tailor_test.py:tests
src/python/pants/backend/go/goals/test.py
src/python/pants/backend/go/goals/test_test.py:tests
src/python/pants/backend/go/lint/golangci_lint/rules_integration_test.py:tests
src/python/pants/backend/go/lint/vet/rules_integration_test.py:tests
src/python/pants/backend/go/util_rules/assembly.py
src/python/pants/backend/go/util_rules/assembly_integration_test.py:tests
src/python/pants/backend/go/util_rules/build_opts_test.py:tests
src/python/pants/backend/go/util_rules/build_pkg.py
src/python/pants/backend/go/util_rules/build_pkg_target.py
src/python/pants/backend/go/util_rules/build_pkg_target_test.py:tests
src/python/pants/backend/go/util_rules/build_pkg_test.py:tests
src/python/pants/backend/go/util_rules/cgo.py
src/python/pants/backend/go/util_rules/cgo_test.py:tests
src/python/pants/backend/go/util_rules/coverage_test.py:tests
src/python/pants/backend/go/util_rules/embed_integration_test.py:tests
src/python/pants/backend/go/util_rules/first_party_pkg_test.py:tests
src/python/pants/backend/go/util_rules/import_analysis.py
src/python/pants/backend/go/util_rules/tests_analysis.py
src/python/pants/core/goals/check.py
Let's restrict without shell tricks:
Copy code
$ ./pants --changed-since=HEAD~10 --filter-address-regex=src/python/pants/core/ list
src/python/pants/core/goals/check.py
See
./pants help filter
for more filtering options you can combine with
--changed-since
g

gifted-agency-25998

01/15/2023, 9:41 AM
Thanks John - that makes a lot of sense. Approach #2 is mentioned on the CI/CD page, but I should have referenced it - apologies. Also, I had looked at the documentation and saw the reference to piping in the shell, but I didn't quite connect all the dots - Thank you for connecting them for me 😄
7 Views